diff options
author | Mats Wichmann <mats@linux.com> | 2023-05-01 11:54:48 -0600 |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2023-05-01 12:06:45 -0600 |
commit | 1a103470a13a83590b3fc06e8779494e2b99751d (patch) | |
tree | ab4b5fcdbc2504ff1436387dbe82db2dcedff22b /SCons/Scanner/PythonTests.py | |
parent | 0ef81fc03600cd275a8e6733aeca26e0db268dad (diff) | |
download | scons-git-1a103470a13a83590b3fc06e8779494e2b99751d.tar.gz |
Add some cheap return and parameter annotations
Use: https://github.com/JelleZijlstra/autotyping
to add "safe" return annotations.
Where a parameter has a default value that is an obvious scalar type
(bool, int, str, etc.) add those annotations as well.
Also fixed two small bugs that popped up when sanity-checking with
mypy. One in FortranCommon, where a return had been previously
annotated to be a tuple of Action, which should be ActionBase -
Action is the factory function, not the base class. The other was
a typo in the error raised in _add_cppdefines - the message was
formatted with the value of "define" which should have been "defines".
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'SCons/Scanner/PythonTests.py')
-rw-r--r-- | SCons/Scanner/PythonTests.py | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/SCons/Scanner/PythonTests.py b/SCons/Scanner/PythonTests.py index 1a4f5b430..03e4e1031 100644 --- a/SCons/Scanner/PythonTests.py +++ b/SCons/Scanner/PythonTests.py @@ -56,7 +56,7 @@ else: my_normpath = os.path.normpath -def deps_match(self, deps, headers): +def deps_match(self, deps, headers) -> None: global my_normpath scanned = list(map(my_normpath, list(map(str, deps)))) expect = list(map(my_normpath, headers)) @@ -66,7 +66,7 @@ def deps_match(self, deps, headers): # Copied from LaTeXTests.py. class DummyEnvironment(collections.UserDict): - def __init__(self, **kwargs): + def __init__(self, **kwargs) -> None: super().__init__() self.data.update(kwargs) self.fs = SCons.Node.FS.FS(test.workpath('')) @@ -104,7 +104,7 @@ class DummyEnvironment(collections.UserDict): class PythonScannerTestPythonPath(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner env['ENV']['PYTHONPATH'] = test.workpath('') @@ -115,7 +115,7 @@ class PythonScannerTestPythonPath(unittest.TestCase): class PythonScannerTestPythonCallablePath(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner env['ENV']['PYTHONPATH'] = test.workpath('') @@ -126,7 +126,7 @@ class PythonScannerTestPythonCallablePath(unittest.TestCase): class PythonScannerTestImportSimplePackage(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File('imports_simple_package.py') @@ -141,7 +141,7 @@ class PythonScannerTestImportSimplePackage(unittest.TestCase): class PythonScannerTestImportSimplePackageModule1As(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File('import_simple_package_module1_as.py') @@ -152,7 +152,7 @@ class PythonScannerTestImportSimplePackageModule1As(unittest.TestCase): class PythonScannerTestImportSimplePackageModuleAs(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File('import_simple_package_module1.py') @@ -163,7 +163,7 @@ class PythonScannerTestImportSimplePackageModuleAs(unittest.TestCase): class PythonScannerTestFromImportSimplePackageModule1(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File('from_import_simple_package_module1.py') @@ -174,7 +174,7 @@ class PythonScannerTestFromImportSimplePackageModule1(unittest.TestCase): class PythonScannerTestFromImportSimplePackageModule1As(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File('from_import_simple_package_module1_as.py') @@ -186,7 +186,7 @@ class PythonScannerTestFromImportSimplePackageModule1As(unittest.TestCase): class PythonScannerTestFromImportSimplePackageModulesNoSpace( unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File('from_import_simple_package_modules_no_space.py') @@ -199,7 +199,7 @@ class PythonScannerTestFromImportSimplePackageModulesNoSpace( class PythonScannerTestFromImportSimplePackageModulesWithSpace( unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File('from_import_simple_package_modules_with_space.py') @@ -211,7 +211,7 @@ class PythonScannerTestFromImportSimplePackageModulesWithSpace( class PythonScannerTestCurdirReferenceScript(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.Dir('curdir_reference').File('script.py') @@ -222,7 +222,7 @@ class PythonScannerTestCurdirReferenceScript(unittest.TestCase): class PythonScannerTestImportsNested3(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File('imports_nested3.py') @@ -234,7 +234,7 @@ class PythonScannerTestImportsNested3(unittest.TestCase): class PythonScannerTestImportsGrandparentModule(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File( @@ -246,7 +246,7 @@ class PythonScannerTestImportsGrandparentModule(unittest.TestCase): class PythonScannerTestImportsParentModule(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File( @@ -258,7 +258,7 @@ class PythonScannerTestImportsParentModule(unittest.TestCase): class PythonScannerTestImportsParentThenSubmodule(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: env = DummyEnvironment() s = SCons.Scanner.Python.PythonScanner node = env.File( @@ -270,7 +270,7 @@ class PythonScannerTestImportsParentThenSubmodule(unittest.TestCase): class PythonScannerTestImportsModuleWithFunc(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: """ This test case tests the following import statement: `from simple_package.module1 import somefunc` with somefunc.py existing @@ -287,7 +287,7 @@ class PythonScannerTestImportsModuleWithFunc(unittest.TestCase): class PythonScannerTestFromNested1ImportNested2(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: """ This test case tests the following import statement: `from nested1 import module, nested2`. In this test, module is a Python @@ -305,7 +305,7 @@ class PythonScannerTestFromNested1ImportNested2(unittest.TestCase): class PythonScannerTestImportUnknownFiles(unittest.TestCase): - def runTest(self): + def runTest(self) -> None: """ This test case tests importing files that are not found. If Python really can't find those files, it will fail. But this is intended to |