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/compilers | |
| parent | de1cc0b02bcb1bab6977f0ab8bb3fef0cd0646dd (diff) | |
| download | meson-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/compilers')
| -rw-r--r-- | mesonbuild/compilers/cs.py | 4 | ||||
| -rw-r--r-- | mesonbuild/compilers/detect.py | 2 | ||||
| -rw-r--r-- | mesonbuild/compilers/mixins/arm.py | 18 | ||||
| -rw-r--r-- | mesonbuild/compilers/mixins/pgi.py | 4 | ||||
| -rw-r--r-- | mesonbuild/compilers/mixins/xc16.py | 14 | ||||
| -rw-r--r-- | mesonbuild/compilers/rust.py | 4 | ||||
| -rw-r--r-- | mesonbuild/compilers/swift.py | 4 |
7 files changed, 25 insertions, 25 deletions
diff --git a/mesonbuild/compilers/cs.py b/mesonbuild/compilers/cs.py index f0bed5fb8..cd99c8175 100644 --- a/mesonbuild/compilers/cs.py +++ b/mesonbuild/compilers/cs.py @@ -28,7 +28,7 @@ if T.TYPE_CHECKING: from ..environment import Environment from ..mesonlib import MachineChoice -cs_optimization_args = { +cs_optimization_args: T.Dict[str, T.List[str]] = { 'plain': [], '0': [], 'g': [], @@ -36,7 +36,7 @@ cs_optimization_args = { '2': ['-optimize+'], '3': ['-optimize+'], 's': ['-optimize+'], - } # type: T.Dict[str, T.List[str]] + } class CsCompiler(BasicLinkerIsCompilerMixin, Compiler): diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 210ec4d40..f99724762 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -969,7 +969,7 @@ def detect_vala_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> RustCompiler: from . import rust from ..linkers import linkers - popen_exceptions = {} # type: T.Dict[str, Exception] + popen_exceptions: T.Dict[str, Exception] = {} compilers, _, exe_wrap = _get_compilers(env, 'rust', for_machine) is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] diff --git a/mesonbuild/compilers/mixins/arm.py b/mesonbuild/compilers/mixins/arm.py index 22595a8c8..3abc0c817 100644 --- a/mesonbuild/compilers/mixins/arm.py +++ b/mesonbuild/compilers/mixins/arm.py @@ -34,16 +34,16 @@ else: # do). This gives up DRYer type checking, with no runtime impact Compiler = object -arm_buildtype_args = { +arm_buildtype_args: T.Dict[str, T.List[str]] = { 'plain': [], 'debug': [], 'debugoptimized': [], 'release': [], 'minsize': [], 'custom': [], -} # type: T.Dict[str, T.List[str]] +} -arm_optimization_args = { +arm_optimization_args: T.Dict[str, T.List[str]] = { 'plain': [], '0': ['-O0'], 'g': ['-g'], @@ -51,18 +51,18 @@ arm_optimization_args = { '2': [], # Compiler defaults to -O2 '3': ['-O3', '-Otime'], 's': ['-O3'], # Compiler defaults to -Ospace -} # type: T.Dict[str, T.List[str]] +} -armclang_buildtype_args = { +armclang_buildtype_args: T.Dict[str, T.List[str]] = { 'plain': [], 'debug': [], 'debugoptimized': [], 'release': [], 'minsize': [], 'custom': [], -} # type: T.Dict[str, T.List[str]] +} -armclang_optimization_args = { +armclang_optimization_args: T.Dict[str, T.List[str]] = { 'plain': [], '0': [], # Compiler defaults to -O0 'g': ['-g'], @@ -70,7 +70,7 @@ armclang_optimization_args = { '2': ['-O2'], '3': ['-O3'], 's': ['-Oz'] -} # type: T.Dict[str, T.List[str]] +} class ArmCompiler(Compiler): @@ -82,7 +82,7 @@ class ArmCompiler(Compiler): def __init__(self) -> None: if not self.is_cross: raise mesonlib.EnvironmentException('armcc supports only cross-compilation.') - default_warn_args = [] # type: T.List[str] + default_warn_args: T.List[str] = [] self.warn_args = {'0': [], '1': default_warn_args, '2': default_warn_args + [], diff --git a/mesonbuild/compilers/mixins/pgi.py b/mesonbuild/compilers/mixins/pgi.py index 2fa736c58..6362b46ac 100644 --- a/mesonbuild/compilers/mixins/pgi.py +++ b/mesonbuild/compilers/mixins/pgi.py @@ -32,14 +32,14 @@ else: # do). This gives up DRYer type checking, with no runtime impact Compiler = object -pgi_buildtype_args = { +pgi_buildtype_args: T.Dict[str, T.List[str]] = { 'plain': [], 'debug': [], 'debugoptimized': [], 'release': [], 'minsize': [], 'custom': [], -} # type: T.Dict[str, T.List[str]] +} class PGICompiler(Compiler): diff --git a/mesonbuild/compilers/mixins/xc16.py b/mesonbuild/compilers/mixins/xc16.py index 8957dd960..2b3904628 100644 --- a/mesonbuild/compilers/mixins/xc16.py +++ b/mesonbuild/compilers/mixins/xc16.py @@ -31,16 +31,16 @@ else: # do). This gives up DRYer type checking, with no runtime impact Compiler = object -xc16_buildtype_args = { +xc16_buildtype_args: T.Dict[str, T.List[str]] = { 'plain': [], 'debug': [], 'debugoptimized': [], 'release': [], 'minsize': [], 'custom': [], -} # type: T.Dict[str, T.List[str]] +} -xc16_optimization_args = { +xc16_optimization_args: T.Dict[str, T.List[str]] = { 'plain': [], '0': ['-O0'], 'g': ['-O0'], @@ -48,12 +48,12 @@ xc16_optimization_args = { '2': ['-O2'], '3': ['-O3'], 's': ['-Os'] -} # type: T.Dict[str, T.List[str]] +} -xc16_debug_args = { +xc16_debug_args: T.Dict[bool, T.List[str]] = { False: [], True: [] -} # type: T.Dict[bool, T.List[str]] +} class Xc16Compiler(Compiler): @@ -66,7 +66,7 @@ class Xc16Compiler(Compiler): # Assembly self.can_compile_suffixes.add('s') self.can_compile_suffixes.add('sx') - default_warn_args = [] # type: T.List[str] + default_warn_args: T.List[str] = [] self.warn_args = {'0': [], '1': default_warn_args, '2': default_warn_args + [], diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index ef0390e97..d722039d1 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -32,7 +32,7 @@ if T.TYPE_CHECKING: from ..dependencies import Dependency -rust_optimization_args = { +rust_optimization_args: T.Dict[str, T.List[str]] = { 'plain': [], '0': [], 'g': ['-C', 'opt-level=0'], @@ -40,7 +40,7 @@ rust_optimization_args = { '2': ['-C', 'opt-level=2'], '3': ['-C', 'opt-level=3'], 's': ['-C', 'opt-level=s'], -} # type: T.Dict[str, T.List[str]] +} class RustCompiler(Compiler): diff --git a/mesonbuild/compilers/swift.py b/mesonbuild/compilers/swift.py index 19866e2c0..68ef99227 100644 --- a/mesonbuild/compilers/swift.py +++ b/mesonbuild/compilers/swift.py @@ -26,7 +26,7 @@ if T.TYPE_CHECKING: from ..linkers.linkers import DynamicLinker from ..mesonlib import MachineChoice -swift_optimization_args = { +swift_optimization_args: T.Dict[str, T.List[str]] = { 'plain': [], '0': [], 'g': [], @@ -34,7 +34,7 @@ swift_optimization_args = { '2': ['-O'], '3': ['-O'], 's': ['-O'], -} # type: T.Dict[str, T.List[str]] +} class SwiftCompiler(Compiler): |
