Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Pre-commit auto-fix
  • Loading branch information
pre-commit-ci[bot] committed Jun 3, 2025
commit 9616ef6b18b5c5a5b64037a640d205868e66b964
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.
Outdated
)

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.
Outdated
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
8 changes: 4 additions & 4 deletions source/brailleInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ def _translate(self, endWord: bool) -> bool:
@param endWord: C{True} if this is the end of a word, C{False} otherwise.
@return: C{True} if translation produced text, C{False} if not.
"""
assert (
not self.useContractedForCurrentFocus or endWord
), "Must only translate contracted at end of word"
assert not self.useContractedForCurrentFocus or endWord, (
"Must only translate contracted at end of word"
)
if self.useContractedForCurrentFocus:
# self.bufferText has been used by _reportContractedCell, so clear it.
self.bufferText = ""
Expand Down Expand Up @@ -465,7 +465,7 @@ def handlePostConfigProfileSwitch(self):
self._table = brailleTables.getTable(tableName)
except LookupError:
log.error(
f"Invalid input table ({tableName}), " f"falling back to default ({FALLBACK_TABLE}).",
f"Invalid input table ({tableName}), falling back to default ({FALLBACK_TABLE}).",
)
self._table = brailleTables.getTable(FALLBACK_TABLE)

Expand Down
5 changes: 2 additions & 3 deletions source/config/featureFlag.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ def _transformSpec_AddFeatureFlagDefault(specString: str, **kwargs) -> str:
if not isinstance(optionsEnumVal, str):
raise VdtParamError(
name_or_msg=(
f"Param '{optionsEnumKey}' should have a string value"
f" but got {type(optionsEnumVal)}. {usage}"
f"Param '{optionsEnumKey}' should have a string value but got {type(optionsEnumVal)}. {usage}"
),
value=specString,
)
Expand Down Expand Up @@ -215,7 +214,7 @@ def _transformSpec_AddFeatureFlagDefault(specString: str, **kwargs) -> str:
)
if len(kwargs) != 2:
raise VdtParamError(
name_or_msg=("Unexpected number of params." f" Got {kwargs}. {usage}"),
name_or_msg=(f"Unexpected number of params. Got {kwargs}. {usage}"),
value=specString,
)
# ensure there is the expected default
Expand Down
4 changes: 2 additions & 2 deletions source/documentBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def script_speakRow(self, gesture):

script_speakRow.__doc__ = _(
# Translators: the description for the speak row command
"Reads the current row horizontally from left to right " "without moving the system caret.",
"Reads the current row horizontally from left to right without moving the system caret.",
)
script_speakRow.speakOnDemand = True

Expand All @@ -568,7 +568,7 @@ def script_speakColumn(self, gesture):

script_speakColumn.__doc__ = _(
# Translators: the description for the speak column command
"Reads the current column vertically from top to bottom " "without moving the system caret.",
"Reads the current column vertically from top to bottom without moving the system caret.",
)
script_speakColumn.speakOnDemand = True

Expand Down
Loading