Skip to content

Commit

Permalink
Remove compatibility branches in test fixtures for dead Python versio…
Browse files Browse the repository at this point in the history
…ns (#14839)
  • Loading branch information
AlexWaygood committed Mar 6, 2023
1 parent bbc9cce commit a5d03e2
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 75 deletions.
10 changes: 3 additions & 7 deletions test-data/unit/lib-stub/contextlib.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
from typing import Generic, TypeVar, Callable, Iterator
from typing import ContextManager as ContextManager
from typing import AsyncIterator, Generic, TypeVar, Callable, Iterator
from typing import ContextManager as ContextManager, AsyncContextManager as AsyncContextManager

_T = TypeVar('_T')

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

if sys.version_info >= (3, 7):
from typing import AsyncIterator
from typing import AsyncContextManager as AsyncContextManager
def asynccontextmanager(func: Callable[..., AsyncIterator[_T]]) -> Callable[..., AsyncContextManager[_T]]: ...
def asynccontextmanager(func: Callable[..., AsyncIterator[_T]]) -> Callable[..., AsyncContextManager[_T]]: ...
132 changes: 64 additions & 68 deletions test-data/unit/lib-stub/mypy_extensions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ from typing import (
Any, Dict, Type, TypeVar, Optional, Any, Generic, Mapping, NoReturn as NoReturn, Iterator,
Union, Protocol
)
import sys

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

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

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

if sys.version_info >= (3, 0):
class __SupportsInt(Protocol[T_co]):
def __int__(self) -> int: pass

_Int = Union[int, i32, i64]

class i32:
def __init__(self, x: Union[_Int, str, bytes, SupportsInt], base: int = 10) -> None: ...
def __add__(self, x: i32) -> i32: ...
def __radd__(self, x: i32) -> i32: ...
def __sub__(self, x: i32) -> i32: ...
def __rsub__(self, x: i32) -> i32: ...
def __mul__(self, x: i32) -> i32: ...
def __rmul__(self, x: i32) -> i32: ...
def __floordiv__(self, x: i32) -> i32: ...
def __rfloordiv__(self, x: i32) -> i32: ...
def __mod__(self, x: i32) -> i32: ...
def __rmod__(self, x: i32) -> i32: ...
def __and__(self, x: i32) -> i32: ...
def __rand__(self, x: i32) -> i32: ...
def __or__(self, x: i32) -> i32: ...
def __ror__(self, x: i32) -> i32: ...
def __xor__(self, x: i32) -> i32: ...
def __rxor__(self, x: i32) -> i32: ...
def __lshift__(self, x: i32) -> i32: ...
def __rlshift__(self, x: i32) -> i32: ...
def __rshift__(self, x: i32) -> i32: ...
def __rrshift__(self, x: i32) -> i32: ...
def __neg__(self) -> i32: ...
def __invert__(self) -> i32: ...
def __pos__(self) -> i32: ...
def __lt__(self, x: i32) -> bool: ...
def __le__(self, x: i32) -> bool: ...
def __ge__(self, x: i32) -> bool: ...
def __gt__(self, x: i32) -> bool: ...

class i64:
def __init__(self, x: Union[_Int, str, bytes, SupportsInt], base: int = 10) -> None: ...
def __add__(self, x: i64) -> i64: ...
def __radd__(self, x: i64) -> i64: ...
def __sub__(self, x: i64) -> i64: ...
def __rsub__(self, x: i64) -> i64: ...
def __mul__(self, x: i64) -> i64: ...
def __rmul__(self, x: i64) -> i64: ...
def __floordiv__(self, x: i64) -> i64: ...
def __rfloordiv__(self, x: i64) -> i64: ...
def __mod__(self, x: i64) -> i64: ...
def __rmod__(self, x: i64) -> i64: ...
def __and__(self, x: i64) -> i64: ...
def __rand__(self, x: i64) -> i64: ...
def __or__(self, x: i64) -> i64: ...
def __ror__(self, x: i64) -> i64: ...
def __xor__(self, x: i64) -> i64: ...
def __rxor__(self, x: i64) -> i64: ...
def __lshift__(self, x: i64) -> i64: ...
def __rlshift__(self, x: i64) -> i64: ...
def __rshift__(self, x: i64) -> i64: ...
def __rrshift__(self, x: i64) -> i64: ...
def __neg__(self) -> i64: ...
def __invert__(self) -> i64: ...
def __pos__(self) -> i64: ...
def __lt__(self, x: i64) -> bool: ...
def __le__(self, x: i64) -> bool: ...
def __ge__(self, x: i64) -> bool: ...
def __gt__(self, x: i64) -> bool: ...
class __SupportsInt(Protocol[T_co]):
def __int__(self) -> int: pass

_Int = Union[int, i32, i64]

class i32:
def __init__(self, x: Union[_Int, str, bytes, SupportsInt], base: int = 10) -> None: ...
def __add__(self, x: i32) -> i32: ...
def __radd__(self, x: i32) -> i32: ...
def __sub__(self, x: i32) -> i32: ...
def __rsub__(self, x: i32) -> i32: ...
def __mul__(self, x: i32) -> i32: ...
def __rmul__(self, x: i32) -> i32: ...
def __floordiv__(self, x: i32) -> i32: ...
def __rfloordiv__(self, x: i32) -> i32: ...
def __mod__(self, x: i32) -> i32: ...
def __rmod__(self, x: i32) -> i32: ...
def __and__(self, x: i32) -> i32: ...
def __rand__(self, x: i32) -> i32: ...
def __or__(self, x: i32) -> i32: ...
def __ror__(self, x: i32) -> i32: ...
def __xor__(self, x: i32) -> i32: ...
def __rxor__(self, x: i32) -> i32: ...
def __lshift__(self, x: i32) -> i32: ...
def __rlshift__(self, x: i32) -> i32: ...
def __rshift__(self, x: i32) -> i32: ...
def __rrshift__(self, x: i32) -> i32: ...
def __neg__(self) -> i32: ...
def __invert__(self) -> i32: ...
def __pos__(self) -> i32: ...
def __lt__(self, x: i32) -> bool: ...
def __le__(self, x: i32) -> bool: ...
def __ge__(self, x: i32) -> bool: ...
def __gt__(self, x: i32) -> bool: ...

class i64:
def __init__(self, x: Union[_Int, str, bytes, SupportsInt], base: int = 10) -> None: ...
def __add__(self, x: i64) -> i64: ...
def __radd__(self, x: i64) -> i64: ...
def __sub__(self, x: i64) -> i64: ...
def __rsub__(self, x: i64) -> i64: ...
def __mul__(self, x: i64) -> i64: ...
def __rmul__(self, x: i64) -> i64: ...
def __floordiv__(self, x: i64) -> i64: ...
def __rfloordiv__(self, x: i64) -> i64: ...
def __mod__(self, x: i64) -> i64: ...
def __rmod__(self, x: i64) -> i64: ...
def __and__(self, x: i64) -> i64: ...
def __rand__(self, x: i64) -> i64: ...
def __or__(self, x: i64) -> i64: ...
def __ror__(self, x: i64) -> i64: ...
def __xor__(self, x: i64) -> i64: ...
def __rxor__(self, x: i64) -> i64: ...
def __lshift__(self, x: i64) -> i64: ...
def __rlshift__(self, x: i64) -> i64: ...
def __rshift__(self, x: i64) -> i64: ...
def __rrshift__(self, x: i64) -> i64: ...
def __neg__(self) -> i64: ...
def __invert__(self) -> i64: ...
def __pos__(self) -> i64: ...
def __lt__(self, x: i64) -> bool: ...
def __le__(self, x: i64) -> bool: ...
def __ge__(self, x: i64) -> bool: ...
def __gt__(self, x: i64) -> bool: ...

0 comments on commit a5d03e2

Please sign in to comment.