Skip to content

Commit 3f0903c

Browse files
authored
Merge branch 'main' into try-shorten-cross-compile-command
2 parents 2fb45fd + ddc14b2 commit 3f0903c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+720
-322
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,25 @@ jobs:
152152
cache: pip
153153
cache-dependency-path: .github/workflows/main.yml
154154
- run: pip install clang-format==18.1.* pycln
155+
# !cancelled(): Show issues even if the previous steps failed. But still fail the job
155156
- run: pycln . --config=pycln.toml --check
156-
- uses: astral-sh/ruff-action@v3
157+
- name: Run Ruff linter
158+
uses: astral-sh/ruff-action@v3
157159
with:
158-
version: "0.8.4"
159-
- run: ruff format --check
160+
version: "0.11.0"
161+
if: ${{ !cancelled() }}
162+
- name: Run Ruff formatter
163+
run: ruff format --check
164+
if: ${{ !cancelled() }}
160165
# Too many files to fit in a single command, also exclude vendored Scintilla and MAPIStubLibrary
161166
- run: |
162167
clang-format --Werror --dry-run $(git ls-files '*.cpp' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
163168
if ($LastExitCode -ne 0) { exit $LastExitCode }
169+
if: ${{ !cancelled() }}
170+
- run: |
164171
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
165172
if ($LastExitCode -ne 0) { exit $LastExitCode }
173+
if: ${{ !cancelled() }}
166174
167175
mypy:
168176
runs-on: windows-2019

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repos:
2626
args: [--config=pycln.toml]
2727
verbose: true
2828
- repo: https://github.com/astral-sh/ruff-pre-commit
29-
rev: v0.8.4
29+
rev: v0.11.0
3030
hooks:
3131
- id: ruff # Run the linter.
3232
args: [--fix]

AutoDuck/BuildHHP.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def handle_globs(lGlobs):
6565
sCommonPrefix = os.path.split(sCommonPrefix)[0]
6666
sCommonPrefix = os.path.normpath(sCommonPrefix) + "\\"
6767
# else we have a trailing slash - it means we _expect_ it to be a patch as-is.
68-
assert (
69-
os.path.isdir(sCommonPrefix) and sCommonPrefix[-1] == "\\"
70-
), "commonprefix splitting ain't gunna work!"
68+
assert os.path.isdir(sCommonPrefix) and sCommonPrefix[-1] == "\\", (
69+
"commonprefix splitting ain't gunna work!"
70+
)
7171
print("sCommonPrefix=", sCommonPrefix)
7272
# Ok, now remove this common prefix from every file:
7373
lRelativeFiles = []

AutoDuck/document_object.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ def startElement(self, name, attrs):
1313
self.document.categories.append(Category(attrs))
1414
elif name == "overviews":
1515
category = self.document.categories[-1]
16-
assert (
17-
category.overviewItems is None
18-
), f"category {category!r} already has overviews"
16+
assert category.overviewItems is None, (
17+
f"category {category!r} already has overviews"
18+
)
1919
category.overviewItems = OverviewItems(attrs)
2020
elif name == "item":
2121
item = Item(attrs)

AutoDuck/py2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def BuildArgInfos(ob):
2424
info = DocInfo(n, ob)
2525
info.short_desc = info.desc = n
2626
info.default = ""
27-
if len(defs):
27+
if defs:
2828
default = repr(defs.pop())
2929
# the default may be an object, so the repr gives '<...>' - and
3030
# the angle brackets screw autoduck.

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Coming in build 311, as yet unreleased
1717
* Fixed `TypeError: cannot unpack non-iterable NoneType object` when registering an axscript client ScriptItem (#2513, @Avasam)
1818
* Fixed a memory leak when SafeArrays are used as out parameters (@the-snork)
1919
* Fixed dispatch handling for properties (@the-snork)
20+
* Resolved a handful of deprecation warnings (#2567, #2576, @Avasam)
21+
* The following classes now produce a valid `eval` string representation when calling `repr`: (#2573, @Avasam)
22+
* `pywin.tools.browser.HLIPythonObject`
23+
* `win32com.server.exception.COMException`
24+
* `win32comext.axscript.client.error.AXScriptException`
25+
* `win32comext.axscript.client.pyscript.NamedScriptAttribute`
2026

2127
Build 310, released 2025/03/16
2228
------------------------------

Pythonwin/pywin/dialogs/status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def ThreadedStatusProgressDialog(title, msg="", maxticks=100):
202202
# event - so use a dumb strategy
203203
end_time = time.time() + 10
204204
while time.time() < end_time:
205-
if t.createdEvent.isSet():
205+
if t.createdEvent.is_set():
206206
break
207207
win32ui.PumpWaitingMessages()
208208
time.sleep(0.1)

Pythonwin/pywin/scintilla/control.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,9 @@ def GetSelText(self):
424424

425425
def SetSel(self, start=0, end=None):
426426
if isinstance(start, tuple):
427-
assert (
428-
end is None
429-
), "If you pass a point in the first param, the second must be None"
427+
assert end is None, (
428+
"If you pass a point in the first param, the second must be None"
429+
)
430430
start, end = start
431431
elif end is None:
432432
end = start
@@ -453,9 +453,9 @@ def GetLineCount(self):
453453
def LineFromChar(self, charPos=-1):
454454
if charPos == -1:
455455
charPos = self.GetSel()[0]
456-
assert (
457-
charPos >= 0 and charPos <= self.GetTextLength()
458-
), f"The charPos postion ({charPos}) is invalid (max={self.GetTextLength()})"
456+
assert charPos >= 0 and charPos <= self.GetTextLength(), (
457+
f"The charPos postion ({charPos}) is invalid (max={self.GetTextLength()})"
458+
)
459459
# return self.SendScintilla(EM_EXLINEFROMCHAR, charPos)
460460
# EM_EXLINEFROMCHAR puts charPos in lParam, not wParam
461461
return self.SendScintilla(EM_EXLINEFROMCHAR, 0, charPos)
@@ -476,9 +476,9 @@ def GetTextRange(self, start=0, end=-1, decode=True):
476476
if end == -1:
477477
end = self.SendScintilla(scintillacon.SCI_GETTEXTLENGTH)
478478
assert end >= start, "Negative index requested (%d/%d)" % (start, end)
479-
assert (
480-
start >= 0 and start <= self.GetTextLength()
481-
), "The start postion is invalid"
479+
assert start >= 0 and start <= self.GetTextLength(), (
480+
"The start postion is invalid"
481+
)
482482
assert end >= 0 and end <= self.GetTextLength(), "The end postion is invalid"
483483
initer = null_byte * (end - start + 1)
484484
buff = array.array("b", initer)

Pythonwin/pywin/tools/browser.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,9 @@ def __eq__(self, other):
4545
return self.name == other.name
4646

4747
def __repr__(self):
48-
try:
49-
type = self.GetHLIType()
50-
except:
51-
type = "Generic"
52-
return f"HLIPythonObject({type}) - name: {self.name} object: {self.myobject!r}"
48+
return (
49+
f"{self.__class__.__name__}(name={self.name!r}, object={self.myobject!r})"
50+
)
5351

5452
def GetText(self):
5553
try:

Pythonwin/pywin/tools/hierlist.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ def HierInit(self, parent, listControl=None): # Used when window first exists.
9797
else:
9898
self.listControl = listControl
9999
lbid = listControl.GetDlgCtrlID()
100-
assert (
101-
self.listBoxId is None or self.listBoxId == lbid
102-
), "An invalid listbox control ID has been specified (specified as {}, but exists as {})".format(
103-
self.listBoxId, lbid
100+
assert self.listBoxId is None or self.listBoxId == lbid, (
101+
"An invalid listbox control ID has been specified (specified as {}, but exists as {})".format(
102+
self.listBoxId, lbid
103+
)
104104
)
105105
self.listBoxId = lbid
106106
self.listControl.SetImageList(self.imageList, commctrl.LVSIL_NORMAL)

0 commit comments

Comments
 (0)