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
Run formatter
uv run ruff format
  • Loading branch information
seanbudd committed Aug 25, 2026
commit 2c5252e1b96076a5b62b9d25ad528f60ac48e6b9
13 changes: 8 additions & 5 deletions nvdaHelper/archBuild_sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ def clsidStringToCLSIDDefine(clsidString):
Into a c-style struct initializer for initializing a GUID (I.e. "{0xabcdef12,0xabcd,0xabcd,{0xab,0xcd,0xab,0xcd,0xef,0x12,0x34,0x56}}")
"""
d = clsidString[1:-1].replace("-", "")
return "{%s,%s,%s,%s}" % ( # noqa: UP031
"0x" + d[0:8],
"0x" + d[8:12],
"0x" + d[12:16],
"{%s}" % (",".join("0x" + d[x : x + 2] for x in range(16, 32, 2))), # noqa: UP031
return (
"{%s,%s,%s,%s}"
% ( # noqa: UP031
"0x" + d[0:8],
"0x" + d[8:12],
"0x" + d[12:16],
"{%s}" % (",".join("0x" + d[x : x + 2] for x in range(16, 32, 2))), # noqa: UP031
)
)


Expand Down
1 change: 0 additions & 1 deletion source/NVDAObjects/IAccessible/ia2TextMozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
This is now used by other applications as well.
"""


from comtypes import COMError # noqa: I001
import winUser
import textInfos
Expand Down
13 changes: 11 additions & 2 deletions source/NVDAObjects/IAccessible/mozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ def _get_descriptionFrom(self) -> controlTypes.DescriptionFrom:
def _get_presentationType(self):
presType = super().presentationType
if presType == self.presType_content: # noqa: SIM102
if self.role == controlTypes.Role.TABLE and self.IA2Attributes.get("layout-guess") == "true" or self.table and self.table.presentationType == self.presType_layout:
if (
self.role == controlTypes.Role.TABLE
and self.IA2Attributes.get("layout-guess") == "true"
or self.table
and self.table.presentationType == self.presType_layout
):
presType = self.presType_layout
return presType

Expand Down Expand Up @@ -257,7 +262,11 @@ def findExtraOverlayClasses(obj, clsList):
if cls:
clsList.append(cls)

if iaRole == oleacc.ROLE_SYSTEM_ROW or iaRole == oleacc.ROLE_SYSTEM_LISTITEM and hasattr(obj.parent, "IAccessibleTableObject"):
if (
iaRole == oleacc.ROLE_SYSTEM_ROW
or iaRole == oleacc.ROLE_SYSTEM_LISTITEM
and hasattr(obj.parent, "IAccessibleTableObject")
):
clsList.append(RowWithFakeNavigation)
elif iaRole == oleacc.ROLE_SYSTEM_OUTLINEITEM:
# Check if the tree view is a table.
Expand Down
1 change: 0 additions & 1 deletion source/NVDAObjects/IAccessible/winConsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class LegacyWinConsole(winConsole.WinConsole, IAccessible):
"""



def findExtraOverlayClasses(obj, clsList):
if getWinVer() >= WIN10_1607 and config.conf["terminals"]["keyboardSupportInLegacy"]:
clsList.append(EnhancedLegacyWinConsole)
Expand Down
6 changes: 2 additions & 4 deletions source/NVDAObjects/IAccessible/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,8 @@ def _moveInTable(self, row=True, forward=True):
ui.message(_("Not in table"))
return False
_cell = table.cell
getCell = (
lambda thisIndex, otherIndex: (
_cell(thisIndex, otherIndex) if row else _cell(otherIndex, thisIndex)
)
getCell = lambda thisIndex, otherIndex: (
_cell(thisIndex, otherIndex) if row else _cell(otherIndex, thisIndex)
)
thisIndex = rowNumber if row else columnNumber
otherIndex = columnNumber if row else rowNumber
Expand Down
1 change: 0 additions & 1 deletion source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,6 @@ class XamlEditableText(EditableTextBase, UIA):
"""An UIA element with editable text exposed by the XAML framework."""



class TreeviewItem(UIA):
def _get_value(self):
return ""
Expand Down
1 change: 0 additions & 1 deletion source/NVDAObjects/behaviors.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,6 @@ class KeyboardHandlerBasedTypedCharSupport(EnhancedTermTypedCharSupport):
and later."""



class CandidateItem(NVDAObject):
def getFormattedCandidateName(self, number, candidate):
if config.conf["inputComposition"]["alwaysIncludeShortCharacterDescriptionInCandidateName"]:
Expand Down
1 change: 0 additions & 1 deletion source/UIAHandler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ class UIAMixedAttributeError(ValueError):
"""Raised when a function would return a UIAutomation text attribute value that is mixed."""



def getUIATextAttributeValueFromRange(rangeObj, attrib, ignoreMixedValues=False):
"""
Wraps IUIAutomationTextRange::getAttributeValue, returning UIAutomation's reservedNotSupportedValue on COMError, and raising UIAMixedAttributeError if a mixed value would be returned and ignoreMixedValues is False.
Expand Down
2 changes: 2 additions & 0 deletions source/_synthDrivers32/sapi4.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ def IUnknown_Release(self, this: int, *args, **kwargs):
c_ulonglong_p = POINTER(c_ulonglong)
LP_IAudioDestNotifySink = POINTER(IAudioDestNotifySink)


class _Bookmark(NamedTuple):
bytePos: int
id: int


_lastLoggedTimes: dict[Callable, float] = dict() # noqa: C408


Expand Down
5 changes: 1 addition & 4 deletions source/appModules/hxmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

class MailWordDocumentTreeInterceptor(WordDocument.treeInterceptorClass):
def _get_isAlive(self):
return (
super().isAlive
and self.rootNVDAObject.shouldCreateTreeInterceptor
)
return super().isAlive and self.rootNVDAObject.shouldCreateTreeInterceptor


class MailWordDocument(WordDocument):
Expand Down
4 changes: 3 additions & 1 deletion source/appModules/powerpnt.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ def WindowSelectionChange(self, sel):
def getBulletText(ppBulletFormat):
t = ppBulletFormat.type
if t == ppBulletNumbered:
return "%d." % ppBulletFormat.number # (ppBulletFormat.startValue+(ppBulletFormat.number-1)) # noqa: UP031
return (
"%d." % ppBulletFormat.number
) # (ppBulletFormat.startValue+(ppBulletFormat.number-1)) # noqa: UP031
elif t:
return chr(ppBulletFormat.character)

Expand Down
1 change: 0 additions & 1 deletion source/bdDetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class DeviceType(metaclass=_DeviceTypeMeta):
Former members were split into the L{ProtocolType} and L{CommunicationType} enums."""



def __getattr__(attrName: str) -> Any:
"""Module level `__getattr__` used to preserve backward compatibility."""
if attrName == "DETECT_USB" and NVDAState._allowDeprecatedAPI():
Expand Down
8 changes: 3 additions & 5 deletions source/braille/regions/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ def _getAnnotationProperty(
# %s specifies the type of details (e.g. "has comment suggestion")
hasDetailsRoleTemplate = _("has %s")
rolesLabels = list( # noqa: C400

hasDetailsRoleTemplate % roleLabels.get(role, role.displayString)
for role in detailsRoles
if role # handle None case without the "has X" grammar.

hasDetailsRoleTemplate % roleLabels.get(role, role.displayString)
for role in detailsRoles
if role # handle None case without the "has X" grammar.
)
if None in detailsRoles:
rolesLabels.insert(0, genericDetailsRole)
Expand Down
1 change: 0 additions & 1 deletion source/brailleDisplayDrivers/brailleNote.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
See Brailliant B module for BrailleNote Touch support routines.
"""


import serial # noqa: I001
import bdDetect
import braille
Expand Down
14 changes: 7 additions & 7 deletions source/characterProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,12 @@ def _saveSymbolField(self, output, outputMap=None):
def _saveSymbol(self, symbol):
identifier = symbol.identifier
try:
identifier = "\\%s%s" % ( # noqa: UP031
self.IDENTIFIER_ESCAPES_OUTPUT[identifier[0]],
identifier[1:],
identifier = (
"\\%s%s"
% ( # noqa: UP031
self.IDENTIFIER_ESCAPES_OUTPUT[identifier[0]],
identifier[1:],
)
)
except KeyError:
pass
Expand Down Expand Up @@ -539,10 +542,7 @@ def __init__(self, locale: str):
patterns: list[str] = []
# Complex symbols.
# Each complex symbol has its own named group so we know which symbol matched.
patterns.extend(
f"(?P<c{index}>{symbol.pattern})"
for index, symbol in enumerate(complexSymbolsList)
)
patterns.extend(f"(?P<c{index}>{symbol.pattern})" for index, symbol in enumerate(complexSymbolsList))
patterns.extend(
[
# Strip repeated spaces from the end of the line to stop them from being picked up by repeated.
Expand Down
1 change: 0 additions & 1 deletion source/config/featureFlagEnums.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class FlagValueEnum(enum.EnumMeta, _DisplayStringEnumMixin, FeatureFlagEnumProto
"""Provided only for type annotations."""



class BoolFlag(DisplayStringEnum):
"""Generic logically bool feature flag.
The explicit DEFAULT option allows developers to differentiate between a value set that happens to be
Expand Down
8 changes: 7 additions & 1 deletion source/eventHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,13 @@ def executeEvent(

_virtualDesktopName = obj.name
core.callLater(250, handlePossibleDesktopNameChange)
if isGainFocus and not doPreGainFocus(obj, sleepMode=sleepMode) or not sleepMode and eventName == "documentLoadComplete" and not doPreDocumentLoadComplete(obj):
if (
isGainFocus
and not doPreGainFocus(obj, sleepMode=sleepMode)
or not sleepMode
and eventName == "documentLoadComplete"
and not doPreDocumentLoadComplete(obj)
):
return
elif not sleepMode:
_EventExecuter(eventName, obj, kwargs)
Expand Down
1 change: 0 additions & 1 deletion source/gui/guiHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ class SIPABCMeta(wx.siplib.wrappertype, ABCMeta):
"""Meta class to be used for wx subclasses with abstract methods."""



def wxCallOnMain[**P, T](
function: Callable[P, T],
*args: P.args,
Expand Down
42 changes: 16 additions & 26 deletions source/keyboardHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,20 @@ def passNextKeyThrough():


def isNVDAModifierKey(vkCode: int, extended: bool) -> bool:
if ( # noqa: SIM103
(config.conf["keyboard"]["NVDAModifierKeys"] & NVDAKey.NUMPAD_INSERT)
and vkCode == winUser.VK_INSERT
and not extended
) or (
(config.conf["keyboard"]["NVDAModifierKeys"] & NVDAKey.EXTENDED_INSERT)
and vkCode == winUser.VK_INSERT
and extended
) or (config.conf["keyboard"]["NVDAModifierKeys"] & NVDAKey.CAPS_LOCK) and vkCode == winUser.VK_CAPITAL:
if (
( # noqa: SIM103
(config.conf["keyboard"]["NVDAModifierKeys"] & NVDAKey.NUMPAD_INSERT)
and vkCode == winUser.VK_INSERT
and not extended
)
or (
(config.conf["keyboard"]["NVDAModifierKeys"] & NVDAKey.EXTENDED_INSERT)
and vkCode == winUser.VK_INSERT
and extended
)
or (config.conf["keyboard"]["NVDAModifierKeys"] & NVDAKey.CAPS_LOCK)
and vkCode == winUser.VK_CAPITAL
):
return True
else:
return False
Expand Down Expand Up @@ -207,16 +212,7 @@ def internal_keyDownEvent(vkCode, scanCode, extended, injected):
return False
gestureExecuted = False
try:
global \
lastNVDAModifier, \
lastNVDAModifierReleaseTime, \
bypassNVDAModifier, \
passKeyThroughCount, \
lastPassThroughKeyDown, \
currentModifiers, \
keyCounter, \
stickyNVDAModifier, \
stickyNVDAModifierLocked # noqa: PLW0602
global lastNVDAModifier, lastNVDAModifierReleaseTime, bypassNVDAModifier, passKeyThroughCount, lastPassThroughKeyDown, currentModifiers, keyCounter, stickyNVDAModifier, stickyNVDAModifierLocked # noqa: PLW0602
# Injected keys should be ignored in some cases.
if injected and (ignoreInjected or not config.conf["keyboard"]["handleInjectedKeys"]):
return True
Expand Down Expand Up @@ -361,13 +357,7 @@ def internal_keyUpEvent(vkCode, scanCode, extended, injected):
):
return False
try:
global \
lastNVDAModifier, \
lastNVDAModifierReleaseTime, \
bypassNVDAModifier, \
passKeyThroughCount, \
lastPassThroughKeyDown, \
currentModifiers # noqa: PLW0602
global lastNVDAModifier, lastNVDAModifierReleaseTime, bypassNVDAModifier, passKeyThroughCount, lastPassThroughKeyDown, currentModifiers # noqa: PLW0602
keyCode = (vkCode, extended)
# Injected keys should be ignored in some cases.
if injected:
Expand Down
6 changes: 5 additions & 1 deletion source/markdownTranslate.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ def skeletonizeLine(mdLine: str) -> str | None:
prefix, content, suffix = m.groups()
elif (m := re_bullet.match(mdLine)) or (m := re_number.match(mdLine)):
prefix, content = m.groups()
elif (m := re_tableRow.match(mdLine)) or (m := re_kcTitle.match(mdLine)) or (m := re_kcSettingsSection.match(mdLine)):
elif (
(m := re_tableRow.match(mdLine))
or (m := re_kcTitle.match(mdLine))
or (m := re_kcSettingsSection.match(mdLine))
):
prefix, content, suffix = m.groups() # noqa: RUF059
elif re_comment.match(mdLine):
return None
Expand Down
10 changes: 6 additions & 4 deletions source/speech/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ def cancelSpeech():

SayAllHandler.stop()
pre_speechCanceled.notify()
if _speechState.beenCanceled or _speechState.speechMode == SpeechMode.off or _speechState.speechMode == SpeechMode.beeps:
if (
_speechState.beenCanceled
or _speechState.speechMode == SpeechMode.off
or _speechState.speechMode == SpeechMode.beeps
):
return
_manager.cancel()
speechCanceled.notify()
Expand Down Expand Up @@ -2012,9 +2016,7 @@ def getPropertiesSpeech(
speakRole = False
role = controlTypes.Role.UNKNOWN
role = controlTypes.Role(role)
value: str | None = (
propertyValues.get("value") if role not in controlTypes.silentValuesForRoles else None
)
value: str | None = propertyValues.get("value") if role not in controlTypes.silentValuesForRoles else None
cellCoordsText: str | None = propertyValues.get("cellCoordsText")
rowNumber = propertyValues.get("rowNumber")
columnNumber = propertyValues.get("columnNumber")
Expand Down
4 changes: 1 addition & 3 deletions source/touchTracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,7 @@ def iterAllRawSingleTouchTrackers(self):
yield i

def __repr__(self):
return (
f"<MultiTouchTracker {self.numFingers}finger {self.action} {self.actionCount} times at position {self.x},{self.y}>"
)
return f"<MultiTouchTracker {self.numFingers}finger {self.action} {self.actionCount} times at position {self.x},{self.y}>"

def getDevInfoString(self):
msg = "%s\n" % self # noqa: UP031
Expand Down
6 changes: 0 additions & 6 deletions source/utils/displayString.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class _DisplayStringEnumMixinMeta(ABCMeta, EnumMeta):
"""



class _DisplayStringEnumMixin(ABC):
"""
This mixin can be used with a class which subclasses Enum to provided translated display strings for
Expand Down Expand Up @@ -68,22 +67,17 @@ class DisplayStringEnum(_DisplayStringEnumMixin, Enum, metaclass=_DisplayStringE
"""An Enum class that adds a displayString property defined by _displayStringLabels"""



class DisplayStringFlag(_DisplayStringEnumMixin, Flag, metaclass=_DisplayStringEnumMixinMeta):
"""A Flag class that adds a displayString property defined by _displayStringLabels"""



class DisplayStringStrEnum(_DisplayStringEnumMixin, str, Enum, metaclass=_DisplayStringEnumMixinMeta):
"""A str Enum class that adds a displayString property defined by _displayStringLabels"""



class DisplayStringIntEnum(_DisplayStringEnumMixin, IntEnum, metaclass=_DisplayStringEnumMixinMeta):
"""An IntEnum class that adds a displayString property defined by _displayStringLabels"""



class DisplayStringIntFlag(_DisplayStringEnumMixin, IntFlag, metaclass=_DisplayStringEnumMixinMeta):
"""An IntFlag class that adds a displayString property defined by _displayStringLabels"""

1 change: 0 additions & 1 deletion source/utils/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class JobClashError(Exception):
"""Raised when a job time clashes with an existing job."""



class ScheduleThread(threading.Thread):
name = "ScheduleThread"

Expand Down
1 change: 0 additions & 1 deletion source/utils/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ class _UnexpectedWindowCountError(Exception):
"""



def _isWindowBelowWindowMatchesCond(
window: winUser.HWNDVal,
matchCond: Callable[[winUser.HWNDVal], bool],
Expand Down
Loading