Skip to content

Commit a5d03e2

Browse files
authored
Remove compatibility branches in test fixtures for dead Python versions (#14839)
1 parent bbc9cce commit a5d03e2

File tree

2 files changed

+67
-75
lines changed

2 files changed

+67
-75
lines changed
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import sys
2-
from typing import Generic, TypeVar, Callable, Iterator
3-
from typing import ContextManager as ContextManager
1+
from typing import AsyncIterator, Generic, TypeVar, Callable, Iterator
2+
from typing import ContextManager as ContextManager, AsyncContextManager as AsyncContextManager
43

54
_T = TypeVar('_T')
65

@@ -11,7 +10,4 @@ class GeneratorContextManager(ContextManager[_T], Generic[_T]):
1110
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., GeneratorContextManager[_T]]:
1211
...
1312

14-
if sys.version_info >= (3, 7):
15-
from typing import AsyncIterator
16-
from typing import AsyncContextManager as AsyncContextManager
17-
def asynccontextmanager(func: Callable[..., AsyncIterator[_T]]) -> Callable[..., AsyncContextManager[_T]]: ...
13+
def asynccontextmanager(func: Callable[..., AsyncIterator[_T]]) -> Callable[..., AsyncContextManager[_T]]: ...

test-data/unit/lib-stub/mypy_extensions.pyi

Lines changed: 64 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ from typing import (
33
Any, Dict, Type, TypeVar, Optional, Any, Generic, Mapping, NoReturn as NoReturn, Iterator,
44
Union, Protocol
55
)
6-
import sys
76

87
_T = TypeVar('_T')
98
_U = TypeVar('_U')
@@ -33,8 +32,6 @@ class _TypedDict(Mapping[str, object]):
3332
# Mypy expects that 'default' has a type variable type.
3433
def pop(self, k: NoReturn, default: _T = ...) -> object: ...
3534
def update(self: _T, __m: _T) -> None: ...
36-
if sys.version_info < (3, 0):
37-
def has_key(self, k: str) -> bool: ...
3835
def __delitem__(self, k: NoReturn) -> None: ...
3936

4037
def TypedDict(typename: str, fields: Dict[str, Type[_T]], *, total: Any = ...) -> Type[dict]: ...
@@ -50,68 +47,67 @@ mypyc_attr: Any
5047

5148
class FlexibleAlias(Generic[_T, _U]): ...
5249

53-
if sys.version_info >= (3, 0):
54-
class __SupportsInt(Protocol[T_co]):
55-
def __int__(self) -> int: pass
56-
57-
_Int = Union[int, i32, i64]
58-
59-
class i32:
60-
def __init__(self, x: Union[_Int, str, bytes, SupportsInt], base: int = 10) -> None: ...
61-
def __add__(self, x: i32) -> i32: ...
62-
def __radd__(self, x: i32) -> i32: ...
63-
def __sub__(self, x: i32) -> i32: ...
64-
def __rsub__(self, x: i32) -> i32: ...
65-
def __mul__(self, x: i32) -> i32: ...
66-
def __rmul__(self, x: i32) -> i32: ...
67-
def __floordiv__(self, x: i32) -> i32: ...
68-
def __rfloordiv__(self, x: i32) -> i32: ...
69-
def __mod__(self, x: i32) -> i32: ...
70-
def __rmod__(self, x: i32) -> i32: ...
71-
def __and__(self, x: i32) -> i32: ...
72-
def __rand__(self, x: i32) -> i32: ...
73-
def __or__(self, x: i32) -> i32: ...
74-
def __ror__(self, x: i32) -> i32: ...
75-
def __xor__(self, x: i32) -> i32: ...
76-
def __rxor__(self, x: i32) -> i32: ...
77-
def __lshift__(self, x: i32) -> i32: ...
78-
def __rlshift__(self, x: i32) -> i32: ...
79-
def __rshift__(self, x: i32) -> i32: ...
80-
def __rrshift__(self, x: i32) -> i32: ...
81-
def __neg__(self) -> i32: ...
82-
def __invert__(self) -> i32: ...
83-
def __pos__(self) -> i32: ...
84-
def __lt__(self, x: i32) -> bool: ...
85-
def __le__(self, x: i32) -> bool: ...
86-
def __ge__(self, x: i32) -> bool: ...
87-
def __gt__(self, x: i32) -> bool: ...
88-
89-
class i64:
90-
def __init__(self, x: Union[_Int, str, bytes, SupportsInt], base: int = 10) -> None: ...
91-
def __add__(self, x: i64) -> i64: ...
92-
def __radd__(self, x: i64) -> i64: ...
93-
def __sub__(self, x: i64) -> i64: ...
94-
def __rsub__(self, x: i64) -> i64: ...
95-
def __mul__(self, x: i64) -> i64: ...
96-
def __rmul__(self, x: i64) -> i64: ...
97-
def __floordiv__(self, x: i64) -> i64: ...
98-
def __rfloordiv__(self, x: i64) -> i64: ...
99-
def __mod__(self, x: i64) -> i64: ...
100-
def __rmod__(self, x: i64) -> i64: ...
101-
def __and__(self, x: i64) -> i64: ...
102-
def __rand__(self, x: i64) -> i64: ...
103-
def __or__(self, x: i64) -> i64: ...
104-
def __ror__(self, x: i64) -> i64: ...
105-
def __xor__(self, x: i64) -> i64: ...
106-
def __rxor__(self, x: i64) -> i64: ...
107-
def __lshift__(self, x: i64) -> i64: ...
108-
def __rlshift__(self, x: i64) -> i64: ...
109-
def __rshift__(self, x: i64) -> i64: ...
110-
def __rrshift__(self, x: i64) -> i64: ...
111-
def __neg__(self) -> i64: ...
112-
def __invert__(self) -> i64: ...
113-
def __pos__(self) -> i64: ...
114-
def __lt__(self, x: i64) -> bool: ...
115-
def __le__(self, x: i64) -> bool: ...
116-
def __ge__(self, x: i64) -> bool: ...
117-
def __gt__(self, x: i64) -> bool: ...
50+
class __SupportsInt(Protocol[T_co]):
51+
def __int__(self) -> int: pass
52+
53+
_Int = Union[int, i32, i64]
54+
55+
class i32:
56+
def __init__(self, x: Union[_Int, str, bytes, SupportsInt], base: int = 10) -> None: ...
57+
def __add__(self, x: i32) -> i32: ...
58+
def __radd__(self, x: i32) -> i32: ...
59+
def __sub__(self, x: i32) -> i32: ...
60+
def __rsub__(self, x: i32) -> i32: ...
61+
def __mul__(self, x: i32) -> i32: ...
62+
def __rmul__(self, x: i32) -> i32: ...
63+
def __floordiv__(self, x: i32) -> i32: ...
64+
def __rfloordiv__(self, x: i32) -> i32: ...
65+
def __mod__(self, x: i32) -> i32: ...
66+
def __rmod__(self, x: i32) -> i32: ...
67+
def __and__(self, x: i32) -> i32: ...
68+
def __rand__(self, x: i32) -> i32: ...
69+
def __or__(self, x: i32) -> i32: ...
70+
def __ror__(self, x: i32) -> i32: ...
71+
def __xor__(self, x: i32) -> i32: ...
72+
def __rxor__(self, x: i32) -> i32: ...
73+
def __lshift__(self, x: i32) -> i32: ...
74+
def __rlshift__(self, x: i32) -> i32: ...
75+
def __rshift__(self, x: i32) -> i32: ...
76+
def __rrshift__(self, x: i32) -> i32: ...
77+
def __neg__(self) -> i32: ...
78+
def __invert__(self) -> i32: ...
79+
def __pos__(self) -> i32: ...
80+
def __lt__(self, x: i32) -> bool: ...
81+
def __le__(self, x: i32) -> bool: ...
82+
def __ge__(self, x: i32) -> bool: ...
83+
def __gt__(self, x: i32) -> bool: ...
84+
85+
class i64:
86+
def __init__(self, x: Union[_Int, str, bytes, SupportsInt], base: int = 10) -> None: ...
87+
def __add__(self, x: i64) -> i64: ...
88+
def __radd__(self, x: i64) -> i64: ...
89+
def __sub__(self, x: i64) -> i64: ...
90+
def __rsub__(self, x: i64) -> i64: ...
91+
def __mul__(self, x: i64) -> i64: ...
92+
def __rmul__(self, x: i64) -> i64: ...
93+
def __floordiv__(self, x: i64) -> i64: ...
94+
def __rfloordiv__(self, x: i64) -> i64: ...
95+
def __mod__(self, x: i64) -> i64: ...
96+
def __rmod__(self, x: i64) -> i64: ...
97+
def __and__(self, x: i64) -> i64: ...
98+
def __rand__(self, x: i64) -> i64: ...
99+
def __or__(self, x: i64) -> i64: ...
100+
def __ror__(self, x: i64) -> i64: ...
101+
def __xor__(self, x: i64) -> i64: ...
102+
def __rxor__(self, x: i64) -> i64: ...
103+
def __lshift__(self, x: i64) -> i64: ...
104+
def __rlshift__(self, x: i64) -> i64: ...
105+
def __rshift__(self, x: i64) -> i64: ...
106+
def __rrshift__(self, x: i64) -> i64: ...
107+
def __neg__(self) -> i64: ...
108+
def __invert__(self) -> i64: ...
109+
def __pos__(self) -> i64: ...
110+
def __lt__(self, x: i64) -> bool: ...
111+
def __le__(self, x: i64) -> bool: ...
112+
def __ge__(self, x: i64) -> bool: ...
113+
def __gt__(self, x: i64) -> bool: ...

0 commit comments

Comments
 (0)