diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-08-10 21:19:29 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-08-11 13:41:03 -0400 |
commit | 90ce0841441506e3f409ab59ded1df8f2e6e7363 (patch) | |
tree | 3478769eef2620e9d7b5a41b73dd94c75b003465 /mesonbuild/wrap | |
parent | de1cc0b02bcb1bab6977f0ab8bb3fef0cd0646dd (diff) | |
download | meson-90ce0841441506e3f409ab59ded1df8f2e6e7363.zip meson-90ce0841441506e3f409ab59ded1df8f2e6e7363.tar.gz meson-90ce0841441506e3f409ab59ded1df8f2e6e7363.tar.bz2 |
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/wrap')
-rw-r--r-- | mesonbuild/wrap/wrap.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 2b0a0ba..c0dd01c 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -145,11 +145,11 @@ class PackageDefinition: def __init__(self, fname: str, subproject: str = ''): self.filename = fname self.subproject = SubProject(subproject) - self.type = None # type: T.Optional[str] - self.values = {} # type: T.Dict[str, str] - self.provided_deps = {} # type: T.Dict[str, T.Optional[str]] - self.provided_programs = [] # type: T.List[str] - self.diff_files = [] # type: T.List[Path] + self.type: T.Optional[str] = None + self.values: T.Dict[str, str] = {} + self.provided_deps: T.Dict[str, T.Optional[str]] = {} + self.provided_programs: T.List[str] = [] + self.diff_files: T.List[Path] = [] self.basename = os.path.basename(fname) self.has_wrap = self.basename.endswith('.wrap') self.name = self.basename[:-5] if self.has_wrap else self.basename @@ -290,10 +290,10 @@ class Resolver: def __post_init__(self) -> None: self.subdir_root = os.path.join(self.source_dir, self.subdir) self.cachedir = os.path.join(self.subdir_root, 'packagecache') - self.wraps = {} # type: T.Dict[str, PackageDefinition] + self.wraps: T.Dict[str, PackageDefinition] = {} self.netrc: T.Optional[netrc] = None - self.provided_deps = {} # type: T.Dict[str, PackageDefinition] - self.provided_programs = {} # type: T.Dict[str, PackageDefinition] + self.provided_deps: T.Dict[str, PackageDefinition] = {} + self.provided_programs: T.Dict[str, PackageDefinition] = {} self.wrapdb: T.Dict[str, T.Any] = {} self.wrapdb_provided_deps: T.Dict[str, str] = {} self.wrapdb_provided_programs: T.Dict[str, str] = {} @@ -555,7 +555,7 @@ class Resolver: revno = self.wrap.get('revision') checkout_cmd = ['-c', 'advice.detachedHead=false', 'checkout', revno, '--'] is_shallow = False - depth_option = [] # type: T.List[str] + depth_option: T.List[str] = [] if self.wrap.values.get('depth', '') != '': is_shallow = True depth_option = ['--depth', self.wrap.values.get('depth')] |