Skip to content

Commit eec004e

Browse files
authored
Merge f962841 into e89ccb3
2 parents e89ccb3 + f962841 commit eec004e

497 files changed

Lines changed: 35451 additions & 30970 deletions

File tree

Some content is hidden

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

appveyor/crowdinSync.py

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,12 @@
2020

2121

2222
def request(
23-
path: str,
24-
method=requests.get,
25-
headers: dict[str, str] | None = None,
26-
**kwargs
23+
path: str, method=requests.get, headers: dict[str, str] | None = None, **kwargs
2724
) -> requests.Response:
2825
if headers is None:
2926
headers = {}
3027
headers["Authorization"] = f"Bearer {AUTH_TOKEN}"
31-
r = method(
32-
f"https://api.crowdin.com/api/v2/{path}",
33-
headers=headers,
34-
**kwargs
35-
)
28+
r = method(f"https://api.crowdin.com/api/v2/{path}", headers=headers, **kwargs)
3629
# Convert errors to exceptions, but print the response before raising.
3730
try:
3831
r.raise_for_status()
@@ -50,32 +43,18 @@ def uploadSourceFile(crowdinFileID: int, localFilePath: str) -> None:
5043
fn = os.path.basename(localFilePath)
5144
print(f"Uploading {localFilePath} to Crowdin temporary storage as {fn}")
5245
with open(localFilePath, "rb") as f:
53-
r = request(
54-
"storages",
55-
method=requests.post,
56-
headers={"Crowdin-API-FileName": fn},
57-
data=f
58-
)
46+
r = request("storages", method=requests.post, headers={"Crowdin-API-FileName": fn}, data=f)
5947
storageID = r.json()["data"]["id"]
6048
print(f"Updating file {crowdinFileID} on Crowdin with storage ID {storageID}")
61-
r = projectRequest(
62-
f"files/{crowdinFileID}",
63-
method=requests.put,
64-
json={"storageId": storageID}
65-
)
49+
r = projectRequest(f"files/{crowdinFileID}", method=requests.put, json={"storageId": storageID})
6650
revisionId = r.json()["data"]["revisionId"]
6751
print(f"Updated to revision {revisionId}")
6852

6953

7054
def main():
71-
parser = argparse.ArgumentParser(
72-
description="Syncs translations with Crowdin."
73-
)
55+
parser = argparse.ArgumentParser(description="Syncs translations with Crowdin.")
7456
commands = parser.add_subparsers(dest="command", required=True)
75-
uploadCommand = commands.add_parser(
76-
"uploadSourceFile",
77-
help="Upload a source file to Crowdin."
78-
)
57+
uploadCommand = commands.add_parser("uploadSourceFile", help="Upload a source file to Crowdin.")
7958
uploadCommand.add_argument("crowdinFileID", type=int, help="The Crowdin file ID.")
8059
uploadCommand.add_argument("localFilePath", help="The path to the local file.")
8160
args = parser.parse_args()

appveyor/mozillaSyms.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
NVDA_LIB = os.path.join(NVDA_SOURCE, "lib")
1919
NVDA_LIB64 = os.path.join(NVDA_SOURCE, "lib64")
2020
ZIP_FILE = os.path.join(SCRIPT_DIR, "mozillaSyms.zip")
21-
URL = 'https://symbols.mozilla.org/upload/'
21+
URL = "https://symbols.mozilla.org/upload/"
2222

2323
# The dlls for which symbols are to be uploaded to Mozilla.
2424
# This only needs to include dlls injected into Mozilla products.
@@ -27,56 +27,59 @@
2727
"ISimpleDOM.dll",
2828
"nvdaHelperRemote.dll",
2929
]
30-
DLL_FILES = [f
30+
DLL_FILES = [
31+
f
3132
for dll in DLL_NAMES
3233
# We need both the 32 bit and 64 bit symbols.
33-
for f in (os.path.join(NVDA_LIB, dll), os.path.join(NVDA_LIB64, dll))]
34+
for f in (os.path.join(NVDA_LIB, dll), os.path.join(NVDA_LIB64, dll))
35+
]
36+
3437

3538
class ProcError(Exception):
3639
def __init__(self, returncode, stderr):
3740
self.returncode = returncode
3841
self.stderr = stderr
3942

43+
4044
def check_output(command):
41-
proc = subprocess.Popen(command,
42-
stdout=subprocess.PIPE,
43-
stderr=subprocess.PIPE,
44-
text=True)
45+
proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
4546
stdout, stderr = proc.communicate()
4647
if proc.returncode != 0:
4748
raise ProcError(proc.returncode, stderr)
4849
return stdout
4950

51+
5052
def processFile(path):
51-
print("dump_syms %s"%path)
53+
print("dump_syms %s" % path)
5254
try:
5355
stdout = check_output([DUMP_SYMS, path])
5456
except ProcError as e:
5557
print('Error: running "%s %s": %s' % (DUMP_SYMS, path, e.stderr))
5658
return None, None, None
57-
bits = stdout.splitlines()[0].split(' ', 4)
59+
bits = stdout.splitlines()[0].split(" ", 4)
5860
if len(bits) != 5:
5961
return None, None, None
6062
_, platform, cpu_arch, debug_id, debug_file = bits
6163
# debug_file will have a .pdb extension; e.g. nvdaHelperRemote.dll.pdb.
6264
# The output file format should have a .sym extension instead.
6365
# Strip .pdb and add .sym.
64-
sym_file = debug_file[:-4] + '.sym'
66+
sym_file = debug_file[:-4] + ".sym"
6567
filename = os.path.join(debug_file, debug_id, sym_file)
6668
debug_filename = os.path.join(debug_file, debug_id, debug_file)
6769
return filename, stdout, debug_filename
6870

71+
6972
def generate():
7073
count = 0
71-
with zipfile.ZipFile(ZIP_FILE, 'w', zipfile.ZIP_DEFLATED) as zf:
74+
with zipfile.ZipFile(ZIP_FILE, "w", zipfile.ZIP_DEFLATED) as zf:
7275
for f in DLL_FILES:
7376
filename, contents, debug_filename = processFile(f)
7477
if not (filename and contents):
75-
print('Error dumping symbols')
78+
print("Error dumping symbols")
7679
raise RuntimeError
7780
zf.writestr(filename, contents)
7881
count += 1
79-
print('Added %d files to %s' % (count, ZIP_FILE))
82+
print("Added %d files to %s" % (count, ZIP_FILE))
8083

8184

8285
def upload():
@@ -85,37 +88,36 @@ def upload():
8588
if i > 0:
8689
print("Sleeping for 15 seconds before next attempt.")
8790
import time
91+
8892
time.sleep(15)
8993
try:
9094
r = requests.post(
9195
URL,
92-
files={'symbols.zip': open(ZIP_FILE, 'rb')},
93-
headers={'Auth-Token': os.getenv('mozillaSymsAuthToken')},
94-
allow_redirects=False
96+
files={"symbols.zip": open(ZIP_FILE, "rb")},
97+
headers={"Auth-Token": os.getenv("mozillaSymsAuthToken")},
98+
allow_redirects=False,
9599
)
96100
break # success
97101
except Exception as e:
98102
print(f"Attempt {i + 1} failed: {e!r}")
99103
errors.append(repr(e))
100104
else: # no break in for loop
101-
allErrors = "\n".join(
102-
f"Attempt {index + 1} error: \n{e}"
103-
for index, e in enumerate(errors)
104-
)
105+
allErrors = "\n".join(f"Attempt {index + 1} error: \n{e}" for index, e in enumerate(errors))
105106
raise RuntimeError(allErrors)
106107

107108
if 200 <= r.status_code < 300:
108-
print('Uploaded successfully!')
109+
print("Uploaded successfully!")
109110
elif r.status_code < 400:
110-
print('Error: bad auth token? (%d)' % r.status_code)
111+
print("Error: bad auth token? (%d)" % r.status_code)
111112
raise RuntimeError
112113
else:
113-
print('Error: %d' % r.status_code)
114+
print("Error: %d" % r.status_code)
114115
print(r.text)
115116
raise RuntimeError
116117
return 0
117118

118-
if __name__ == '__main__':
119+
120+
if __name__ == "__main__":
119121
try:
120122
generate()
121123
upload()

extras/controllerClient/examples/example_python.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ def onMarkReached(name: str) -> int:
3131

3232

3333
ssml = (
34-
'<speak>'
35-
'This is one sentence. '
34+
"<speak>"
35+
"This is one sentence. "
3636
'<mark name="test" />'
3737
'<prosody pitch="200%">This sentence is pronounced with higher pitch.</prosody>'
3838
'<mark name="test2" />'
39-
'This is a third sentence. '
39+
"This is a third sentence. "
4040
'<mark name="test3" />'
41-
'This is a fourth sentence. We will stay silent for a second after this one.'
41+
"This is a fourth sentence. We will stay silent for a second after this one."
4242
'<break time="1000ms" />'
4343
'<mark name="test4" />'
44-
'This is a fifth sentence. '
44+
"This is a fifth sentence. "
4545
'<mark name="test5" />'
46-
'</speak>'
46+
"</speak>"
4747
)
4848
clientLib.nvdaController_setOnSsmlMarkReachedCallback(onMarkReached)
4949
clientLib.nvdaController_speakSsml(ssml, -1, 0, False)

projectDocs/dev/developerGuide/conf.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import os
1111
import sys
12+
1213
_appDir = os.path.abspath(os.path.join("..", "..", "..", "source"))
1314

1415
sys.path.insert(0, _appDir)
@@ -23,11 +24,13 @@
2324
# by comTypes.
2425
# This patch causes the error to be ignored, which matches the behavior at runtime.
2526
import monkeyPatches.comtypesMonkeyPatches # noqa: E402
27+
2628
monkeyPatches.comtypesMonkeyPatches.replace_check_version()
2729
monkeyPatches.comtypesMonkeyPatches.appendComInterfacesToGenSearchPath()
2830

2931
# Initialize languageHandler so that sphinx is able to deal with translatable strings.
3032
import languageHandler # noqa: E402
33+
3134
languageHandler.setLanguage("en")
3235

3336
# Initialize globalVars.appArgs to something sensible.
@@ -47,6 +50,7 @@
4750

4851
# Import NVDA's versionInfo module.
4952
import versionInfo # noqa: E402
53+
5054
# Set a suitable updateVersionType for the updateCheck module to be imported
5155
versionInfo.updateVersionType = "stable"
5256

@@ -58,34 +62,30 @@
5862

5963
# The major project version
6064
version = versionInfo.formatVersionForGUI(
61-
versionInfo.version_year,
62-
versionInfo.version_major,
63-
versionInfo.version_minor
65+
versionInfo.version_year, versionInfo.version_major, versionInfo.version_minor
6466
)
6567

6668
# The full version, including alpha/beta/rc tags
6769
release = versionInfo.version
6870

6971
# -- General configuration ---------------------------------------------------
7072

71-
default_role = 'py:obj'
73+
default_role = "py:obj"
7274

7375
# Add any Sphinx extension module names here, as strings. They can be
7476
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
7577
# ones.
7678
extensions = [
77-
'sphinx.ext.autodoc',
79+
"sphinx.ext.autodoc",
7880
]
7981

8082
# Add any paths that contain templates here, relative to this directory.
81-
templates_path = ['_templates']
83+
templates_path = ["_templates"]
8284

8385
# List of patterns, relative to source directory, that match files and
8486
# directories to ignore when looking for source files.
8587
# This pattern also affects html_static_path and html_extra_path.
86-
exclude_patterns = [
87-
"_build"
88-
]
88+
exclude_patterns = ["_build"]
8989

9090

9191
# -- Options for HTML output -------------------------------------------------
@@ -100,7 +100,7 @@
100100

101101
# Both the class’ and the __init__ method’s docstring are concatenated and inserted.
102102
autoclass_content = "both"
103-
autodoc_member_order = 'bysource'
103+
autodoc_member_order = "bysource"
104104
autodoc_mock_imports = [
105105
"louis", # Not our project
106106
]
@@ -110,5 +110,6 @@
110110
from sphinx.ext.autodoc.mock import _make_subclass # noqa: E402
111111

112112
import config # noqa: E402
113+
113114
# Mock an instance of the configuration manager.
114115
config.conf = _make_subclass("conf", "config")()

0 commit comments

Comments
 (0)