Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 0 additions & 4 deletions .github/actionlint.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ repos:
)
)

- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
- repo: https://github.com/kjanat/actionlint
rev: v1.12.0
hooks:
# Lint GitHub Actions workflow files.
- id: actionlint
Expand All @@ -114,7 +114,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Matches Ruff version in pyproject.
rev: v0.15.9
rev: v0.16.3
hooks:
- id: ruff
name: lint with ruff
Expand All @@ -134,7 +134,7 @@ repos:
args: ["-p3.13"]

- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.22.0
rev: v0.23.2
hooks:
- id: markdownlint-cli2
name: Lint markdown files
Expand All @@ -143,7 +143,7 @@ repos:

- repo: https://github.com/astral-sh/ty-pre-commit
# Matches ty version in pyproject.
rev: v0.0.60
rev: v0.0.73
hooks:
- id: ty
name: type check with ty
Expand Down
6 changes: 3 additions & 3 deletions appx/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file may be used under the terms of the GNU General Public License, version 2 or later, as modified by the NVDA license.
# For full terms and any additional permissions, see the NVDA license file: https://github.com/nvaccess/nvda/blob/master/copying.txt

import subprocess
import subprocess # noqa: I001
import buildVersion
import versionInfo
import os
Expand Down Expand Up @@ -41,7 +41,7 @@ def getCertPublisher(env):


packageName = "NVAccessLimited.NVDANonVisualDesktopAccess"
packageVersion = "%s.%s.%s.%s" % (
packageVersion = "%s.%s.%s.%s" % ( # noqa: UP031
buildVersion.version_year,
buildVersion.version_major,
env["version_build"],
Expand Down Expand Up @@ -99,7 +99,7 @@ appxContent = env.Command(
Copy("${TARGET}\\appx_images", "${SOURCES[1]}"),
Copy("${TARGET}\\AppxManifest.xml", "${SOURCES[2]}"),
]
+ [Delete("${TARGET}/%s" % excludeFile) for excludeFile in excludedDistFiles],
+ [Delete("${TARGET}/%s" % excludeFile) for excludeFile in excludedDistFiles], # noqa: UP031
)
# Ensure that it is always copied as we can't tell if dist changed
env.AlwaysBuild(appxContent)
Expand Down
2 changes: 1 addition & 1 deletion ci/scripts/crowdinSync.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html


import argparse
import argparse # noqa: I001
import os

import requests
Expand Down
20 changes: 10 additions & 10 deletions ci/scripts/mozillaSyms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
To update the list of symbols uploaded to Mozilla, see the DLL_NAMES constant below.
"""

import os
import os # noqa: I001
import subprocess
import sys
import zipfile
Expand Down Expand Up @@ -55,16 +55,16 @@ def check_output(command):


def processFile(path):
print("dump_syms %s" % path)
print("dump_syms %s" % path) # noqa: UP031
try:
stdout = check_output([DUMP_SYMS, path])
except ProcError as e:
print('Error: running "%s %s": %s' % (DUMP_SYMS, path, e.stderr))
print('Error: running "%s %s": %s' % (DUMP_SYMS, path, e.stderr)) # noqa: UP031
return None, None, None
bits = stdout.splitlines()[0].split(" ", 4)
if len(bits) != 5:
return None, None, None
_, platform, cpu_arch, debug_id, debug_file = bits
_, platform, cpu_arch, debug_id, debug_file = bits # noqa: RUF059
# debug_file will have a .pdb extension; e.g. nvdaHelperRemote.dll.pdb.
# The output file format should have a .sym extension instead.
# Strip .pdb and add .sym.
Expand All @@ -78,13 +78,13 @@ def generate():
count = 0
with zipfile.ZipFile(ZIP_FILE, "w", zipfile.ZIP_DEFLATED) as zf:
for f in DLL_FILES:
filename, contents, debug_filename = processFile(f)
filename, contents, debug_filename = processFile(f) # noqa: RUF059
if not (filename and contents):
print("Error dumping symbols")
raise RuntimeError
zf.writestr(filename, contents)
count += 1
print("Added %d files to %s" % (count, ZIP_FILE))
print("Added %d files to %s" % (count, ZIP_FILE)) # noqa: UP031


def upload():
Expand All @@ -98,12 +98,12 @@ def upload():
try:
r = requests.post(
URL,
files={"symbols.zip": open(ZIP_FILE, "rb")},
files={"symbols.zip": open(ZIP_FILE, "rb")}, # noqa: SIM115
headers={"Auth-Token": os.getenv("mozillaSymsAuthToken")},
allow_redirects=False,
)
break # success
except Exception as e:
except Exception as e: # noqa: BLE001
print(f"Attempt {i + 1} failed: {e!r}")
errors.append(repr(e))
else: # no break in for loop
Expand All @@ -113,10 +113,10 @@ def upload():
if 200 <= r.status_code < 300:
print("Uploaded successfully!")
elif r.status_code < 400:
print("Error: bad auth token? (%d)" % r.status_code)
print("Error: bad auth token? (%d)" % r.status_code) # noqa: UP031
raise RuntimeError
else:
print("Error: %d" % r.status_code)
print("Error: %d" % r.status_code) # noqa: UP031
print(r.text)
raise RuntimeError
return 0
Expand Down
4 changes: 2 additions & 2 deletions cldrDict_sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import typing
if typing.TYPE_CHECKING:
import SCons
from SCons import (
Dir,
Import,
Dir, # noqa: TC004
Import, # noqa: TC004
)

sourceDir: "SCons.Node.FS.Dir"
Expand Down
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}" % (
"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))),
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
4 changes: 2 additions & 2 deletions nvdaHelper/cppjieba/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This file may be used under the terms of the GNU General Public License, version 2 or later, as modified by the NVDA license.
# For full terms and any additional permissions, see the NVDA license file: https://github.com/nvaccess/nvda/blob/master/copying.txt

import typing # noqa: E402
import typing

Import(
[
Expand All @@ -12,7 +12,7 @@ Import(
"sourceDir",
]
)
thirdPartyEnv: Environment = thirdPartyEnv
thirdPartyEnv: Environment = thirdPartyEnv # noqa: PLW0127
env: Environment = typing.cast(Environment, thirdPartyEnv.Clone())

cppjiebaPath = Dir("#include/cppjieba")
Expand Down
4 changes: 2 additions & 2 deletions nvdaHelper/detours/sconscript
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
Import(["thirdPartyEnv"])

import typing # noqa: E402
import typing

thirdPartyEnv: Environment = thirdPartyEnv
thirdPartyEnv: Environment = thirdPartyEnv # noqa: PLW0127
env: Environment = typing.cast(Environment, thirdPartyEnv.Clone())

detoursPath = Dir("#include/detours")
Expand Down
8 changes: 4 additions & 4 deletions nvdaHelper/espeak/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See the file COPYING for more details.
# Copyright (C) 2011-2026 NV Access Limited

import ctypes.wintypes
import ctypes.wintypes # noqa: I001
import enum
import os
import ctypes
Expand Down Expand Up @@ -1006,7 +1006,7 @@ def espeak_compileDict_buildAction(
exit status to indicate an unsuccessful build."
"""
if len(target) != 1:
targetStrings = list((str(t) for t in target))
targetStrings = list(str(t) for t in target) # noqa: C400
raise ValueError(f"Unexpected number of targets: {targetStrings}")
target = target[0]

Expand Down Expand Up @@ -1136,7 +1136,7 @@ phonemeData = env.espeak_compilePhonemeData(espeakRepo.Dir("espeak-ng-data"), es
env.Depends(phonemeData, espeakLib)
for i in phonemeData:
iDir = espeakRepo.Dir("espeak-ng-data").abspath
l = len(iDir) + 1 # noqa: E741
l = len(iDir) + 1
fileName = i.abspath[l:]
env.InstallAs(os.path.join(synthDriversDir.Dir("espeak-ng-data").abspath, fileName), i)

Expand Down Expand Up @@ -1167,7 +1167,7 @@ for dictFileName, (langCode, inputFiles) in espeakDictionaryCompileList.items():

dictFile = env.Command(
target=dictFilePath,
source=list((dictSourcePath.File(f) for f in inputFiles)),
source=list(dictSourcePath.File(f) for f in inputFiles), # noqa: C400
action=espeak_compileDict_buildAction,
)

Expand Down
9 changes: 4 additions & 5 deletions nvdaHelper/ia2_sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,20 @@ import re
Import("env")

# We want a single merged IDL, rather than the separate IDL files in the IA2 source.
RE_IDL_IMPORT = re.compile(r'import "[A-Z].*$', re.M)
RE_IDL_IMPORT = re.compile(r'import "[A-Z].*$', re.MULTILINE)


def buildMergedIdl(target, source, env):
outFile = open(str(target[0]), "w")
outFile = open(str(target[0]), "w") # noqa: SIM115
# The first source is a header and should be included unmodified.
inFile = open(str(source[0]), "r")
inFile = open(str(source[0]), "r") # noqa: SIM115
outFile.write(inFile.read())
Comment thread
seanbudd marked this conversation as resolved.
outFile.write("\n")
for idl in source[1:]:
# This source should be included with import statements removed.
inFile = open(str(idl), "r")
inFile = open(str(idl), "r") # noqa: SIM115
outFile.write(RE_IDL_IMPORT.sub("", inFile.read()))
outFile.write("\n")
return None


idlDir = env.Dir("#include/ia2/api")
Expand Down
10 changes: 5 additions & 5 deletions nvdaHelper/liblouis/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file may be used under the terms of the GNU General Public License, version 2 or later, as modified by the NVDA license.
# For full terms and any additional permissions, see the NVDA license file: https://github.com/nvaccess/nvda/blob/master/copying.txt

import os
import os # noqa: I001
import re
import typing
from SCons.Environment import Environment
Expand All @@ -16,8 +16,8 @@ Import(
"sourceDir",
],
)
sourceDir: Base = sourceDir
thirdPartyEnv: Environment = thirdPartyEnv
sourceDir: Base = sourceDir # noqa: PLW0127
thirdPartyEnv: Environment = thirdPartyEnv # noqa: PLW0127
env: Environment = typing.cast(Environment, thirdPartyEnv.Clone())

louisRootDir = env.Dir("#include/liblouis")
Expand Down Expand Up @@ -69,7 +69,7 @@ env.Append(
# reserved ISO C names (like strdup) in favour of non-portable conforming
# variants that start with an '_'. This removes those deprecation warnings. */
"_CRT_NONSTDC_NO_DEPRECATE",
("PACKAGE_VERSION", r"\"%s\"" % getLouisVersion()),
("PACKAGE_VERSION", r"\"%s\"" % getLouisVersion()), # noqa: UP031
"WIDECHARS_ARE_UCS4",
# Tell liblouis.h that we're exporting liblouis dll functions, not importing them.
"_EXPORTING",
Expand All @@ -96,7 +96,7 @@ sourceFiles = [
"metadata.c",
"utils.c",
]
objs = [env.Object("%s.obj" % f, louisSourceDir.File(f)) for f in sourceFiles]
objs = [env.Object("%s.obj" % f, louisSourceDir.File(f)) for f in sourceFiles] # noqa: UP031
louisLib = env.SharedLibrary("liblouis", objs)
if signExec:
env.AddPostAction(louisLib[0], [signExec])
Expand Down
4 changes: 2 additions & 2 deletions nvdaHelper/localWin10/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Import(


# Ignoring Flake8 F821: 'undefined name' due to nonstandard SCons import
env = env.Clone() # noqa: F821
env = env.Clone()

localWin10Lib = env.SharedLibrary(
target="nvdaHelperLocalWin10",
Expand All @@ -38,7 +38,7 @@ localWin10Lib = env.SharedLibrary(
"WindowsApp",
# Ignoring Flake8 F821: 'undefined name' due to nonstandard SCons import
localLib[2],
], # noqa: F821
],
)

Return(["localWin10Lib"])
14 changes: 7 additions & 7 deletions projectDocs/dev/developerGuide/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
# used for developer documentation build, "ImportError: Typelib different than module" is raised
# by comTypes.
# This patch causes the error to be ignored, which matches the behavior at runtime.
import monkeyPatches.comtypesMonkeyPatches # noqa: E402
import monkeyPatches.comtypesMonkeyPatches

monkeyPatches.comtypesMonkeyPatches.replace_check_version()
monkeyPatches.comtypesMonkeyPatches.appendComInterfacesToGenSearchPath()

# Initialize languageHandler so that sphinx is able to deal with translatable strings.
import languageHandler # noqa: E402
import languageHandler

languageHandler.setLanguage("en")

# Initialize globalVars.appArgs to something sensible.
import globalVars # noqa: E402
import globalVars # noqa: I001


# Set an empty config path
Expand All @@ -44,8 +44,8 @@


# Import NVDA's versionInfo module.
import buildVersion # noqa: E402
import versionInfo # noqa: E402
import buildVersion
import versionInfo

# Set a suitable updateVersionType for the updateCheck module to be imported
buildVersion.updateVersionType = "stable"
Expand Down Expand Up @@ -107,9 +107,9 @@

# Perform some manual mocking of specific objects.
# autodoc can only mock modules, not objects.
from sphinx.ext.autodoc._dynamic._mock import _make_subclass # noqa: E402
from sphinx.ext.autodoc._dynamic._mock import _make_subclass # noqa: I001

import config # noqa: E402
import config

# Mock an instance of the configuration manager.
config.conf = _make_subclass("conf", "config")()
Loading
Loading