Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ repos:
)

- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
rev: v3.2.0
hooks:
# Ruff preserves indent/new-line formatting of function arguments, list items, and similar iterables,
# if a trailing comma is added.
Expand All @@ -100,7 +100,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Matches Ruff version in pyproject.
rev: v0.8.1
rev: v0.11.12
hooks:
- id: ruff
name: lint with ruff
Expand All @@ -109,14 +109,14 @@ repos:
name: format with ruff

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.394
rev: v1.1.401
hooks:
- id: pyright
alias: pyrightLocal
name: Check types with pyright

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.396
rev: v1.1.401
hooks:
- id: pyright
alias: pyrightCI
Expand All @@ -126,7 +126,7 @@ repos:
stages: [manual] # Only run from CI manually

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.6.14
rev: 0.7.9
hooks:
- id: uv-lock
name: Verify uv lock file
Expand Down
2 changes: 1 addition & 1 deletion projectDocs/testing/automated.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can run pre-commit hooks manually with [`pre commit run`](https://pre-commit

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

### Translatable string checks

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ dev = [
"setuptools~=72.0",
]
lint = [
"ruff==0.8.1",
"pre-commit==4.0.1",
"pyright==1.1.396",
"ruff==0.11.12",
"pre-commit==4.2.0",
"pyright==1.1.401",
]
license-check = [
"licensecheck==2024.3",
Expand Down
2 changes: 1 addition & 1 deletion source/COMRegistrationFixes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def fixCOMRegistrations() -> None:
OSMajorMinor = (winVer.major, winVer.minor)
is64bit = winVer.processorArchitecture.endswith("64")
log.debug(
f"Fixing COM registrations for Windows {OSMajorMinor[0]}.{OSMajorMinor[1]}, " "{} bit.".format(
f"Fixing COM registrations for Windows {OSMajorMinor[0]}.{OSMajorMinor[1]}, {{}} bit.".format(
"64" if is64bit else "32",
),
)
Expand Down
2 changes: 1 addition & 1 deletion source/IAccessibleHandler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def processFocusWinEvent(window, objectID, childID, force=False):
"""
if isMSAADebugLoggingEnabled():
log.debug(
f"Processing focus winEvent: {getWinEventLogInfo(window, objectID, childID)}, " f"force {force}",
f"Processing focus winEvent: {getWinEventLogInfo(window, objectID, childID)}, force {force}",
)
windowClassName = winUser.getClassName(window)
# Generally, we must ignore focus on child windows of SDM windows as we only want the SDM MSAA events.
Expand Down
2 changes: 1 addition & 1 deletion source/JABHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
A11Y_PROPS_PATH = os.path.expanduser(r"~\.accessibility.properties")
#: The content of ".accessibility.properties" when JAB is enabled.
A11Y_PROPS_CONTENT = (
"assistive_technologies=com.sun.java.accessibility.AccessBridge\n" "screen_magnifier_present=true\n"
"assistive_technologies=com.sun.java.accessibility.AccessBridge\nscreen_magnifier_present=true\n"
)

# Some utility functions to help with function defines
Expand Down
4 changes: 2 additions & 2 deletions source/NVDAObjects/IAccessible/ia2TextMozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def _getText(self, withFields, formatConfig=None):
ti = self._getEmbedding(obj)
if not ti:
log.debugWarning(
"_getEmbedding returned None while getting initial fields. " "Object probably dead.",
"_getEmbedding returned None while getting initial fields. Object probably dead.",
)
return []
obj = ti.obj
Expand Down Expand Up @@ -420,7 +420,7 @@ def _getText(self, withFields, formatConfig=None):
ti = self._getEmbedding(obj)
if not ti:
log.debugWarning(
"_getEmbedding returned None while ascending to get more text. " "Object probably dead.",
"_getEmbedding returned None while ascending to get more text. Object probably dead.",
)
return []
obj = ti.obj
Expand Down
7 changes: 3 additions & 4 deletions source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def _getTextWithFields_text(
furtherUIAFormatUnits = self.UIAFormatUnits if UIAFormatUnits is None else []
if debug:
log.debug(
f"Walking by unit {unit}, " f"with further units of: {furtherUIAFormatUnits}",
f"Walking by unit {unit}, with further units of: {furtherUIAFormatUnits}",
)
rangeIter = iterUIARangeByUnit(textRange, unit) if unit is not None else [textRange]
for tempRange in rangeIter:
Expand Down Expand Up @@ -934,7 +934,7 @@ def _getTextWithFieldsForUIARange( # noqa: C901
if lastChildEndDelta > 0:
if debug:
log.debug(
"textRange ended part way through the child. " "Crop end of childRange to fit",
"textRange ended part way through the child. Crop end of childRange to fit",
)
childRange.MoveEndpointByRange(
UIAHandler.TextPatternRangeEndpoint_End,
Expand All @@ -961,8 +961,7 @@ def _getTextWithFieldsForUIARange( # noqa: C901
elif childStartDelta < 0:
if debug:
log.debug(
"textRange started part way through child. "
"Cropping Start of child range to fit",
"textRange started part way through child. Cropping Start of child range to fit",
)
childRange.MoveEndpointByRange(
UIAHandler.TextPatternRangeEndpoint_Start,
Expand Down
3 changes: 1 addition & 2 deletions source/NVDAObjects/window/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1884,8 +1884,7 @@ def _get_positionInfo(self):
@script(
description=_(
# Translators: the description for a script for Excel
"Reports the note on the current cell. "
"If pressed twice, presents the information in browse mode",
"Reports the note on the current cell. If pressed twice, presents the information in browse mode",
),
gesture="kb:NVDA+alt+c",
category=SCRCAT_SYSTEMCARET,
Expand Down
18 changes: 8 additions & 10 deletions source/UIAHandler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,13 +828,12 @@ def IUIAutomationEventHandler_HandleAutomationEvent(self, sender, eventID):
):
if _isDebug():
log.debug(
"HandleAutomationEvent: "
f"Ignoring event {NVDAEventName} because ignored by object itself",
f"HandleAutomationEvent: Ignoring event {NVDAEventName} because ignored by object itself",
)
return
if _isDebug():
log.debug(
f"handleAutomationEvent: queuing NVDA event {NVDAEventName} " f"for NVDAObject {obj} ",
f"handleAutomationEvent: queuing NVDA event {NVDAEventName} for NVDAObject {obj} ",
)
eventHandler.queueEvent(NVDAEventName, obj)

Expand Down Expand Up @@ -920,7 +919,7 @@ def IUIAutomationFocusChangedEventHandler_HandleFocusChangedEvent(self, sender):
return
if _isDebug():
log.debug(
"handleFocusChangedEvent: Queuing NVDA gainFocus event " f"for obj {obj} ",
f"handleFocusChangedEvent: Queuing NVDA gainFocus event for obj {obj} ",
)
eventHandler.queueEvent("gainFocus", obj)

Expand Down Expand Up @@ -974,7 +973,7 @@ def IUIAutomationPropertyChangedEventHandler_HandlePropertyChangedEvent(
):
if _isDebug():
log.debug(
"propertyChange event is for focus. " f"Redirecting event to focus NVDAObject {focus}",
f"propertyChange event is for focus. Redirecting event to focus NVDAObject {focus}",
)
obj = focus
elif not self.isNativeUIAElement(sender):
Expand Down Expand Up @@ -1016,7 +1015,7 @@ def IUIAutomationPropertyChangedEventHandler_HandlePropertyChangedEvent(
)
if _isDebug():
log.debug(
f"handlePropertyChangeEvent: queuing NVDA {NVDAEventName} event " f"for NVDAObject {obj} ",
f"handlePropertyChangeEvent: queuing NVDA {NVDAEventName} event for NVDAObject {obj} ",
)
eventHandler.queueEvent(NVDAEventName, obj)

Expand Down Expand Up @@ -1069,7 +1068,7 @@ def IUIAutomationNotificationEventHandler_HandleNotificationEvent(
return
if _isDebug():
log.debug(
"Queuing UIA_notification NVDA event " f"for NVDAObject {obj}",
f"Queuing UIA_notification NVDA event for NVDAObject {obj}",
)
eventHandler.queueEvent(
"UIA_notification",
Expand Down Expand Up @@ -1360,8 +1359,7 @@ def getNearestWindowHandle(self, UIAElement):
return None
if _isDebug():
log.debug(
"Found ancestor element "
f"with valid windowHandle {self.getWindowHandleDebugString(window)}",
f"Found ancestor element with valid windowHandle {self.getWindowHandleDebugString(window)}",
)
# Cache for future use to improve performance.
UIAElement._nearestWindowHandle = window
Expand Down Expand Up @@ -1436,7 +1434,7 @@ def isNativeUIAElement(self, UIAElement):
if processID == globalVars.appPid:
if _isDebug():
log.debug(
"element is local to NVDA, " "treating as non-native.",
"element is local to NVDA, treating as non-native.",
)
return False
# Whether this is a native element depends on whether its window natively supports UIA.
Expand Down
9 changes: 3 additions & 6 deletions source/UIAHandler/_remoteOps/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,12 @@ def _dumpRemoteLog(self):
logOutput = self._remoteLog.localValue
if logOutput:
log.info(
f"Remote log for execution {self._executionCount}\n"
"--- Begin ---\n"
f"{logOutput}"
"--- end ---",
f"Remote log for execution {self._executionCount}\n--- Begin ---\n{logOutput}--- end ---",
Comment thread
seanbudd marked this conversation as resolved.
Resolved
)

def _dumpCompiletimeLog(self):
log.info(
"Dumping instructions:\n" "--- Begin ---\n" f"{self._rob.dumpInstructions()}" "--- End ---",
f"Dumping instructions:\n--- Begin ---\n{self._rob.dumpInstructions()}--- End ---",
)

def _executeUntilSuccess(self, maxTries: int) -> Generator[ExecutionResult, None, None]:
Expand All @@ -330,7 +327,7 @@ def _executeUntilSuccess(self, maxTries: int) -> Generator[ExecutionResult, None
f"Error occured on execution try {self._executionCount}",
)
e.add_note(
"Dumping instructions:\n" "--- Begin ---\n" f"{self._rob.dumpInstructions()}" "--- End ---",
f"Dumping instructions:\n--- Begin ---\n{self._rob.dumpInstructions()}--- End ---",
)
raise

Expand Down
4 changes: 2 additions & 2 deletions source/_remoteClient/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def _generateSelfSignedCert(self) -> None:
config["trustedCertificates"]["localhost"] = fingerprint
config["trustedCertificates"]["127.0.0.1"] = fingerprint

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

def getCurrentFingerprint(self) -> str | None:
"""Get the fingerprint of the current certificate."""
Expand Down Expand Up @@ -461,7 +461,7 @@ def do_join(self, obj: dict[str, Any]) -> None:
return
self.connectionType = obj.get("connection_type")
self.authenticated = True
log.info(f"Client {self.id} authenticated successfully " f"(connection type: {self.connectionType})")
log.info(f"Client {self.id} authenticated successfully (connection type: {self.connectionType})")
clients = []
clientIds = []
for client in list(self.server.clients.values()):
Expand Down
6 changes: 2 additions & 4 deletions source/addonStore/dataManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ def _getLatestAddonsDataForVersion(self, apiVersion: str) -> Optional[bytes]:
return None
if response.status_code != requests.codes.OK:
log.error(
f"Unable to get data from API ({url}),"
f" response ({response.status_code}): {response.content}",
f"Unable to get data from API ({url}), response ({response.status_code}): {response.content}",
)
return None
return response.content
Expand All @@ -146,8 +145,7 @@ def _getCacheHash(self) -> Optional[str]:
return None
if response.status_code != requests.codes.OK:
log.error(
f"Unable to get data from API ({url}),"
f" response ({response.status_code}): {response.content}",
f"Unable to get data from API ({url}), response ({response.status_code}): {response.content}",
)
return None
cacheHash = response.json()
Expand Down
2 changes: 1 addition & 1 deletion source/addonStore/models/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def getIncompatibleReason(
# Translators: The reason an add-on is not compatible.
# A more recent version of NVDA is required for the add-on to work.
# The placeholder will be replaced with Year.Major.Minor (e.g. 2019.1).
"An updated version of NVDA is required. " "NVDA version {nvdaVersion} or later.",
"An updated version of NVDA is required. NVDA version {nvdaVersion} or later.",
).format(
nvdaVersion=addonAPIVersion.formatForGUI(self.minimumNVDAVersion),
)
Expand Down
2 changes: 1 addition & 1 deletion source/appModuleHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ def getWmiProcessInfo(processId):
try:
wmi = comtypes.client.CoGetObject(r"winmgmts:root\cimv2", dynamic=True)
results = wmi.ExecQuery(
"select * from Win32_Process " "where ProcessId = %d" % processId,
"select * from Win32_Process where ProcessId = %d" % processId,
)
for result in results:
return result
Expand Down
2 changes: 1 addition & 1 deletion source/baseObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def getScript(self, gesture):
continue
except AttributeError:
log.exception(
("Base class may not have been initialized." f"\nMRO={self.__class__.__mro__}")
(f"Base class may not have been initialized.\nMRO={self.__class__.__mro__}")
Comment thread
seanbudd marked this conversation as resolved.
Resolved
if not hasattr(self, "_gestureMap")
else None,
)
Expand Down
5 changes: 2 additions & 3 deletions source/bdDetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ def addUsbDevice(
"""
if not isinstance(id, str) or not USB_ID_REGEX.match(id):
raise ValueError(
f"Invalid ID provided for driver {self._driver!r}, type {type!r}: " f"{id!r}",
f"Invalid ID provided for driver {self._driver!r}, type {type!r}: {id!r}",
)
devs = self._getDriverDict()
driverUsb = devs[CommunicationType.USB]
Expand Down Expand Up @@ -771,8 +771,7 @@ def addUsbDevices(
malformedIds = [id for id in ids if not isinstance(id, str) or not USB_ID_REGEX.match(id)]
if malformedIds:
raise ValueError(
f"Invalid IDs provided for driver {self._driver!r}, type {type!r}: "
f"{', '.join(malformedIds)}",
f"Invalid IDs provided for driver {self._driver!r}, type {type!r}: {', '.join(malformedIds)}",
)
devs = self._getDriverDict()
driverUsb = devs[CommunicationType.USB]
Expand Down
3 changes: 1 addition & 2 deletions source/braille.py
Original file line number Diff line number Diff line change
Expand Up @@ -3181,8 +3181,7 @@ def handlePostConfigProfileSwitch(self):
self._table = brailleTables.getTable(table)
except LookupError:
log.error(
f"Invalid translation table ({tableName}), "
f"falling back to default ({FALLBACK_TABLE}).",
f"Invalid translation table ({tableName}), falling back to default ({FALLBACK_TABLE}).",
)
self._table = brailleTables.getTable(FALLBACK_TABLE)

Expand Down
2 changes: 1 addition & 1 deletion source/brailleDisplayDrivers/albatross/_threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def run(self):
self._event.wait(KC_INTERVAL)
continue
log.debug(
f"Port {self._dev.name} present, calling {self._readFunction.__name__} " "to open it",
f"Port {self._dev.name} present, calling {self._readFunction.__name__} to open it",
)
self._readFunction()
if not self._dev.is_open:
Expand Down
4 changes: 2 additions & 2 deletions source/brailleDisplayDrivers/albatross/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def _readInitByte(self) -> bool:
except (IOError, AttributeError):
self._disableConnection()
log.debug(
f"INIT_START_BYTE {INIT_START_BYTE} read failed, " "trying to reconnect",
f"INIT_START_BYTE {INIT_START_BYTE} read failed, trying to reconnect",
exc_info=True,
)
return False
Expand Down Expand Up @@ -661,7 +661,7 @@ def _handleKeyPresses(self, data: bytes):
self._waitingCtrlPacket = True
self._partialCtrlPacket = data
log.debug(
f"Read: Ctrl key packet {data} dequeued partially, " "_readQueue is empty",
f"Read: Ctrl key packet {data} dequeued partially, _readQueue is empty",
exc_info=True,
)
return
Expand Down
2 changes: 1 addition & 1 deletion source/brailleDisplayDrivers/eurobraille/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __init__(self, port="Auto"):
)
if self.deviceType.startswith(("bnote", "bbook")):
# send identifier to bnote / bbook with current COM port
comportNumber = f'{int(re.match(".*?([0-9]+)$", port).group(1)):02d}'
comportNumber = f"{int(re.match('.*?([0-9]+)$', port).group(1)):02d}"
identifier = f"NVDA/{comportNumber}".encode()
log.debug(f"sending {identifier} to eurobraille display")
self._sendPacket(constants.EB_SYSTEM, constants.EB_CONNECTION_NAME, identifier)
Expand Down
2 changes: 1 addition & 1 deletion source/brailleDisplayDrivers/seikantk.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def __init__(self, port: typing.Union[None, str, DeviceMatch]):
raise RuntimeError("No MINI-SEIKA display found, no response")
else:
log.info(
f"Seika notetaker," f" Cells {self.numCells}" f" Buttons {self.numBtns}",
f"Seika notetaker, Cells {self.numCells} Buttons {self.numBtns}",
)

def _getDeviceInfo(self, dev: hwIo.IoBase) -> bool:
Expand Down
Loading