Skip to content

Commit 85f0b96

Browse files
authored
Merge pull request #17671 from nvaccess/pre-commit-ci-update-config
updates for linting: ruff from 0.8.1 to 0.11.12 pre-commit from 4.0.1 to 4.2.0 pyright from 1.1.396 to 1.1.401 updates for pre-commit: github.com/asottile/add-trailing-comma: v3.1.0 → v3.2.0 github.com/astral-sh/ruff-pre-commit: v0.8.1 → v0.11.12 github.com/RobertCraigie/pyright-python: v1.1.394 → v1.1.401 github.com/RobertCraigie/pyright-python: v1.1.396 → v1.1.401 github.com/astral-sh/uv-pre-commit: 0.6.14 → 0.7.9 Merge as merge commit, to preserve the reference in .git-blame-ignore-revs
2 parents 70d1894 + 4bf7317 commit 85f0b96

Some content is hidden

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

47 files changed

+312
-323
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ f227ca64c7f4cb41f83f531436c6dd11cf3c1d58
2727
be112ed44cb68f622a770c72fd29dd10899e9d07
2828
# Fix E721
2929
73a3529d8b10eb73a45117eead906c0a9cb4c41b
30+
# String concatenation
31+
9616ef6b18b5c5a5b64037a640d205868e66b964

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ repos:
9191
)
9292
9393
- repo: https://github.com/asottile/add-trailing-comma
94-
rev: v3.1.0
94+
rev: v3.2.0
9595
hooks:
9696
# Ruff preserves indent/new-line formatting of function arguments, list items, and similar iterables,
9797
# if a trailing comma is added.
@@ -100,7 +100,7 @@ repos:
100100

101101
- repo: https://github.com/astral-sh/ruff-pre-commit
102102
# Matches Ruff version in pyproject.
103-
rev: v0.8.1
103+
rev: v0.11.12
104104
hooks:
105105
- id: ruff
106106
name: lint with ruff
@@ -109,14 +109,14 @@ repos:
109109
name: format with ruff
110110

111111
- repo: https://github.com/RobertCraigie/pyright-python
112-
rev: v1.1.394
112+
rev: v1.1.401
113113
hooks:
114114
- id: pyright
115115
alias: pyrightLocal
116116
name: Check types with pyright
117117

118118
- repo: https://github.com/RobertCraigie/pyright-python
119-
rev: v1.1.396
119+
rev: v1.1.401
120120
hooks:
121121
- id: pyright
122122
alias: pyrightCI
@@ -126,7 +126,7 @@ repos:
126126
stages: [manual] # Only run from CI manually
127127

128128
- repo: https://github.com/astral-sh/uv-pre-commit
129-
rev: 0.6.14
129+
rev: 0.7.9
130130
hooks:
131131
- id: uv-lock
132132
name: Verify uv lock file

projectDocs/testing/automated.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You can run pre-commit hooks manually with [`pre commit run`](https://pre-commit
2626

2727
- You can filter files with `--files` and `--all-files`
2828
- You can also compare two revisions:
29-
`pre-commit run --from-ref origin/master --to-ref HEAD`
29+
`uv run pre-commit run --from-ref origin/master --to-ref HEAD`
3030

3131
### Translatable string checks
3232

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ dev = [
306306
"setuptools~=72.0",
307307
]
308308
lint = [
309-
"ruff==0.8.1",
310-
"pre-commit==4.0.1",
311-
"pyright==1.1.396",
309+
"ruff==0.11.12",
310+
"pre-commit==4.2.0",
311+
"pyright==1.1.401",
312312
]
313313
license-check = [
314314
"licensecheck==2024.3",

source/COMRegistrationFixes/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def fixCOMRegistrations() -> None:
117117
OSMajorMinor = (winVer.major, winVer.minor)
118118
is64bit = winVer.processorArchitecture.endswith("64")
119119
log.debug(
120-
f"Fixing COM registrations for Windows {OSMajorMinor[0]}.{OSMajorMinor[1]}, " "{} bit.".format(
120+
f"Fixing COM registrations for Windows {OSMajorMinor[0]}.{OSMajorMinor[1]}, {{}} bit.".format(
121121
"64" if is64bit else "32",
122122
),
123123
)

source/IAccessibleHandler/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ def processFocusWinEvent(window, objectID, childID, force=False):
692692
"""
693693
if isMSAADebugLoggingEnabled():
694694
log.debug(
695-
f"Processing focus winEvent: {getWinEventLogInfo(window, objectID, childID)}, " f"force {force}",
695+
f"Processing focus winEvent: {getWinEventLogInfo(window, objectID, childID)}, force {force}",
696696
)
697697
windowClassName = winUser.getClassName(window)
698698
# Generally, we must ignore focus on child windows of SDM windows as we only want the SDM MSAA events.

source/JABHandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
A11Y_PROPS_PATH = os.path.expanduser(r"~\.accessibility.properties")
4949
#: The content of ".accessibility.properties" when JAB is enabled.
5050
A11Y_PROPS_CONTENT = (
51-
"assistive_technologies=com.sun.java.accessibility.AccessBridge\n" "screen_magnifier_present=true\n"
51+
"assistive_technologies=com.sun.java.accessibility.AccessBridge\nscreen_magnifier_present=true\n"
5252
)
5353

5454
# Some utility functions to help with function defines

source/NVDAObjects/IAccessible/ia2TextMozilla.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def _getText(self, withFields, formatConfig=None):
386386
ti = self._getEmbedding(obj)
387387
if not ti:
388388
log.debugWarning(
389-
"_getEmbedding returned None while getting initial fields. " "Object probably dead.",
389+
"_getEmbedding returned None while getting initial fields. Object probably dead.",
390390
)
391391
return []
392392
obj = ti.obj
@@ -420,7 +420,7 @@ def _getText(self, withFields, formatConfig=None):
420420
ti = self._getEmbedding(obj)
421421
if not ti:
422422
log.debugWarning(
423-
"_getEmbedding returned None while ascending to get more text. " "Object probably dead.",
423+
"_getEmbedding returned None while ascending to get more text. Object probably dead.",
424424
)
425425
return []
426426
obj = ti.obj

source/NVDAObjects/UIA/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ def _getTextWithFields_text(
679679
furtherUIAFormatUnits = self.UIAFormatUnits if UIAFormatUnits is None else []
680680
if debug:
681681
log.debug(
682-
f"Walking by unit {unit}, " f"with further units of: {furtherUIAFormatUnits}",
682+
f"Walking by unit {unit}, with further units of: {furtherUIAFormatUnits}",
683683
)
684684
rangeIter = iterUIARangeByUnit(textRange, unit) if unit is not None else [textRange]
685685
for tempRange in rangeIter:
@@ -934,7 +934,7 @@ def _getTextWithFieldsForUIARange( # noqa: C901
934934
if lastChildEndDelta > 0:
935935
if debug:
936936
log.debug(
937-
"textRange ended part way through the child. " "Crop end of childRange to fit",
937+
"textRange ended part way through the child. Crop end of childRange to fit",
938938
)
939939
childRange.MoveEndpointByRange(
940940
UIAHandler.TextPatternRangeEndpoint_End,
@@ -961,8 +961,7 @@ def _getTextWithFieldsForUIARange( # noqa: C901
961961
elif childStartDelta < 0:
962962
if debug:
963963
log.debug(
964-
"textRange started part way through child. "
965-
"Cropping Start of child range to fit",
964+
"textRange started part way through child. Cropping Start of child range to fit",
966965
)
967966
childRange.MoveEndpointByRange(
968967
UIAHandler.TextPatternRangeEndpoint_Start,

source/NVDAObjects/window/excel.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,8 +1884,7 @@ def _get_positionInfo(self):
18841884
@script(
18851885
description=_(
18861886
# Translators: the description for a script for Excel
1887-
"Reports the note on the current cell. "
1888-
"If pressed twice, presents the information in browse mode",
1887+
"Reports the note on the current cell. If pressed twice, presents the information in browse mode",
18891888
),
18901889
gesture="kb:NVDA+alt+c",
18911890
category=SCRCAT_SYSTEMCARET,

source/UIAHandler/__init__.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -828,13 +828,12 @@ def IUIAutomationEventHandler_HandleAutomationEvent(self, sender, eventID):
828828
):
829829
if _isDebug():
830830
log.debug(
831-
"HandleAutomationEvent: "
832-
f"Ignoring event {NVDAEventName} because ignored by object itself",
831+
f"HandleAutomationEvent: Ignoring event {NVDAEventName} because ignored by object itself",
833832
)
834833
return
835834
if _isDebug():
836835
log.debug(
837-
f"handleAutomationEvent: queuing NVDA event {NVDAEventName} " f"for NVDAObject {obj} ",
836+
f"handleAutomationEvent: queuing NVDA event {NVDAEventName} for NVDAObject {obj} ",
838837
)
839838
eventHandler.queueEvent(NVDAEventName, obj)
840839

@@ -920,7 +919,7 @@ def IUIAutomationFocusChangedEventHandler_HandleFocusChangedEvent(self, sender):
920919
return
921920
if _isDebug():
922921
log.debug(
923-
"handleFocusChangedEvent: Queuing NVDA gainFocus event " f"for obj {obj} ",
922+
f"handleFocusChangedEvent: Queuing NVDA gainFocus event for obj {obj} ",
924923
)
925924
eventHandler.queueEvent("gainFocus", obj)
926925

@@ -974,7 +973,7 @@ def IUIAutomationPropertyChangedEventHandler_HandlePropertyChangedEvent(
974973
):
975974
if _isDebug():
976975
log.debug(
977-
"propertyChange event is for focus. " f"Redirecting event to focus NVDAObject {focus}",
976+
f"propertyChange event is for focus. Redirecting event to focus NVDAObject {focus}",
978977
)
979978
obj = focus
980979
elif not self.isNativeUIAElement(sender):
@@ -1016,7 +1015,7 @@ def IUIAutomationPropertyChangedEventHandler_HandlePropertyChangedEvent(
10161015
)
10171016
if _isDebug():
10181017
log.debug(
1019-
f"handlePropertyChangeEvent: queuing NVDA {NVDAEventName} event " f"for NVDAObject {obj} ",
1018+
f"handlePropertyChangeEvent: queuing NVDA {NVDAEventName} event for NVDAObject {obj} ",
10201019
)
10211020
eventHandler.queueEvent(NVDAEventName, obj)
10221021

@@ -1069,7 +1068,7 @@ def IUIAutomationNotificationEventHandler_HandleNotificationEvent(
10691068
return
10701069
if _isDebug():
10711070
log.debug(
1072-
"Queuing UIA_notification NVDA event " f"for NVDAObject {obj}",
1071+
f"Queuing UIA_notification NVDA event for NVDAObject {obj}",
10731072
)
10741073
eventHandler.queueEvent(
10751074
"UIA_notification",
@@ -1360,8 +1359,7 @@ def getNearestWindowHandle(self, UIAElement):
13601359
return None
13611360
if _isDebug():
13621361
log.debug(
1363-
"Found ancestor element "
1364-
f"with valid windowHandle {self.getWindowHandleDebugString(window)}",
1362+
f"Found ancestor element with valid windowHandle {self.getWindowHandleDebugString(window)}",
13651363
)
13661364
# Cache for future use to improve performance.
13671365
UIAElement._nearestWindowHandle = window
@@ -1436,7 +1434,7 @@ def isNativeUIAElement(self, UIAElement):
14361434
if processID == globalVars.appPid:
14371435
if _isDebug():
14381436
log.debug(
1439-
"element is local to NVDA, " "treating as non-native.",
1437+
"element is local to NVDA, treating as non-native.",
14401438
)
14411439
return False
14421440
# Whether this is a native element depends on whether its window natively supports UIA.

source/UIAHandler/_remoteOps/operation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,12 @@ def _dumpRemoteLog(self):
299299
f"Remote log for execution {self._executionCount}\n"
300300
"--- Begin ---\n"
301301
f"{logOutput}"
302-
"--- end ---",
302+
"--- end ---", # fmt: skip
303303
)
304304

305305
def _dumpCompiletimeLog(self):
306306
log.info(
307-
"Dumping instructions:\n" "--- Begin ---\n" f"{self._rob.dumpInstructions()}" "--- End ---",
307+
f"Dumping instructions:\n--- Begin ---\n{self._rob.dumpInstructions()}--- End ---",
308308
)
309309

310310
def _executeUntilSuccess(self, maxTries: int) -> Generator[ExecutionResult, None, None]:
@@ -330,7 +330,7 @@ def _executeUntilSuccess(self, maxTries: int) -> Generator[ExecutionResult, None
330330
f"Error occured on execution try {self._executionCount}",
331331
)
332332
e.add_note(
333-
"Dumping instructions:\n" "--- Begin ---\n" f"{self._rob.dumpInstructions()}" "--- End ---",
333+
f"Dumping instructions:\n--- Begin ---\n{self._rob.dumpInstructions()}--- End ---",
334334
)
335335
raise
336336

source/_remoteClient/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def _generateSelfSignedCert(self) -> None:
194194
config["trustedCertificates"]["localhost"] = fingerprint
195195
config["trustedCertificates"]["127.0.0.1"] = fingerprint
196196

197-
log.info("Generated new self-signed certificate for NVDA Remote. " f"Fingerprint: {fingerprint}")
197+
log.info(f"Generated new self-signed certificate for NVDA Remote. Fingerprint: {fingerprint}")
198198

199199
def getCurrentFingerprint(self) -> str | None:
200200
"""Get the fingerprint of the current certificate."""
@@ -461,7 +461,7 @@ def do_join(self, obj: dict[str, Any]) -> None:
461461
return
462462
self.connectionType = obj.get("connection_type")
463463
self.authenticated = True
464-
log.info(f"Client {self.id} authenticated successfully " f"(connection type: {self.connectionType})")
464+
log.info(f"Client {self.id} authenticated successfully (connection type: {self.connectionType})")
465465
clients = []
466466
clientIds = []
467467
for client in list(self.server.clients.values()):

source/addonStore/dataManager.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ def _getLatestAddonsDataForVersion(self, apiVersion: str) -> Optional[bytes]:
130130
return None
131131
if response.status_code != requests.codes.OK:
132132
log.error(
133-
f"Unable to get data from API ({url}),"
134-
f" response ({response.status_code}): {response.content}",
133+
f"Unable to get data from API ({url}), response ({response.status_code}): {response.content}",
135134
)
136135
return None
137136
return response.content
@@ -146,8 +145,7 @@ def _getCacheHash(self) -> Optional[str]:
146145
return None
147146
if response.status_code != requests.codes.OK:
148147
log.error(
149-
f"Unable to get data from API ({url}),"
150-
f" response ({response.status_code}): {response.content}",
148+
f"Unable to get data from API ({url}), response ({response.status_code}): {response.content}",
151149
)
152150
return None
153151
cacheHash = response.json()

source/addonStore/models/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def getIncompatibleReason(
115115
# Translators: The reason an add-on is not compatible.
116116
# A more recent version of NVDA is required for the add-on to work.
117117
# The placeholder will be replaced with Year.Major.Minor (e.g. 2019.1).
118-
"An updated version of NVDA is required. " "NVDA version {nvdaVersion} or later.",
118+
"An updated version of NVDA is required. NVDA version {nvdaVersion} or later.",
119119
).format(
120120
nvdaVersion=addonAPIVersion.formatForGUI(self.minimumNVDAVersion),
121121
)

source/appModuleHandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ def getWmiProcessInfo(processId):
864864
try:
865865
wmi = comtypes.client.CoGetObject(r"winmgmts:root\cimv2", dynamic=True)
866866
results = wmi.ExecQuery(
867-
"select * from Win32_Process " "where ProcessId = %d" % processId,
867+
"select * from Win32_Process where ProcessId = %d" % processId,
868868
)
869869
for result in results:
870870
return result

source/baseObject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def getScript(self, gesture):
312312
continue
313313
except AttributeError:
314314
log.exception(
315-
("Base class may not have been initialized." f"\nMRO={self.__class__.__mro__}")
315+
f"Base class may not have been initialized.\nMRO={self.__class__.__mro__}"
316316
if not hasattr(self, "_gestureMap")
317317
else None,
318318
)

source/bdDetect.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ def addUsbDevice(
737737
"""
738738
if not isinstance(id, str) or not USB_ID_REGEX.match(id):
739739
raise ValueError(
740-
f"Invalid ID provided for driver {self._driver!r}, type {type!r}: " f"{id!r}",
740+
f"Invalid ID provided for driver {self._driver!r}, type {type!r}: {id!r}",
741741
)
742742
devs = self._getDriverDict()
743743
driverUsb = devs[CommunicationType.USB]
@@ -771,8 +771,7 @@ def addUsbDevices(
771771
malformedIds = [id for id in ids if not isinstance(id, str) or not USB_ID_REGEX.match(id)]
772772
if malformedIds:
773773
raise ValueError(
774-
f"Invalid IDs provided for driver {self._driver!r}, type {type!r}: "
775-
f"{', '.join(malformedIds)}",
774+
f"Invalid IDs provided for driver {self._driver!r}, type {type!r}: {', '.join(malformedIds)}",
776775
)
777776
devs = self._getDriverDict()
778777
driverUsb = devs[CommunicationType.USB]

source/braille.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3181,8 +3181,7 @@ def handlePostConfigProfileSwitch(self):
31813181
self._table = brailleTables.getTable(table)
31823182
except LookupError:
31833183
log.error(
3184-
f"Invalid translation table ({tableName}), "
3185-
f"falling back to default ({FALLBACK_TABLE}).",
3184+
f"Invalid translation table ({tableName}), falling back to default ({FALLBACK_TABLE}).",
31863185
)
31873186
self._table = brailleTables.getTable(FALLBACK_TABLE)
31883187

source/brailleDisplayDrivers/albatross/_threading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def run(self):
7373
self._event.wait(KC_INTERVAL)
7474
continue
7575
log.debug(
76-
f"Port {self._dev.name} present, calling {self._readFunction.__name__} " "to open it",
76+
f"Port {self._dev.name} present, calling {self._readFunction.__name__} to open it",
7777
)
7878
self._readFunction()
7979
if not self._dev.is_open:

source/brailleDisplayDrivers/albatross/driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def _readInitByte(self) -> bool:
329329
except (IOError, AttributeError):
330330
self._disableConnection()
331331
log.debug(
332-
f"INIT_START_BYTE {INIT_START_BYTE} read failed, " "trying to reconnect",
332+
f"INIT_START_BYTE {INIT_START_BYTE} read failed, trying to reconnect",
333333
exc_info=True,
334334
)
335335
return False
@@ -661,7 +661,7 @@ def _handleKeyPresses(self, data: bytes):
661661
self._waitingCtrlPacket = True
662662
self._partialCtrlPacket = data
663663
log.debug(
664-
f"Read: Ctrl key packet {data} dequeued partially, " "_readQueue is empty",
664+
f"Read: Ctrl key packet {data} dequeued partially, _readQueue is empty",
665665
exc_info=True,
666666
)
667667
return

source/brailleDisplayDrivers/eurobraille/driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def __init__(self, port="Auto"):
143143
)
144144
if self.deviceType.startswith(("bnote", "bbook")):
145145
# send identifier to bnote / bbook with current COM port
146-
comportNumber = f'{int(re.match(".*?([0-9]+)$", port).group(1)):02d}'
146+
comportNumber = f"{int(re.match('.*?([0-9]+)$', port).group(1)):02d}"
147147
identifier = f"NVDA/{comportNumber}".encode()
148148
log.debug(f"sending {identifier} to eurobraille display")
149149
self._sendPacket(constants.EB_SYSTEM, constants.EB_CONNECTION_NAME, identifier)

source/brailleDisplayDrivers/seikantk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def __init__(self, port: typing.Union[None, str, DeviceMatch]):
177177
raise RuntimeError("No MINI-SEIKA display found, no response")
178178
else:
179179
log.info(
180-
f"Seika notetaker," f" Cells {self.numCells}" f" Buttons {self.numBtns}",
180+
f"Seika notetaker, Cells {self.numCells} Buttons {self.numBtns}",
181181
)
182182

183183
def _getDeviceInfo(self, dev: hwIo.IoBase) -> bool:

0 commit comments

Comments
 (0)