manually clean up some python 3.6 era code

pull/9510/head
Eli Schwartz 3 years ago
parent 140097faf0
commit 98a41ec24e
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 10
      mesonbuild/mesonlib/universal.py
  2. 5
      unittests/allplatformstests.py

@ -1708,9 +1708,7 @@ class OrderedSet(T.MutableSet[_T]):
insertion.
"""
def __init__(self, iterable: T.Optional[T.Iterable[_T]] = None):
# typing.OrderedDict is new in 3.7.2, so we can't use that, but we can
# use MutableMapping, which is fine in this case.
self.__container = collections.OrderedDict() # type: T.MutableMapping[_T, None]
self.__container: T.OrderedDict[_T, None] = collections.OrderedDict()
if iterable:
self.update(iterable)
@ -1741,12 +1739,10 @@ class OrderedSet(T.MutableSet[_T]):
del self.__container[value]
def move_to_end(self, value: _T, last: bool = True) -> None:
# Mypy does not know about move_to_end, because it is not part of MutableMapping
self.__container.move_to_end(value, last) # type: ignore
self.__container.move_to_end(value, last)
def pop(self, last: bool = True) -> _T:
# Mypy does not know about the last argument, because it is not part of MutableMapping
item, _ = self.__container.popitem(last) # type: ignore
item, _ = self.__container.popitem(last)
return item
def update(self, iterable: T.Iterable[_T]) -> None:

@ -3186,11 +3186,6 @@ class AllPlatformTests(BasePlatformTests):
expected_lines = expected.split('\n')[1:]
out_start = out.find(expected_lines[0])
out_lines = out[out_start:].split('\n')[:len(expected_lines)]
if sys.version_info < (3, 7, 0):
# Dictionary order is not stable in Python <3.7, so sort the lines
# while comparing
expected_lines = sorted(expected_lines)
out_lines = sorted(out_lines)
for e, o in zip(expected_lines, out_lines):
if e.startswith(' external dep'):
self.assertRegex(o, r'^ external dep : (YES [0-9.]*|NO)$')

Loading…
Cancel
Save