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".
pull/12112/head
Eli Schwartz 2 years ago
parent a01418db0a
commit de1cc0b02b
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 16
      mesonbuild/mintro.py
  2. 18
      mesonbuild/mtest.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

@ -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')

Loading…
Cancel
Save