summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2023-08-14 17:51:51 -0500
committerEli Schwartz <eschwartz93@gmail.com>2023-10-04 15:23:00 -0400
commit1991ad87061d068413cb6a593f3f29c9426df2b9 (patch)
treef84cc2915a28508b886f5b1408d9449efed31a30
parent88b337b77c264d3f39744b3b3bea8a29778a73c4 (diff)
downloadmeson-1991ad87061d068413cb6a593f3f29c9426df2b9.tar.gz
Remove type comments in run_project_tests.py
-rw-r--r--mesonbuild/cmake/common.py2
-rwxr-xr-xrun_project_tests.py24
-rwxr-xr-xtools/cmake2meson.py4
-rw-r--r--unittests/internaltests.py2
4 files changed, 16 insertions, 16 deletions
diff --git a/mesonbuild/cmake/common.py b/mesonbuild/cmake/common.py
index 415937ee9..aa0bbbf0b 100644
--- a/mesonbuild/cmake/common.py
+++ b/mesonbuild/cmake/common.py
@@ -209,7 +209,7 @@ class CMakeTarget:
self.link_lang_flags = _flags_to_list(data.get('linkLanguageFlags', ''))
# self.link_path = Path(data.get('linkPath', ''))
self.type: str = data.get('type', 'EXECUTABLE')
- # self.is_generator_provided = data.get('isGeneratorProvided', False) # type: bool
+ # self.is_generator_provided: bool = data.get('isGeneratorProvided', False)
self.files: T.List[CMakeFileGroup] = []
for i in data.get('fileGroups', []):
diff --git a/run_project_tests.py b/run_project_tests.py
index 7413c6843..7ff164086 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -134,11 +134,11 @@ class InstalledFile:
self.path = raw['file']
self.typ = raw['type']
self.platform = raw.get('platform', None)
- self.language = raw.get('language', 'c') # type: str
+ self.language = raw.get('language', 'c')
- version = raw.get('version', '') # type: str
+ version = raw.get('version', '')
if version:
- self.version = version.split('.') # type: T.List[str]
+ self.version = version.split('.')
else:
# split on '' will return [''], we want an empty list though
self.version = []
@@ -280,9 +280,9 @@ class TestDef:
self.args = args
self.skip = skip
self.env = os.environ.copy()
- self.installed_files = [] # type: T.List[InstalledFile]
- self.do_not_set_opts = [] # type: T.List[str]
- self.stdout = [] # type: T.List[T.Dict[str, str]]
+ self.installed_files: T.List[InstalledFile] = []
+ self.do_not_set_opts: T.List[str] = []
+ self.stdout: T.List[T.Dict[str, str]] = []
self.skip_category = skip_category
self.skip_expected = False
@@ -399,7 +399,7 @@ def platform_fix_name(fname: str, canonical_compiler: str, env: environment.Envi
def validate_install(test: TestDef, installdir: Path, env: environment.Environment) -> str:
ret_msg = ''
- expected_raw = [] # type: T.List[Path]
+ expected_raw: T.List[Path] = []
for i in test.installed_files:
try:
expected_raw += i.get_paths(host_c_compiler, env, installdir)
@@ -828,7 +828,7 @@ def load_test_json(t: TestDef, stdout_mandatory: bool, skip_category: bool = Fal
test_def = json.loads(test_def_file.read_text(encoding='utf-8'))
# Handle additional environment variables
- env = {} # type: T.Dict[str, str]
+ env: T.Dict[str, str] = {}
if 'env' in test_def:
assert isinstance(test_def['env'], dict)
env = test_def['env']
@@ -838,7 +838,7 @@ def load_test_json(t: TestDef, stdout_mandatory: bool, skip_category: bool = Fal
env[key] = val
# Handle installed files
- installed = [] # type: T.List[InstalledFile]
+ installed: T.List[InstalledFile] = []
if 'installed' in test_def:
installed = [InstalledFile(x) for x in test_def['installed']]
@@ -848,7 +848,7 @@ def load_test_json(t: TestDef, stdout_mandatory: bool, skip_category: bool = Fal
raise RuntimeError(f"{test_def_file} must contain a non-empty stdout key")
# Handle the do_not_set_opts list
- do_not_set_opts = test_def.get('do_not_set_opts', []) # type: T.List[str]
+ do_not_set_opts: T.List[str] = test_def.get('do_not_set_opts', [])
(t.skip, t.skip_expected) = _skip_keys(test_def)
@@ -872,12 +872,12 @@ def load_test_json(t: TestDef, stdout_mandatory: bool, skip_category: bool = Fal
new_opt_list: T.List[T.List[T.Tuple[str, str, bool, bool]]]
# 'matrix; entry is present, so build multiple tests from matrix definition
- opt_list = [] # type: T.List[T.List[T.Tuple[str, str, bool, bool]]]
+ opt_list: T.List[T.List[T.Tuple[str, str, bool, bool]]] = []
matrix = test_def['matrix']
assert "options" in matrix
for key, val in matrix["options"].items():
assert isinstance(val, list)
- tmp_opts = [] # type: T.List[T.Tuple[str, str, bool, bool]]
+ tmp_opts: T.List[T.Tuple[str, str, bool, bool]] = []
for i in val:
assert isinstance(i, dict)
assert "val" in i
diff --git a/tools/cmake2meson.py b/tools/cmake2meson.py
index a12d9cf1f..7889cd825 100755
--- a/tools/cmake2meson.py
+++ b/tools/cmake2meson.py
@@ -119,7 +119,7 @@ class Parser:
return Statement(cur.value, args)
def arguments(self) -> T.List[T.Union[Token, T.Any]]:
- args = [] # type: T.List[T.Union[Token, T.Any]]
+ args: T.List[T.Union[Token, T.Any]] = []
if self.accept('lparen'):
args.append(self.arguments())
self.expect('rparen')
@@ -159,7 +159,7 @@ class Converter:
self.cmake_root = Path(cmake_root).expanduser()
self.indent_unit = ' '
self.indent_level = 0
- self.options = [] # type: T.List[tuple]
+ self.options: T.List[T.Tuple[str, str, T.Optional[str]]] = []
def convert_args(self, args: T.List[Token], as_array: bool = True) -> str:
res = []
diff --git a/unittests/internaltests.py b/unittests/internaltests.py
index eb3b1717a..1c55b2976 100644
--- a/unittests/internaltests.py
+++ b/unittests/internaltests.py
@@ -1020,7 +1020,7 @@ class InternalTests(unittest.TestCase):
schema = json.loads(Path('data/test.schema.json').read_text(encoding='utf-8'))
- errors = [] # type: T.Tuple[str, Exception]
+ errors: T.List[T.Tuple[Path, Exception]] = []
for p in Path('test cases').glob('**/test.json'):
try:
validate(json.loads(p.read_text(encoding='utf-8')), schema=schema)