summaryrefslogtreecommitdiff
path: root/mesonbuild/mcompile.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-08-10 21:19:29 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-08-11 13:41:03 -0400
commit90ce0841441506e3f409ab59ded1df8f2e6e7363 (patch)
tree3478769eef2620e9d7b5a41b73dd94c75b003465 /mesonbuild/mcompile.py
parentde1cc0b02bcb1bab6977f0ab8bb3fef0cd0646dd (diff)
downloadmeson-90ce0841441506e3f409ab59ded1df8f2e6e7363.tar.gz
treewide: automatic rewriting of all comment-style type annotations
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
Diffstat (limited to 'mesonbuild/mcompile.py')
-rw-r--r--mesonbuild/mcompile.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py
index 7ae7175e8..c36c65bdb 100644
--- a/mesonbuild/mcompile.py
+++ b/mesonbuild/mcompile.py
@@ -54,7 +54,7 @@ def parse_introspect_data(builddir: Path) -> T.Dict[str, T.List[dict]]:
with path_to_intro.open(encoding='utf-8') as f:
schema = json.load(f)
- parsed_data = defaultdict(list) # type: T.Dict[str, T.List[dict]]
+ parsed_data: T.Dict[str, T.List[dict]] = defaultdict(list)
for target in schema:
parsed_data[target['name']] += [target]
return parsed_data
@@ -100,7 +100,7 @@ def get_target_from_intro_data(target: ParsedTargetName, builddir: Path, introsp
raise MesonException(f'Can\'t invoke target `{target.full_name}`: target not found')
intro_targets = introspect_data[target.name]
- found_targets = [] # type: T.List[T.Dict[str, T.Any]]
+ found_targets: T.List[T.Dict[str, T.Any]] = []
resolved_bdir = builddir.resolve()
@@ -337,8 +337,8 @@ def run(options: 'argparse.Namespace') -> int:
if setup_vsenv(need_vsenv):
mlog.log(mlog.green('INFO:'), 'automatically activated MSVC compiler environment')
- cmd = [] # type: T.List[str]
- env = None # type: T.Optional[T.Dict[str, str]]
+ cmd: T.List[str] = []
+ env: T.Optional[T.Dict[str, str]] = None
backend = cdata.get_option(mesonlib.OptionKey('backend'))
assert isinstance(backend, str)