Fix mypy errors

pull/9737/head
Daniel Mensinger 3 years ago committed by Eli Schwartz
parent 26f188fb36
commit c5ce9744b2
  1. 2
      mesonbuild/build.py
  2. 4
      mesonbuild/dependencies/detect.py
  3. 1
      mesonbuild/interpreter/interpreterobjects.py
  4. 4
      mesonbuild/mesonlib/universal.py
  5. 12
      mesonbuild/modules/windows.py
  6. 2
      run_project_tests.py

@ -2362,7 +2362,7 @@ class CustomTarget(Target, CommandBase):
install_dir: T.List[T.Union[str, bool]]
def __init__(self, name: str, subdir: str, subproject: str, kwargs: T.Dict[str, T.Any],
def __init__(self, name: str, subdir: str, subproject: str, kwargs: T.Mapping[str, T.Any],
absolute_paths: bool = False, backend: T.Optional['Backend'] = None):
self.typename = 'custom'
# TODO expose keyword arg to make MachineChoice.HOST configurable

@ -59,12 +59,12 @@ def get_dep_identifier(name: str, kwargs: T.Dict[str, T.Any]) -> 'TV_DepID':
continue
# All keyword arguments are strings, ints, or lists (or lists of lists)
if isinstance(value, list):
value = frozenset(listify(value))
for i in value:
assert isinstance(i, str)
value = tuple(frozenset(listify(value)))
else:
assert isinstance(value, (str, bool, int))
identifier += (key, value)
identifier = (*identifier, (key, value),)
return identifier
display_name_map = {

@ -787,6 +787,7 @@ class BuildTargetHolder(ObjectHolder[_BuildTarget]):
def __repr__(self) -> str:
r = '<{} {}: {}>'
h = self.held_object
assert isinstance(h, build.BuildTarget)
return r.format(self.__class__.__name__, h.get_id(), h.filename)
@property

@ -1731,9 +1731,7 @@ class OrderedSet(T.MutableSet[_T]):
return 'OrderedSet()'
def __reversed__(self) -> T.Iterator[_T]:
# Mypy is complaining that sets can't be reversed, which is true for
# unordered sets, but this is an ordered, set so reverse() makes sense.
return reversed(self.__container.keys()) # type: ignore
return reversed(self.__container.keys())
def add(self, value: _T) -> None:
self.__container[value] = None

@ -41,6 +41,14 @@ if T.TYPE_CHECKING:
include_directories: T.List[T.Union[str, build.IncludeDirs]]
args: T.List[str]
class RcKwargs(TypedDict):
output: str
input: T.List[T.Union[mesonlib.FileOrString, build.CustomTargetIndex]]
depfile: T.Optional[str]
depend_files: T.List[mesonlib.FileOrString]
depends: T.List[T.Union[build.BuildTarget, build.CustomTarget]]
command: T.List[T.Union[str, ExternalProgram]]
class ResourceCompilerType(enum.Enum):
windres = 1
rc = 2
@ -174,11 +182,13 @@ class WindowsModule(ExtensionModule):
command.append(rescomp)
command.extend(res_args)
res_kwargs = {
res_kwargs: 'RcKwargs' = {
'output': output,
'input': [src],
'depfile': None,
'depend_files': wrc_depend_files,
'depends': wrc_depends,
'command': [],
}
# instruct binutils windres to generate a preprocessor depfile

@ -313,7 +313,7 @@ class StopException(Exception):
def __init__(self) -> None:
super().__init__('Stopped by user')
def stop_handler(signal: signal.Signals, frame: T.Optional['FrameType']) -> None:
def stop_handler(signal: int, frame: T.Optional['FrameType']) -> None:
global stop
stop = True
signal.signal(signal.SIGINT, stop_handler)

Loading…
Cancel
Save