Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mhammond/pywin32 into pyrig…
Browse files Browse the repository at this point in the history
…ht-unbound-globals
  • Loading branch information
Avasam committed Oct 19, 2024
2 parents 305a0a2 + 5a46a21 commit 737732e
Show file tree
Hide file tree
Showing 137 changed files with 694 additions and 559 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ indent_size = 4
max_line_length = 120 # Same as .clang-format

[*.py]
max_line_length = 88 # Same as Black
max_line_length = 88 # Same as Ruff's default
[*.md]
trim_trailing_whitespace = false
Expand Down
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@

# 2024-05-28 formatted c++ source with clang-format
637448f8252ab142eedd539ddf9b08259b73eecc

# 2024-10-14 formatted Python source with Ruff format
2b5191d8fc6f1d1fbde01481b49278c1957ef8f1
2 changes: 1 addition & 1 deletion .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For all bugs, please provide the following information:
## Expected behavior and actual behavior

## Steps to reproduce the problem
<!-- Prefer using code snippets rather than a screenshot. Please include a full minimal reproduction if possible. -->
<!-- Prefer using code snippets rather than a screenshot. Please include a [full minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) if possible. -->

1. ...
2. ...
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/download-arm64-libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
VERSION += f"-rc{sys.version_info.serial}"

URL = f"https://www.nuget.org/api/v2/package/pythonarm64/{VERSION}"
PATH = dest / f"pythonarm64.{VERSION}.zip"
DEST_PATH = dest / f"pythonarm64.{VERSION}.zip"

if PATH.is_file():
print("Skipping download because", PATH, "exists")
if DEST_PATH.is_file():
print("Skipping download because", DEST_PATH, "exists")
else:
print("Downloading", URL)
urlretrieve(URL, PATH)
print("Downloaded", PATH)
urlretrieve(URL, DEST_PATH)
print("Downloaded", DEST_PATH)

with ZipFile(PATH, "r") as zf:
with ZipFile(DEST_PATH, "r") as zf:
for name in zf.namelist():
zip_path = pathlib.PurePath(name)
if zip_path.parts[:2] == ("tools", "libs"):
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
architecture: ["x64", "x86"]

steps:
Expand All @@ -37,7 +37,7 @@ jobs:
run: |
python --version
pip --version
pip install --upgrade setuptools wheel
pip install --upgrade setuptools>=74 wheel
- name: Build and install
run: |
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
run: |
python --version
pip --version
pip install --upgrade setuptools wheel
pip install --upgrade setuptools>=74 wheel
- name: Obtain ARM64 library files
run: |
Expand All @@ -110,31 +110,29 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
# This job only needs to target the oldest version supported by our checkers
# (black>=24.10.0 supports Python >=3.9)
python-version: "3.9"
# This job only needs to target the oldest supported version
python-version: "3.8"
cache: pip
cache-dependency-path: .github/workflows/main.yml
- run: pip install clang-format pycln
- run: pycln . --config=pycln.toml --check
- uses: chartboost/ruff-action@v1
- uses: astral-sh/ruff-action@v1
with:
version: "0.4.5"
- uses: psf/black@stable
version: "0.4.9"
- uses: astral-sh/ruff-action@v1
with:
options: "--fast --check --diff --verbose"
version: "0.4.9"
args: "format --check"
- run: | # Too many files to fit in a single command, also exclude vendored Scintilla and MAPIStubLibrary
clang-format --Werror --dry-run $(git ls-files '*.cpp')
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
shell: powershell
mypy:
runs-on: windows-2019
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
# mypy 1.5 dropped support for Python 3.7
# mypy won't understand "3.13-dev", keeping the CI simple by just omitting it
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
Expand All @@ -154,7 +152,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ repos:
hooks:
- id: ruff # Run the linter.
args: [--fix]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
verbose: true
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.5
hooks:
Expand Down
28 changes: 7 additions & 21 deletions AutoDuck/Dump2HHC.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,7 @@ def _genItemsFromDict(dict, cat, output, target, do_children=1):
<param name="ImageNumber" value="1">
<param name="Local" value="{CHM}{context}">
</OBJECT>
""".format(
**locals()
)
""".format(**locals())
)
if not do_children:
continue
Expand Down Expand Up @@ -339,9 +337,7 @@ def genTOC(cats, output, title, target):
<param name="Local" value="{CHM}{target}.html">
</OBJECT>
<UL>
""".format(
**locals()
)
""".format(**locals())
)

for cat in cats:
Expand All @@ -355,9 +351,7 @@ def genTOC(cats, output, title, target):
<param name="Local" value="{CHM}{cat_id}.html">
</OBJECT>
<UL>
""".format(
**locals()
)
""".format(**locals())
)
# Next write the overviews for this category
output.write(
Expand All @@ -368,9 +362,7 @@ def genTOC(cats, output, title, target):
<param name="Local" value="{CHM}{cat_id}_overview.html">
</OBJECT>
<UL>
""".format(
**locals()
)
""".format(**locals())
)
_genItemsFromDict(cat.overviewTopics, cat, output, target)
_genItemsFromDict(cat.extOverviewTopics, cat, output, target)
Expand All @@ -387,9 +379,7 @@ def genTOC(cats, output, title, target):
<param name="Local" value="{CHM}{cat_id}_modules.html">
</OBJECT>
<UL>
""".format(
**locals()
)
""".format(**locals())
)
_genItemsFromDict(cat.modules, cat, output, target)
output.write(
Expand All @@ -404,9 +394,7 @@ def genTOC(cats, output, title, target):
<param name="ImageNumber" value="1">
<param name="Local" value="{CHM}{cat_id}_objects.html">
</OBJECT>
<UL>""".format(
**locals()
)
<UL>""".format(**locals())
)
# Don't show 'children' for objects - params etc don't need their own child nodes!
_genItemsFromDict(cat.objects, cat, output, target, do_children=0)
Expand All @@ -423,9 +411,7 @@ def genTOC(cats, output, title, target):
<param name="Local" value="{CHM}{cat_id}_constants.html">
</OBJECT>
<UL>
""".format(
**locals()
)
""".format(**locals())
)
_genItemsFromDict(cat.constants, cat, output, target)
output.write(
Expand Down
1 change: 0 additions & 1 deletion AutoDuck/TOCToHHK.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os.path
import sys

"""
Expand Down
8 changes: 8 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ Coming in build 309, as yet unreleased
--------------------------------------

* Fixed unbound global variables in `pywin.dialogs.ideoptions.OptionsPropPage`'s `OnFormat*` methods (#2283, @Avasam)
* Dropped support for Python 3.7 (#2207, @Avasam)
* Implement the creation of SAFEARRAY(VT_RECORD) from a sequence of COM Records (#2317, @geppi)
* Implement record pointers as [in, out] method parameters of a Dispatch Interface (#2304, #2310, @geppi)
* Fix memory leak converting to PyObject from some SAFEARRAY elements (#2316)
* Fix bug where makepy support was unnecessarily generated (#2354, #2353, @geppi)
* Fail sooner on invalid `win32timezone.TimeZoneInfo` creation (#2338, @Avasam)
* Removed temporary `win32com.server.policy` reexports hack (#2344, @Avasam)
Import `DispatcherWin32trace` and `DispatcherTrace` from `win32com.server.dispatcher` instead.
* Fixed `win32timezone.TimeZoneInfo` initialization from a `[DYNAMIC_]TIME_ZONE_INFORMATION` (#2339, @Avasam)
* Added runtime deprecation warning of `win2kras`, use `win32ras` instead (#2356, @Avasam)
* Improved handling of dict iterations and fallbacks (removes Python 2 support code, small general speed improvement) (#2332, #2330, @Avasam)
Expand Down
19 changes: 11 additions & 8 deletions Pythonwin/pywin/dialogs/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ def OnListClick(self, id, code):
return 1

def OnListItemChange(self, std, extra):
(hwndFrom, idFrom, code), (
itemNotify,
sub,
newState,
oldState,
change,
point,
lparam,
(
(hwndFrom, idFrom, code),
(
itemNotify,
sub,
newState,
oldState,
change,
point,
lparam,
),
) = (std, extra)
oldSel = (oldState & commctrl.LVIS_SELECTED) != 0
newSel = (newState & commctrl.LVIS_SELECTED) != 0
Expand Down
3 changes: 2 additions & 1 deletion Pythonwin/pywin/framework/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# The application is responsible for managing the main frame window.
#
# We also grab the FileOpen command, to invoke our Python editor
" The PythonWin application code. Manages most aspects of MDI, etc "
"The PythonWin application code. Manages most aspects of MDI, etc"

from __future__ import annotations

import os
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/editor/ModuleBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import win32con
import win32ui
from pywin.mfc import afxres
from pywin.tools import browser, hierlist
from pywin.tools import hierlist


class HierListCLBRModule(hierlist.HierListItem):
Expand Down
4 changes: 3 additions & 1 deletion Pythonwin/pywin/framework/editor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@ def SetEditorFontOption(option, newValue):
SetEditorOption(option, str(newValue))


from pywin.framework.editor.color.coloreditor import editorTemplate
from pywin.framework.editor.color.coloreditor import ( # nopycln: import
editorTemplate as editorTemplate, # Adds doc template & Re-export
)
1 change: 0 additions & 1 deletion Pythonwin/pywin/framework/editor/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import win32con
import win32ui
from pywin.framework.editor import GetEditorOption
from pywin.mfc import docview, object

BAK_NONE = 0
BAK_DOT_BAK = 1
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import pywin.framework.app
import pywin.scintilla.control
import pywin.scintilla.formatter
import pywin.scintilla.IDLEenvironment
import pywin.scintilla.IDLEenvironment # nopycln: import # Injects fast_readline into the IDLE auto-indent extension
import win32api
import win32clipboard
import win32con
Expand Down
8 changes: 7 additions & 1 deletion Pythonwin/pywin/framework/intpydde.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@

import win32api
import win32ui
from dde import *
from dde import ( # nopycln: import # Re-exported for intpyapp.py
CBF_FAIL_SELFCONNECTIONS as CBF_FAIL_SELFCONNECTIONS, # noqa: PLC0414
CreateConversation as CreateConversation, # noqa: PLC0414
CreateServer,
CreateServerSystemTopic,
error as error, # noqa: PLC0414
)
from pywin.mfc import object


Expand Down
4 changes: 1 addition & 3 deletions Pythonwin/pywin/framework/scriptutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
debugging_options = """No debugging
Step-through in the debugger
Run in the debugger
Post-Mortem of unhandled exceptions""".split(
"\n"
)
Post-Mortem of unhandled exceptions""".split("\n")

byte_cr = b"\r"
byte_lf = b"\n"
Expand Down
1 change: 1 addition & 0 deletions Pythonwin/pywin/framework/stdin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sys
sys.stdin = sys.stdin.real_file
"""

import sys

get_input_line = input
Expand Down
2 changes: 0 additions & 2 deletions Pythonwin/pywin/framework/toolmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import win32con
import win32ui

from . import app

tools = {}
idPos = 100

Expand Down
3 changes: 1 addition & 2 deletions Pythonwin/pywin/mfc/activex.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Support for ActiveX control hosting in Pythonwin.
"""
"""Support for ActiveX control hosting in Pythonwin."""

import win32ui
import win32uiole
Expand Down
4 changes: 3 additions & 1 deletion Pythonwin/pywin/scintilla/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import win32con
import win32ui

from . import IDLEenvironment, keycodes
from . import ( # nopycln: import # Injects fast_readline into the IDLE auto-indent extension
IDLEenvironment,
)

HANDLER_ARGS_GUESS = 0
HANDLER_ARGS_NATIVE = 1
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/scintilla/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pywin.mfc import afxres, docview

from . import (
IDLEenvironment, # IDLE emulation.
IDLEenvironment, # nopycln: import # Injects fast_readline into the IDLE auto-indent extension
bindings,
control,
scintillacon,
Expand Down
Loading

0 comments on commit 737732e

Please sign in to comment.