From 33c8362a1cdd57dd60c7be8fdf3b0566ccdeb3bf Mon Sep 17 00:00:00 2001 From: Tristan Partin Date: Wed, 12 Jul 2023 17:56:18 -0500 Subject: [PATCH] Match the method signatures of parent classes Names and types of some methods did not match their parent methods. --- mesonbuild/compilers/cpp.py | 4 ++-- mesonbuild/compilers/mixins/gnu.py | 4 ++-- mesonbuild/compilers/mixins/intel.py | 4 ++-- mesonbuild/compilers/mixins/metrowerks.py | 4 ++-- mesonbuild/compilers/mixins/ti.py | 4 ++-- mesonbuild/compilers/mixins/visualstudio.py | 14 +++++++------- mesonbuild/compilers/vala.py | 4 ++-- mesonbuild/coredata.py | 6 +++--- mesonbuild/linkers/linkers.py | 10 +++++----- mesonbuild/utils/universal.py | 2 +- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index be5c083a9..bb1ebb578 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -867,8 +867,8 @@ class CcrxCPPCompiler(CcrxCompiler, CPPCompiler): def get_compile_only_args(self) -> T.List[str]: return [] - def get_output_args(self, target: str) -> T.List[str]: - return [f'-output=obj={target}'] + def get_output_args(self, outputname: str) -> T.List[str]: + return [f'-output=obj={outputname}'] def get_option_link_args(self, options: 'KeyedOptionDictType') -> T.List[str]: return [] diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index 7b7bc890b..2b187327b 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -529,8 +529,8 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta): args.append('-fno-omit-frame-pointer') return args - def get_output_args(self, target: str) -> T.List[str]: - return ['-o', target] + def get_output_args(self, outputname: str) -> T.List[str]: + return ['-o', outputname] def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]: return ['-MD', '-MQ', outtarget, '-MF', outfile] diff --git a/mesonbuild/compilers/mixins/intel.py b/mesonbuild/compilers/mixins/intel.py index 711e77cca..9af05e01c 100644 --- a/mesonbuild/compilers/mixins/intel.py +++ b/mesonbuild/compilers/mixins/intel.py @@ -89,8 +89,8 @@ class IntelGnuLikeCompiler(GnuLikeCompiler): return ['-pch', '-pch_dir', os.path.join(pch_dir), '-x', self.lang_header, '-include', header, '-x', 'none'] - def get_pch_name(self, header_name: str) -> str: - return os.path.basename(header_name) + '.' + self.get_pch_suffix() + def get_pch_name(self, name: str) -> str: + return os.path.basename(name) + '.' + self.get_pch_suffix() def openmp_flags(self) -> T.List[str]: if mesonlib.version_compare(self.version, '>=15.0.0'): diff --git a/mesonbuild/compilers/mixins/metrowerks.py b/mesonbuild/compilers/mixins/metrowerks.py index 7aab9b52e..83a1c1d7f 100644 --- a/mesonbuild/compilers/mixins/metrowerks.py +++ b/mesonbuild/compilers/mixins/metrowerks.py @@ -249,8 +249,8 @@ class MetrowerksCompiler(Compiler): def get_optimization_args(self, optimization_level: str) -> T.List[str]: return mwcc_optimization_args[optimization_level] - def get_output_args(self, target: str) -> T.List[str]: - return ['-o', target] + def get_output_args(self, outputname: str) -> T.List[str]: + return ['-o', outputname] def get_pic_args(self) -> T.List[str]: return ['-pic'] diff --git a/mesonbuild/compilers/mixins/ti.py b/mesonbuild/compilers/mixins/ti.py index 6123aea88..ae23c8416 100644 --- a/mesonbuild/compilers/mixins/ti.py +++ b/mesonbuild/compilers/mixins/ti.py @@ -113,8 +113,8 @@ class TICompiler(Compiler): def get_no_optimization_args(self) -> T.List[str]: return ['-Ooff'] - def get_output_args(self, target: str) -> T.List[str]: - return [f'--output_file={target}'] + def get_output_args(self, outputname: str) -> T.List[str]: + return [f'--output_file={outputname}'] def get_werror_args(self) -> T.List[str]: return ['--emit_warnings_as_errors'] diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index 54a95bb0f..24f11329d 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -147,8 +147,8 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta): def get_pch_suffix(self) -> str: return 'pch' - def get_pch_name(self, header: str) -> str: - chopped = os.path.basename(header).split('.')[:-1] + def get_pch_name(self, name: str) -> str: + chopped = os.path.basename(name).split('.')[:-1] chopped.append(self.get_pch_suffix()) pchname = '.'.join(chopped) return pchname @@ -181,12 +181,12 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta): raise mesonlib.MesonException('VS only supports address sanitizer at the moment.') return ['/fsanitize=address'] - def get_output_args(self, target: str) -> T.List[str]: + def get_output_args(self, outputname: str) -> T.List[str]: if self.mode == CompileCheckMode.PREPROCESS: - return ['/Fi' + target] - if target.endswith('.exe'): - return ['/Fe' + target] - return ['/Fo' + target] + return ['/Fi' + outputname] + if outputname.endswith('.exe'): + return ['/Fe' + outputname] + return ['/Fo' + outputname] def get_buildtype_args(self, buildtype: str) -> T.List[str]: return [] diff --git a/mesonbuild/compilers/vala.py b/mesonbuild/compilers/vala.py index e1477b965..c6af04a27 100644 --- a/mesonbuild/compilers/vala.py +++ b/mesonbuild/compilers/vala.py @@ -46,7 +46,7 @@ class ValaCompiler(Compiler): def get_debug_args(self, is_debug: bool) -> T.List[str]: return ['--debug'] if is_debug else [] - def get_output_args(self, target: str) -> T.List[str]: + def get_output_args(self, outputname: str) -> T.List[str]: return [] # Because compiles into C. def get_compile_only_args(self) -> T.List[str]: @@ -64,7 +64,7 @@ class ValaCompiler(Compiler): def get_always_args(self) -> T.List[str]: return ['-C'] - def get_warn_args(self, warning_level: str) -> T.List[str]: + def get_warn_args(self, level: str) -> T.List[str]: return [] def get_no_warn_args(self) -> T.List[str]: diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 72f104248..8f0fa6155 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -955,12 +955,12 @@ class CmdLineFileParser(configparser.ConfigParser): # storing subproject options like "subproject:option=value" super().__init__(delimiters=['='], interpolation=None) - def read(self, filenames: T.Union['StrOrBytesPath', T.Iterable['StrOrBytesPath']], encoding: str = 'utf-8') -> T.List[str]: + def read(self, filenames: T.Union['StrOrBytesPath', T.Iterable['StrOrBytesPath']], encoding: T.Optional[str] = 'utf-8') -> T.List[str]: return super().read(filenames, encoding) - def optionxform(self, option: str) -> str: + def optionxform(self, optionstr: str) -> str: # Don't call str.lower() on keys - return option + return optionstr class MachineFileParser(): def __init__(self, filenames: T.List[str]) -> None: diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py index 8675766b8..609308b2d 100644 --- a/mesonbuild/linkers/linkers.py +++ b/mesonbuild/linkers/linkers.py @@ -479,7 +479,7 @@ class DynamicLinker(metaclass=abc.ABCMeta): f'Linker {self.id} does not support allow undefined') @abc.abstractmethod - def get_output_args(self, outname: str) -> T.List[str]: + def get_output_args(self, outputname: str) -> T.List[str]: pass def get_coverage_args(self) -> T.List[str]: @@ -560,8 +560,8 @@ class PosixDynamicLinkerMixin: GNU-like that it makes sense to split this out. """ - def get_output_args(self, outname: str) -> T.List[str]: - return ['-o', outname] + def get_output_args(self, outputname: str) -> T.List[str]: + return ['-o', outputname] def get_std_shared_lib_args(self) -> T.List[str]: return ['-shared'] @@ -1596,8 +1596,8 @@ class MetrowerksLinker(DynamicLinker): def get_linker_always_args(self) -> T.List[str]: return [] - def get_output_args(self, target: str) -> T.List[str]: - return ['-o', target] + def get_output_args(self, outputname: str) -> T.List[str]: + return ['-o', outputname] def get_search_args(self, dirname: str) -> T.List[str]: return self._apply_prefix('-L' + dirname) diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py index 35da2f40c..3b7ca142f 100644 --- a/mesonbuild/utils/universal.py +++ b/mesonbuild/utils/universal.py @@ -1983,7 +1983,7 @@ class RealPathAction(argparse.Action): super().__init__(option_strings, dest, nargs=None, default=default, **kwargs) def __call__(self, parser: argparse.ArgumentParser, namespace: argparse.Namespace, - values: T.Union[str, T.Sequence[T.Any], None], option_string: str = None) -> None: + values: T.Union[str, T.Sequence[T.Any], None], option_string: T.Optional[str] = None) -> None: assert isinstance(values, str) setattr(namespace, self.dest, os.path.abspath(os.path.realpath(values)))