Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion source/NVDAObjects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ def _get_basicText(self):
newTime=time.time()
oldTime=getattr(self,'_basicTextTime',0)
if newTime-oldTime>0.5:
self._basicText=u" ".join([x for x in self.name, self.value, self.description if isinstance(x, basestring) and len(x) > 0 and not x.isspace()])
self._basicText=u" ".join(x for x in (self.name, self.value, self.description) if isinstance(x, basestring) and len(x) > 0 and not x.isspace())
if len(self._basicText)==0:
self._basicText=u""
else:
Expand Down
2 changes: 1 addition & 1 deletion source/appModules/soffice.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _get_states(self):
# #8988: Cells in Libre Office do not have the selected state when a single cell is selected (i.e. has focus).
# Since #8898, the negative selected state is announced for table cells with the selectable state.
states.add(controlTypes.STATE_SELECTED)
if self.IA2Attributes.get('Formula'):
if self.IA2Attributes.get('Formula'):
# #860: Recent versions of Calc expose has formula state via IAccessible 2.
states.add(controlTypes.STATE_HASFORMULA)
return states
Expand Down
2 changes: 1 addition & 1 deletion source/baseObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self,name,bases,dict):
s=dict.get('_set_%s'%x,None)
d=dict.get('_del_%s'%x,None)
if x in dict:
methodsString=",".join([str(i) for i in g,s,d if i])
methodsString=",".join(str(i) for i in (g,s,d) if i)
raise TypeError("%s is already a class attribute, cannot create descriptor with methods %s"%(x,methodsString))
if not g:
# There's a setter or deleter, but no getter.
Expand Down
2 changes: 1 addition & 1 deletion source/characterProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def __init__(self, locale):
# Simple symbols.
# These are all handled in one named group.
# Because the symbols are just text, we know which symbol matched just by looking at the matched text.
patterns.append(ur"(?P<simple>{multiChars}|{singleChars})".format(
patterns.append(r"(?P<simple>{multiChars}|{singleChars})".format(
multiChars="|".join(re.escape(identifier) for identifier in multiChars),
singleChars=characters
))
Expand Down
6 changes: 3 additions & 3 deletions source/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def saveOnExit():
def isInstalledCopy():
"""Checks to see if this running copy of NVDA is installed on the system"""
try:
k=winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NVDA")
k=winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NVDA")
instDir=winreg.QueryValueEx(k,"UninstallDirectory")[0]
except WindowsError:
return False
Expand Down Expand Up @@ -166,7 +166,7 @@ def initConfigPath(configPath=None):
if not os.path.isdir(subdir):
os.makedirs(subdir)

RUN_REGKEY = ur"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
RUN_REGKEY = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

def getStartAfterLogon():
if (easeOfAccess.isSupported and easeOfAccess.canConfigTerminateOnDesktopSwitch
Expand Down Expand Up @@ -234,7 +234,7 @@ def execElevated(path, params=None, wait=False,handleAlreadyElevated=False):

#: The name of the registry key stored under HKEY_LOCAL_MACHINE where system wide NVDA settings are stored.
#: Note that NVDA is a 32-bit application, so on X64 systems, this will evaluate to "SOFTWARE\WOW6432Node\nvda"
NVDA_REGKEY = ur"SOFTWARE\NVDA"
NVDA_REGKEY = r"SOFTWARE\NVDA"

def getStartOnLogonScreen():
if easeOfAccess.isSupported and easeOfAccess.willAutoStart(winreg.HKEY_LOCAL_MACHINE):
Expand Down
2 changes: 1 addition & 1 deletion source/hwPortUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class dummy(ctypes.Structure):
CR_SUCCESS = 0
MAX_DEVICE_ID_LEN = 200

GUID_CLASS_COMPORT = GUID(0x86e0d1e0L, 0x8089, 0x11d0,
GUID_CLASS_COMPORT = GUID(0x86e0d1e0, 0x8089, 0x11d0,
(ctypes.c_ubyte*8)(0x9c, 0xe4, 0x08, 0x00, 0x3e, 0x30, 0x1f, 0x73))
GUID_DEVINTERFACE_USB_DEVICE = GUID(0xA5DCBF10, 0x6530, 0x11D2,
(0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED))
Expand Down
2 changes: 1 addition & 1 deletion source/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def getStartMenuFolder(noDefault=False):

def getInstallPath(noDefault=False):
try:
k=winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NVDA")
k=winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NVDA")
return winreg.QueryValueEx(k,"UninstallDirectory")[0]
except WindowsError:
return defaultInstallPath if not noDefault else None
Expand Down
3 changes: 2 additions & 1 deletion source/locationHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

"""Classes and helper functions for working with rectangles and coordinates."""

from collections import namedtuple, Sequence
from collections import namedtuple
from collections.abc import Sequence
import windowUtils
import winUser
from ctypes.wintypes import RECT, POINT, DWORD
Expand Down
2 changes: 1 addition & 1 deletion source/logHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def getCodePath(f):
className=cls.__name__
if className:
break
return ".".join([x for x in path,className,funcName if x])
return ".".join(x for x in (path,className,funcName) if x)

# Function to strip the base path of our code from traceback text to improve readability.
BASE_PATH = os.path.split(__file__)[0] + os.sep
Expand Down
4 changes: 2 additions & 2 deletions source/mathPres/mathPlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
# Break.
r"<break time='(?P<break>\d+)ms'/> ?"
# Pronunciation of characters.
ur"|<say-as interpret-as='characters'>(?P<char>[^<])</say-as> ?"
r"|<say-as interpret-as='characters'>(?P<char>[^<])</say-as> ?"
# Specific pronunciation.
ur"|<phoneme alphabet='ipa' ph='(?P<ipa>[^']+)'> (?P<phonemeText>[^ <]+)</phoneme> ?"
r"|<phoneme alphabet='ipa' ph='(?P<ipa>[^']+)'> (?P<phonemeText>[^ <]+)</phoneme> ?"
# Prosody.
r"|<prosody(?: pitch='(?P<pitch>\d+)%')?(?: volume='(?P<volume>\d+)%')?(?: rate='(?P<rate>\d+)%')?> ?"
r"|(?P<prosodyReset></prosody>) ?"
Expand Down
2 changes: 1 addition & 1 deletion source/nvda.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ isSecureDesktop = desktopName == "Winlogon"
if isSecureDesktop:
import winreg
try:
k = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, ur"SOFTWARE\NVDA")
k = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\NVDA")
if not winreg.QueryValueEx(k, u"serviceDebug")[0]:
globalVars.appArgs.secure = True
except WindowsError:
Expand Down
14 changes: 13 additions & 1 deletion source/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,19 @@ def getRecursiveDataFiles(dest,source,excludes=()):
options = {"py2exe": {
"bundle_files": 3,
"excludes": ["tkinter",
"serial.loopback_connection", "serial.rfc2217", "serial.serialcli", "serial.serialjava", "serial.serialposix", "serial.socket_connection"],
"serial.loopback_connection",
"serial.rfc2217",
"serial.serialcli",
"serial.serialjava",
"serial.serialposix",
"serial.socket_connection",
# netbios (from pywin32) is optionally used by Python3's uuid module.
# This is not needed.
"netbios",
# winxptheme is optionally used by wx.lib.agw.aui.
# We don't need this.
"winxptheme",
],
"packages": ["NVDAObjects","virtualBuffers","appModules","comInterfaces","brailleDisplayDrivers","synthDrivers"],
"includes": [
"nvdaBuiltin",
Expand Down
2 changes: 1 addition & 1 deletion source/speech/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,7 @@ def getTableInfoSpeech(tableInfo,oldTableInfo,extraDetail=False):
textList.append(_("row %s")%rowNumber)
return " ".join(textList)

re_last_pause=re.compile(ur"^(.*(?<=[^\s.!?])[.!?][\"'”’)]?(?:\s+|$))(.*$)",re.DOTALL|re.UNICODE)
re_last_pause=re.compile(r"^(.*(?<=[^\s.!?])[.!?][\"'”’)]?(?:\s+|$))(.*$)",re.DOTALL|re.UNICODE)

def speakWithoutPauses(speechSequence,detectBreaks=True):
"""
Expand Down
4 changes: 2 additions & 2 deletions source/virtualBuffers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class VBufStorage_findMatch_word(unicode):

FINDBYATTRIBS_ESCAPE_TABLE = {
# Symbols that are escaped in the attributes string.
ord(u":"): ur"\\:",
ord(u";"): ur"\\;",
ord(u":"): r"\\:",
ord(u";"): r"\\;",
ord(u"\\"): u"\\\\\\\\",
}
# Symbols that must be escaped for a regular expression.
Expand Down
10 changes: 7 additions & 3 deletions source/watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ def execute(self, func, args, kwargs, pumpMessages=True):

exc = self._exc_info
if exc:
raise exc[0], exc[1], exc[2]
# The execution of the function in the other thread caused an exception.
# Re-raise it here.
# Note that in Python3, the traceback (stack) is now part of the exception,
# So the logged traceback will correctly show the stack for both this thread and the other thread.
raise exc
return self._result

def run(self):
Expand All @@ -301,8 +305,8 @@ def run(self):
self._executeEvent.clear()
try:
self._result = self._func(*self._args, **self._kwargs)
except:
self._exc_info = sys.exc_info()
except Exception as e:
self._exc_info = e
ctypes.windll.kernel32.SetEvent(self._executionDoneEvent)
ctypes.windll.kernel32.CloseHandle(self._executionDoneEvent)

Expand Down
8 changes: 4 additions & 4 deletions source/winKernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
DATE_LONGDATE=0x00000002
TIME_NOSECONDS=0x00000002
# Wait return types
WAIT_ABANDONED = 0x00000080L
WAIT_IO_COMPLETION = 0x000000c0L
WAIT_OBJECT_0 = 0x00000000L
WAIT_TIMEOUT = 0x00000102L
WAIT_ABANDONED = 0x00000080
WAIT_IO_COMPLETION = 0x000000c0
WAIT_OBJECT_0 = 0x00000000
WAIT_TIMEOUT = 0x00000102
WAIT_FAILED = 0xffffffff
# Image file machine constants
IMAGE_FILE_MACHINE_UNKNOWN = 0
Expand Down