Fix mypy errors

0.60
Daniel Mensinger 3 years ago committed by Nirbheek Chauhan
parent 299650a7ff
commit e94abb89cf
  1. 2
      mesonbuild/build.py
  2. 4
      mesonbuild/dependencies/detect.py
  3. 1
      mesonbuild/interpreter/interpreterobjects.py
  4. 4
      mesonbuild/mesonlib/universal.py
  5. 2
      run_project_tests.py

@ -2325,7 +2325,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 = {

@ -783,6 +783,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

@ -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