aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-08-11 12:57:16 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-08-11 13:39:07 -0400
commitde1cc0b02bcb1bab6977f0ab8bb3fef0cd0646dd (patch)
treeaf8e732793a701b8b10d9f0402e58c2a4250e4ec
parenta01418db0a37908cc2504adbb0cf56d333348f9a (diff)
downloadmeson-de1cc0b02bcb1bab6977f0ab8bb3fef0cd0646dd.zip
meson-de1cc0b02bcb1bab6977f0ab8bb3fef0cd0646dd.tar.gz
meson-de1cc0b02bcb1bab6977f0ab8bb3fef0cd0646dd.tar.bz2
rewrite a couple comment-style type annotations for oddly indented dicts
Make them into real type annotations. These are the only ones that if automatically rewritten, would cause flake8 to error out with the message: "E128 continuation line under-indented for visual indent".
-rw-r--r--mesonbuild/mintro.py16
-rw-r--r--mesonbuild/mtest.py18
2 files changed, 20 insertions, 14 deletions
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index 9657da7..14f8d86 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -477,14 +477,18 @@ def list_machines(builddata: build.Build) -> T.Dict[str, T.Dict[str, T.Union[str
return machines
def list_projinfo(builddata: build.Build) -> T.Dict[str, T.Union[str, T.List[T.Dict[str, str]]]]:
- result = {'version': builddata.project_version,
- 'descriptive_name': builddata.project_name,
- 'subproject_dir': builddata.subproject_dir} # type: T.Dict[str, T.Union[str, T.List[T.Dict[str, str]]]]
+ result: T.Dict[str, T.Union[str, T.List[T.Dict[str, str]]]] = {
+ 'version': builddata.project_version,
+ 'descriptive_name': builddata.project_name,
+ 'subproject_dir': builddata.subproject_dir,
+ }
subprojects = []
for k, v in builddata.subprojects.items():
- c = {'name': k,
- 'version': v,
- 'descriptive_name': builddata.projects.get(k)} # type: T.Dict[str, str]
+ c: T.Dict[str, str] = {
+ 'name': k,
+ 'version': v,
+ 'descriptive_name': builddata.projects.get(k),
+ }
subprojects.append(c)
result['subprojects'] = subprojects
return result
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index 2ee337c..36afd61 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -770,14 +770,16 @@ class TextLogfileBuilder(TestFileLogger):
class JsonLogfileBuilder(TestFileLogger):
def log(self, harness: 'TestHarness', result: 'TestRun') -> None:
- jresult = {'name': result.name,
- 'stdout': result.stdo,
- 'result': result.res.value,
- 'starttime': result.starttime,
- 'duration': result.duration,
- 'returncode': result.returncode,
- 'env': result.env,
- 'command': result.cmd} # type: T.Dict[str, T.Any]
+ jresult: T.Dict[str, T.Any] = {
+ 'name': result.name,
+ 'stdout': result.stdo,
+ 'result': result.res.value,
+ 'starttime': result.starttime,
+ 'duration': result.duration,
+ 'returncode': result.returncode,
+ 'env': result.env,
+ 'command': result.cmd,
+ }
if result.stde:
jresult['stderr'] = result.stde
self.file.write(json.dumps(jresult) + '\n')