From 90ce0841441506e3f409ab59ded1df8f2e6e7363 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 10 Aug 2023 21:19:29 -0400 Subject: 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/ ``` --- mesonbuild/scripts/cmake_run_ctgt.py | 2 +- mesonbuild/scripts/depfixer.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'mesonbuild/scripts') diff --git a/mesonbuild/scripts/cmake_run_ctgt.py b/mesonbuild/scripts/cmake_run_ctgt.py index 755530a68..df3f36185 100755 --- a/mesonbuild/scripts/cmake_run_ctgt.py +++ b/mesonbuild/scripts/cmake_run_ctgt.py @@ -9,7 +9,7 @@ from pathlib import Path import typing as T def run(argsv: T.List[str]) -> int: - commands = [[]] # type: T.List[T.List[str]] + commands: T.List[T.List[str]] = [[]] SEPARATOR = ';;;' # Generate CMD parameters diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py index b9c58fee5..593efd9f7 100644 --- a/mesonbuild/scripts/depfixer.py +++ b/mesonbuild/scripts/depfixer.py @@ -123,8 +123,8 @@ class Elf(DataSizes): def __init__(self, bfile: str, verbose: bool = True) -> None: self.bfile = bfile self.verbose = verbose - self.sections = [] # type: T.List[SectionHeader] - self.dynamic = [] # type: T.List[DynamicEntry] + self.sections: T.List[SectionHeader] = [] + self.dynamic: T.List[DynamicEntry] = [] self.open_bf(bfile) try: (self.ptrsize, self.is_le) = self.detect_elf_type() @@ -329,7 +329,7 @@ class Elf(DataSizes): old_rpath = self.read_str() # Some rpath entries may come from multiple sources. # Only add each one once. - new_rpaths = OrderedSet() # type: OrderedSet[bytes] + new_rpaths: OrderedSet[bytes] = OrderedSet() if new_rpath: new_rpaths.update(new_rpath.split(b':')) if old_rpath: -- cgit v1.3