diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-08-10 20:51:45 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-08-11 13:37:17 -0400 |
commit | a01418db0a37908cc2504adbb0cf56d333348f9a (patch) | |
tree | 6463a2f91154092fd7f1aeeb72f744258daa6ff8 /mesonbuild | |
parent | 03a2a3a6773785e087b296e9e6ff6791c6068f60 (diff) | |
download | meson-a01418db0a37908cc2504adbb0cf56d333348f9a.zip meson-a01418db0a37908cc2504adbb0cf56d333348f9a.tar.gz meson-a01418db0a37908cc2504adbb0cf56d333348f9a.tar.bz2 |
remove useless type annotations
These annotations all had a default initializer of the correct type, or
a parent class annotation.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/arglist.py | 6 | ||||
-rw-r--r-- | mesonbuild/ast/introspection.py | 2 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 4 | ||||
-rw-r--r-- | mesonbuild/cmake/common.py | 24 | ||||
-rw-r--r-- | mesonbuild/cmake/generator.py | 12 | ||||
-rw-r--r-- | mesonbuild/cmake/traceparser.py | 6 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/arm.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/xc16.py | 2 | ||||
-rw-r--r-- | mesonbuild/dependencies/boost.py | 2 | ||||
-rw-r--r-- | mesonbuild/dependencies/cuda.py | 4 | ||||
-rw-r--r-- | mesonbuild/envconfig.py | 2 | ||||
-rw-r--r-- | mesonbuild/interpreterbase/decorators.py | 6 | ||||
-rw-r--r-- | mesonbuild/mcompile.py | 2 | ||||
-rw-r--r-- | mesonbuild/mparser.py | 6 | ||||
-rw-r--r-- | mesonbuild/mtest.py | 6 |
15 files changed, 43 insertions, 43 deletions
diff --git a/mesonbuild/arglist.py b/mesonbuild/arglist.py index c44728a..dfb3dcd 100644 --- a/mesonbuild/arglist.py +++ b/mesonbuild/arglist.py @@ -26,7 +26,7 @@ if T.TYPE_CHECKING: from .compilers import Compiler # execinfo is a compiler lib on BSD -UNIXY_COMPILER_INTERNAL_LIBS = ['m', 'c', 'pthread', 'dl', 'rt', 'execinfo'] # type: T.List[str] +UNIXY_COMPILER_INTERNAL_LIBS = ['m', 'c', 'pthread', 'dl', 'rt', 'execinfo'] class Dedup(enum.Enum): @@ -94,7 +94,7 @@ class CompilerArgs(T.MutableSequence[str]): # NOTE: not thorough. A list of potential corner cases can be found in # https://github.com/mesonbuild/meson/pull/4593#pullrequestreview-182016038 dedup1_prefixes = () # type: T.Tuple[str, ...] - dedup1_suffixes = ('.lib', '.dll', '.so', '.dylib', '.a') # type: T.Tuple[str, ...] + dedup1_suffixes = ('.lib', '.dll', '.so', '.dylib', '.a') # Match a .so of the form path/to/libfoo.so.0.1.0 # Only UNIX shared libraries require this. Others have a fixed extension. dedup1_regex = re.compile(r'([\/\\]|\A)lib.*\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$') @@ -102,7 +102,7 @@ class CompilerArgs(T.MutableSequence[str]): # In generate_link() we add external libs without de-dup, but we must # *always* de-dup these because they're special arguments to the linker # TODO: these should probably move too - always_dedup_args = tuple('-l' + lib for lib in UNIXY_COMPILER_INTERNAL_LIBS) # type : T.Tuple[str, ...] + always_dedup_args = tuple('-l' + lib for lib in UNIXY_COMPILER_INTERNAL_LIBS) def __init__(self, compiler: T.Union['Compiler', 'StaticLinker'], iterable: T.Optional[T.Iterable[str]] = None): diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py index d66e73f..d31b29f 100644 --- a/mesonbuild/ast/introspection.py +++ b/mesonbuild/ast/introspection.py @@ -46,7 +46,7 @@ class IntrospectionHelper(argparse.Namespace): # mimic an argparse namespace def __init__(self, cross_file: str): super().__init__() - self.cross_file = cross_file # type: str + self.cross_file = cross_file self.native_file = None # type: str self.cmd_line_options = {} # type: T.Dict[str, str] diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 3ddc197..72c8265 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -3815,7 +3815,7 @@ def _scan_fortran_file_deps(src: Path, srcdir: Path, dirname: Path, tdeps, compi # a common occurrence, which would lead to lots of # distracting noise. continue - srcfile = srcdir / tdeps[usename].fname # type: Path + srcfile = srcdir / tdeps[usename].fname if not srcfile.is_file(): if srcfile.name != src.name: # generated source file pass @@ -3837,7 +3837,7 @@ def _scan_fortran_file_deps(src: Path, srcdir: Path, dirname: Path, tdeps, compi ancestor_child = '_'.join(parents) if ancestor_child not in tdeps: raise MesonException("submodule {} relies on ancestor module {} that was not found.".format(submodmatch.group(2).lower(), ancestor_child.split('_', maxsplit=1)[0])) - submodsrcfile = srcdir / tdeps[ancestor_child].fname # type: Path + submodsrcfile = srcdir / tdeps[ancestor_child].fname if not submodsrcfile.is_file(): if submodsrcfile.name != src.name: # generated source file pass diff --git a/mesonbuild/cmake/common.py b/mesonbuild/cmake/common.py index 3de6c16..002cda7 100644 --- a/mesonbuild/cmake/common.py +++ b/mesonbuild/cmake/common.py @@ -167,10 +167,10 @@ class CMakeInclude: class CMakeFileGroup: def __init__(self, data: T.Dict[str, T.Any]) -> None: self.defines = data.get('defines', '') # type: str - self.flags = _flags_to_list(data.get('compileFlags', '')) # type: T.List[str] + self.flags = _flags_to_list(data.get('compileFlags', '')) self.is_generated = data.get('isGenerated', False) # type: bool self.language = data.get('language', 'C') # type: str - self.sources = [Path(x) for x in data.get('sources', [])] # type: T.List[Path] + self.sources = [Path(x) for x in data.get('sources', [])] # Fix the include directories self.includes = [] # type: T.List[CMakeInclude] @@ -196,18 +196,18 @@ class CMakeFileGroup: class CMakeTarget: def __init__(self, data: T.Dict[str, T.Any]) -> None: - self.artifacts = [Path(x) for x in data.get('artifacts', [])] # type: T.List[Path] - self.src_dir = Path(data.get('sourceDirectory', '')) # type: Path - self.build_dir = Path(data.get('buildDirectory', '')) # type: Path + self.artifacts = [Path(x) for x in data.get('artifacts', [])] + self.src_dir = Path(data.get('sourceDirectory', '')) + self.build_dir = Path(data.get('buildDirectory', '')) self.name = data.get('name', '') # type: str self.full_name = data.get('fullName', '') # type: str self.install = data.get('hasInstallRule', False) # type: bool - self.install_paths = [Path(x) for x in set(data.get('installPaths', []))] # type: T.List[Path] + self.install_paths = [Path(x) for x in set(data.get('installPaths', []))] self.link_lang = data.get('linkerLanguage', '') # type: str - self.link_libraries = _flags_to_list(data.get('linkLibraries', '')) # type: T.List[str] - self.link_flags = _flags_to_list(data.get('linkFlags', '')) # type: T.List[str] - self.link_lang_flags = _flags_to_list(data.get('linkLanguageFlags', '')) # type: T.List[str] - # self.link_path = Path(data.get('linkPath', '')) # type: Path + self.link_libraries = _flags_to_list(data.get('linkLibraries', '')) + self.link_flags = _flags_to_list(data.get('linkFlags', '')) + self.link_lang_flags = _flags_to_list(data.get('linkLanguageFlags', '')) + # self.link_path = Path(data.get('linkPath', '')) self.type = data.get('type', 'EXECUTABLE') # type: str # self.is_generator_provided = data.get('isGeneratorProvided', False) # type: bool self.files = [] # type: T.List[CMakeFileGroup] @@ -237,8 +237,8 @@ class CMakeTarget: class CMakeProject: def __init__(self, data: T.Dict[str, T.Any]) -> None: - self.src_dir = Path(data.get('sourceDirectory', '')) # type: Path - self.build_dir = Path(data.get('buildDirectory', '')) # type: Path + self.src_dir = Path(data.get('sourceDirectory', '')) + self.build_dir = Path(data.get('buildDirectory', '')) self.name = data.get('name', '') # type: str self.targets = [] # type: T.List[CMakeTarget] diff --git a/mesonbuild/cmake/generator.py b/mesonbuild/cmake/generator.py index 5b83479..f47625c 100644 --- a/mesonbuild/cmake/generator.py +++ b/mesonbuild/cmake/generator.py @@ -38,8 +38,8 @@ def parse_generator_expressions( if '$<' not in raw: return raw - out = '' # type: str - i = 0 # type: int + out = '' + i = 0 def equal(arg: str) -> str: col_pos = arg.find(',') @@ -147,10 +147,10 @@ def parse_generator_expressions( nonlocal i i += 2 - func = '' # type: str - args = '' # type: str - res = '' # type: str - exp = '' # type: str + func = '' + args = '' + res = '' + exp = '' # Determine the body of the expression while i < len(raw): diff --git a/mesonbuild/cmake/traceparser.py b/mesonbuild/cmake/traceparser.py index 7f31f13..92ff780 100644 --- a/mesonbuild/cmake/traceparser.py +++ b/mesonbuild/cmake/traceparser.py @@ -107,8 +107,8 @@ class CMakeTraceParser: self.custom_targets = [] # type: T.List[CMakeGeneratorTarget] self.env = env - self.permissive = permissive # type: bool - self.cmake_version = cmake_version # type: str + self.permissive = permissive + self.cmake_version = cmake_version self.trace_file = 'cmake_trace.txt' self.trace_file_path = build_dir / self.trace_file self.trace_format = 'json-v1' if version_compare(cmake_version, '>=3.17') else 'human' @@ -785,7 +785,7 @@ class CMakeTraceParser: fixed_list = [] # type: T.List[str] curr_str = None # type: T.Optional[str] - path_found = False # type: bool + path_found = False for i in broken_list: if curr_str is None: diff --git a/mesonbuild/compilers/mixins/arm.py b/mesonbuild/compilers/mixins/arm.py index 7c53327..22595a8 100644 --- a/mesonbuild/compilers/mixins/arm.py +++ b/mesonbuild/compilers/mixins/arm.py @@ -87,7 +87,7 @@ class ArmCompiler(Compiler): '1': default_warn_args, '2': default_warn_args + [], '3': default_warn_args + [], - 'everything': default_warn_args + []} # type: T.Dict[str, T.List[str]] + 'everything': default_warn_args + []} # Assembly self.can_compile_suffixes.add('s') self.can_compile_suffixes.add('sx') diff --git a/mesonbuild/compilers/mixins/xc16.py b/mesonbuild/compilers/mixins/xc16.py index 36c2c10..8957dd9 100644 --- a/mesonbuild/compilers/mixins/xc16.py +++ b/mesonbuild/compilers/mixins/xc16.py @@ -71,7 +71,7 @@ class Xc16Compiler(Compiler): '1': default_warn_args, '2': default_warn_args + [], '3': default_warn_args + [], - 'everything': default_warn_args + []} # type: T.Dict[str, T.List[str]] + 'everything': default_warn_args + []} def get_always_args(self) -> T.List[str]: return [] diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py index 0a936e6..648c8d2 100644 --- a/mesonbuild/dependencies/boost.py +++ b/mesonbuild/dependencies/boost.py @@ -333,7 +333,7 @@ class BoostLibraryFile(): def get_compiler_args(self) -> T.List[str]: args = [] # type: T.List[str] if self.mod_name in boost_libraries: - libdef = boost_libraries[self.mod_name] # type: BoostLibrary + libdef = boost_libraries[self.mod_name] if self.static: args += libdef.static else: diff --git a/mesonbuild/dependencies/cuda.py b/mesonbuild/dependencies/cuda.py index af0ae4b..e16808b 100644 --- a/mesonbuild/dependencies/cuda.py +++ b/mesonbuild/dependencies/cuda.py @@ -195,8 +195,8 @@ class CudaDependency(SystemDependency): except ValueError: continue # use // for floor instead of / which produces a float - major = vers_int // 1000 # type: int - minor = (vers_int - major * 1000) // 10 # type: int + major = vers_int // 1000 + minor = (vers_int - major * 1000) // 10 return f'{major}.{minor}' return None diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py index 7e0c567..56dee65 100644 --- a/mesonbuild/envconfig.py +++ b/mesonbuild/envconfig.py @@ -161,7 +161,7 @@ class Properties: self, properties: T.Optional[T.Dict[str, T.Optional[T.Union[str, bool, int, T.List[str]]]]] = None, ): - self.properties = properties or {} # type: T.Dict[str, T.Optional[T.Union[str, bool, int, T.List[str]]]] + self.properties = properties or {} def has_stdlib(self, language: str) -> bool: return language + '_stdlib' in self.properties diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py index cecdbfd..5bb8306 100644 --- a/mesonbuild/interpreterbase/decorators.py +++ b/mesonbuild/interpreterbase/decorators.py @@ -606,9 +606,9 @@ class FeatureCheckBase(metaclass=abc.ABCMeta): unconditional = False def __init__(self, feature_name: str, feature_version: str, extra_message: str = ''): - self.feature_name = feature_name # type: str - self.feature_version = feature_version # type: str - self.extra_message = extra_message # type: str + self.feature_name = feature_name + self.feature_version = feature_version + self.extra_message = extra_message @staticmethod def get_target_version(subproject: str) -> str: diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py index 4e46702..7ae7175 100644 --- a/mesonbuild/mcompile.py +++ b/mesonbuild/mcompile.py @@ -174,7 +174,7 @@ def generate_target_name_vs(target: ParsedTargetName, builddir: Path, introspect # Normalize project name # Source: https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe - target_name = re.sub(r"[\%\$\@\;\.\(\)']", '_', intro_target['id']) # type: str + target_name = re.sub(r"[\%\$\@\;\.\(\)']", '_', intro_target['id']) rel_path = Path(intro_target['filename'][0]).relative_to(builddir.resolve()).parent if rel_path != Path('.'): target_name = str(rel_path / target_name) diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py index 85f1ef3..d4ddff9 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -811,7 +811,7 @@ class Parser: return EmptyNode(self.current.lineno, self.current.colno, self.current.filename) def key_values(self) -> ArgumentNode: - s = self.statement() # type: BaseNode + s = self.statement() a = ArgumentNode(self.current) while not isinstance(s, EmptyNode): @@ -828,7 +828,7 @@ class Parser: return a def args(self) -> ArgumentNode: - s = self.statement() # type: BaseNode + s = self.statement() a = ArgumentNode(self.current) while not isinstance(s, EmptyNode): @@ -875,7 +875,7 @@ class Parser: self.expect('id') assert isinstance(t.value, str) varname = t - varnames = [t.value] # type: T.List[str] + varnames = [t.value] if self.accept('comma'): t = self.current diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 0e1086c..2ee337c 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -524,7 +524,7 @@ class ConsoleLogger(TestLogger): self.running_tests = OrderedSet() # type: OrderedSet['TestRun'] self.progress_test = None # type: T.Optional['TestRun'] self.progress_task = None # type: T.Optional[asyncio.Future] - self.max_left_width = 0 # type: int + self.max_left_width = 0 self.stop = False # TODO: before 3.10 this cannot be created immediately, because # it will create a new event loop @@ -933,7 +933,7 @@ class TestRun: self.stde = '' self.additional_error = '' self.cmd = None # type: T.Optional[T.List[str]] - self.env = test_env # type: T.Dict[str, str] + self.env = test_env self.should_fail = test.should_fail self.project = test.project_name self.junit = None # type: T.Optional[et.ElementTree] @@ -1285,7 +1285,7 @@ class TestSubprocess: self.stderr = stderr self.stdo_task: T.Optional[asyncio.Task[None]] = None self.stde_task: T.Optional[asyncio.Task[None]] = None - self.postwait_fn = postwait_fn # type: T.Callable[[], None] + self.postwait_fn = postwait_fn self.all_futures = [] # type: T.List[asyncio.Future] self.queue = None # type: T.Optional[asyncio.Queue[T.Optional[str]]] |