Skip to content

Commit

Permalink
Merge branch 'main' into Add-StatementMacros-to-.clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Oct 19, 2024
2 parents 2b8ec37 + 5a46a21 commit b06cf68
Show file tree
Hide file tree
Showing 63 changed files with 450 additions and 447 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
13 changes: 6 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,24 @@ 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==18.* pycln
- run: pycln . --config=pycln.toml --check
- 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' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
if ($LastExitCode -ne 0) { exit $LastExitCode }
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
if ($LastExitCode -ne 0) { exit $LastExitCode }
shell: powershell
mypy:
runs-on: windows-2019
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.8
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
3 changes: 2 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Coming in build 309, as yet unreleased
--------------------------------------

* Dropped support for Python 3.7 (#2207, @Avasam)
* Implement record pointers as [in, out] method parameters of a Dispatch Interface (#2310)
* 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)
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
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
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
19 changes: 7 additions & 12 deletions adodbapi/adodbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,7 @@ def _rollback(self):
# If attributes has adXactAbortRetaining it performs retaining aborts that is,
# calling RollbackTrans automatically starts a new transaction. Not all providers support this.
# If not, we will have to start a new transaction by this command:
if (
not self.transaction_level
): # if self.transaction_level == 0 or self.transaction_level is None:
if not self.transaction_level:
self.transaction_level = self.connector.BeginTrans()
except Exception as e:
self._raiseConnectionError(api.ProgrammingError, e)
Expand Down Expand Up @@ -634,9 +632,8 @@ def _makeDescriptionFromRS(self):
if self.rs.EOF or self.rs.BOF:
display_size = None
else:
display_size = (
f.ActualSize
) # TODO: Is this the correct defintion according to the DB API 2 Spec ?
# TODO: Is this the correct defintion according to the DB API 2 Spec ?
display_size = f.ActualSize
null_ok = bool(f.Attributes & adc.adFldMayBeNull) # v2.1 Cole
desc.append(
(
Expand Down Expand Up @@ -774,9 +771,8 @@ def get_returned_parameters(self):
after the last recordset has been read. In that case, you must coll nextset() until it
returns None, then call this method to get your returned information."""

retLst = (
[]
) # store procedures may return altered parameters, including an added "return value" item
# store procedures may return altered parameters, including an added "return value" item
retLst = []
for p in tuple(self.cmd.Parameters):
if verbose > 2:
print(
Expand Down Expand Up @@ -907,9 +903,8 @@ def _buildADOparameterList(self, parameters, sproc=False):
)
i += 1
else: # -- build own parameter list
if (
self._parameter_names
): # we expect a dictionary of parameters, this is the list of expected names
# we expect a dictionary of parameters, this is the list of expected names
if self._parameter_names:
for parm_name in self._parameter_names:
elem = parameters[parm_name]
adotype = api.pyTypeToADOType(elem)
Expand Down
2 changes: 1 addition & 1 deletion adodbapi/examples/db_print.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" db_print.py -- a simple demo for ADO database reads."""
"""db_print.py -- a simple demo for ADO database reads."""

import sys

Expand Down
2 changes: 1 addition & 1 deletion adodbapi/examples/db_table_names.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" db_table_names.py -- a simple demo for ADO database table listing."""
"""db_table_names.py -- a simple demo for ADO database table listing."""

import sys

Expand Down
Loading

0 comments on commit b06cf68

Please sign in to comment.