diff --git a/stdlib/3/html/parser.pyi b/stdlib/3/html/parser.pyi index a72d1942a..102a2cc0e 100644 --- a/stdlib/3/html/parser.pyi +++ b/stdlib/3/html/parser.pyi @@ -5,11 +5,9 @@ import sys class HTMLParser(ParserBase): if sys.version_info >= (3, 5): def __init__(self, *, convert_charrefs: bool = ...) -> None: ... - elif sys.version_info >= (3, 4): + else: def __init__(self, strict: bool = ..., *, convert_charrefs: bool = ...) -> None: ... - else: - def __init__(self, strict: bool = ...) -> None: ... def feed(self, feed: str) -> None: ... def close(self) -> None: ... def reset(self) -> None: ... diff --git a/stdlib/3/inspect.pyi b/stdlib/3/inspect.pyi index ce84e895d..65e1f6c0d 100644 --- a/stdlib/3/inspect.pyi +++ b/stdlib/3/inspect.pyi @@ -98,37 +98,36 @@ def indentsize(line: str) -> int: ... # # Introspecting callables with the Signature object # -if sys.version_info >= (3, 3): - def signature(callable: Callable[..., Any], - *, - follow_wrapped: bool = ...) -> 'Signature': ... +def signature(callable: Callable[..., Any], + *, + follow_wrapped: bool = ...) -> 'Signature': ... - class Signature: - def __init__(self, - parameters: Optional[Sequence['Parameter']] = ..., - *, - return_annotation: Any = ...) -> None: ... - # TODO: can we be more specific here? - empty: object = ... +class Signature: + def __init__(self, + parameters: Optional[Sequence['Parameter']] = ..., + *, + return_annotation: Any = ...) -> None: ... + # TODO: can we be more specific here? + empty: object = ... - parameters: Mapping[str, 'Parameter'] + parameters: Mapping[str, 'Parameter'] - # TODO: can we be more specific here? - return_annotation: Any + # TODO: can we be more specific here? + return_annotation: Any - def bind(self, *args: Any, **kwargs: Any) -> 'BoundArguments': ... - def bind_partial(self, *args: Any, **kwargs: Any) -> 'BoundArguments': ... - def replace(self, - *, - parameters: Optional[Sequence['Parameter']] = ..., - return_annotation: Any = ...) -> 'Signature': ... + def bind(self, *args: Any, **kwargs: Any) -> 'BoundArguments': ... + def bind_partial(self, *args: Any, **kwargs: Any) -> 'BoundArguments': ... + def replace(self, + *, + parameters: Optional[Sequence['Parameter']] = ..., + return_annotation: Any = ...) -> 'Signature': ... - if sys.version_info >= (3, 5): - @classmethod - def from_callable(cls, - obj: Callable[..., Any], - *, - follow_wrapped: bool = ...) -> 'Signature': ... + if sys.version_info >= (3, 5): + @classmethod + def from_callable(cls, + obj: Callable[..., Any], + *, + follow_wrapped: bool = ...) -> 'Signature': ... # The name is the same as the enum's name in CPython class _ParameterKind: ... @@ -238,24 +237,21 @@ def formatargvalues(args: List[str], ) -> str: ... def getmro(cls: type) -> Tuple[type, ...]: ... -if sys.version_info >= (3, 2): - def getcallargs(func: Callable[..., Any], - *args: Any, - **kwds: Any) -> Dict[str, Any]: ... +def getcallargs(func: Callable[..., Any], + *args: Any, + **kwds: Any) -> Dict[str, Any]: ... -if sys.version_info >= (3, 3): - ClosureVars = NamedTuple('ClosureVars', [('nonlocals', Mapping[str, Any]), - ('globals', Mapping[str, Any]), - ('builtins', Mapping[str, Any]), - ('unbound', AbstractSet[str]), - ]) - def getclosurevars(func: Callable[..., Any]) -> ClosureVars: ... +ClosureVars = NamedTuple('ClosureVars', [('nonlocals', Mapping[str, Any]), + ('globals', Mapping[str, Any]), + ('builtins', Mapping[str, Any]), + ('unbound', AbstractSet[str]), + ]) +def getclosurevars(func: Callable[..., Any]) -> ClosureVars: ... -if sys.version_info >= (3, 4): - def unwrap(func: Callable[..., Any], - *, - stop: Callable[[Any], Any]) -> Any: ... +def unwrap(func: Callable[..., Any], + *, + stop: Callable[[Any], Any]) -> Any: ... # @@ -294,8 +290,7 @@ def trace(context: int = ...) -> List[FrameInfo]: ... # Fetching attributes statically # -if sys.version_info >= (3, 2): - def getattr_static(obj: object, attr: str, default: Optional[Any] = ...) -> Any: ... +def getattr_static(obj: object, attr: str, default: Optional[Any] = ...) -> Any: ... # @@ -305,12 +300,11 @@ if sys.version_info >= (3, 2): # TODO In the next two blocks of code, can we be more specific regarding the # type of the "enums"? -if sys.version_info >= (3, 2): - GEN_CREATED: str - GEN_RUNNING: str - GEN_SUSPENDED: str - GEN_CLOSED: str - def getgeneratorstate(generator: Generator[Any, Any, Any]) -> str: ... +GEN_CREATED: str +GEN_RUNNING: str +GEN_SUSPENDED: str +GEN_CLOSED: str +def getgeneratorstate(generator: Generator[Any, Any, Any]) -> str: ... if sys.version_info >= (3, 5): CORO_CREATED: str @@ -320,8 +314,7 @@ if sys.version_info >= (3, 5): # TODO can we be more specific than "object"? def getcoroutinestate(coroutine: object) -> str: ... -if sys.version_info >= (3, 3): - def getgeneratorlocals(generator: Generator[Any, Any, Any]) -> Dict[str, Any]: ... +def getgeneratorlocals(generator: Generator[Any, Any, Any]) -> Dict[str, Any]: ... if sys.version_info >= (3, 5): # TODO can we be more specific than "object"? diff --git a/stdlib/3/io.pyi b/stdlib/3/io.pyi index 2a3121dd5..701d496f8 100644 --- a/stdlib/3/io.pyi +++ b/stdlib/3/io.pyi @@ -20,13 +20,8 @@ _T = TypeVar('_T', bound='IOBase') open = builtins.open -if sys.version_info >= (3, 3): - BlockingIOError = builtins.BlockingIOError - class UnsupportedOperation(OSError, ValueError): ... -else: - class BlockingIOError(IOError): - characters_written: int - class UnsupportedOperation(IOError, ValueError): ... +BlockingIOError = builtins.BlockingIOError +class UnsupportedOperation(OSError, ValueError): ... class IOBase: def __iter__(self) -> Iterator[bytes]: ... @@ -46,25 +41,16 @@ class IOBase: def truncate(self, size: Optional[int] = ...) -> int: ... def writable(self) -> bool: ... def writelines(self, lines: Iterable[Union[bytes, bytearray]]) -> None: ... - if sys.version_info >= (3, 4): - def readline(self, size: int = ...) -> bytes: ... - def __del__(self) -> None: ... - else: - def readline(self, limit: int = ...) -> bytes: ... - if sys.version_info >= (3, 2): - @property - def closed(self) -> bool: ... - else: - def closed(self) -> bool: ... + def readline(self, size: int = ...) -> bytes: ... + def __del__(self) -> None: ... + @property + def closed(self) -> bool: ... class RawIOBase(IOBase): def readall(self) -> bytes: ... def readinto(self, b: bytearray) -> Optional[int]: ... def write(self, b: Union[bytes, bytearray]) -> Optional[int]: ... - if sys.version_info >= (3, 4): - def read(self, size: int = ...) -> Optional[bytes]: ... - else: - def read(self, n: int = ...) -> Optional[bytes]: ... + def read(self, size: int = ...) -> Optional[bytes]: ... class BufferedIOBase(IOBase): def detach(self) -> RawIOBase: ... @@ -72,28 +58,20 @@ class BufferedIOBase(IOBase): def write(self, b: Union[bytes, bytearray]) -> int: ... if sys.version_info >= (3, 5): def readinto1(self, b: _bytearray_like) -> int: ... - if sys.version_info >= (3, 4): - def read(self, size: Optional[int] = ...) -> bytes: ... - def read1(self, size: int = ...) -> bytes: ... - else: - def read(self, n: Optional[int] = ...) -> bytes: ... - def read1(self, n: int = ...) -> bytes: ... + def read(self, size: Optional[int] = ...) -> bytes: ... + def read1(self, size: int = ...) -> bytes: ... class FileIO(RawIOBase): mode = ... # type: str name = ... # type: Union[int, str] - if sys.version_info >= (3, 3): - def __init__( - self, - name: Union[str, bytes, int], - mode: str = ..., - closefd: bool = ..., - opener: Optional[Callable[[Union[int, str], str], int]] = ... - ) -> None: ... - else: - def __init__(self, name: Union[str, bytes, int], - mode: str = ..., closefd: bool = ...) -> None: ... + def __init__( + self, + name: Union[str, bytes, int], + mode: str = ..., + closefd: bool = ..., + opener: Optional[Callable[[Union[int, str], str], int]] = ... + ) -> None: ... # TODO should extend from BufferedIOBase class BytesIO(BinaryIO): @@ -103,8 +81,7 @@ class BytesIO(BinaryIO): # as a read-only property on IO[]. name: Any def getvalue(self) -> bytes: ... - if sys.version_info >= (3, 2): - def getbuffer(self) -> memoryview: ... + def getbuffer(self) -> memoryview: ... # copied from IOBase def __iter__(self) -> Iterator[bytes]: ... def __next__(self) -> bytes: ... @@ -125,34 +102,21 @@ class BytesIO(BinaryIO): # TODO should be the next line instead # def writelines(self, lines: List[Union[bytes, bytearray]]) -> None: ... def writelines(self, lines: Any) -> None: ... - if sys.version_info >= (3, 4): - def readline(self, size: int = ...) -> bytes: ... - def __del__(self) -> None: ... - else: - def readline(self, limit: int = ...): ... - if sys.version_info >= (3, 2): - closed = ... # type: bool - else: - def closed(self) -> bool: ... + def readline(self, size: int = ...) -> bytes: ... + def __del__(self) -> None: ... + closed = ... # type: bool # copied from BufferedIOBase def detach(self) -> RawIOBase: ... def readinto(self, b: _bytearray_like) -> int: ... def write(self, b: Union[bytes, bytearray]) -> int: ... if sys.version_info >= (3, 5): def readinto1(self, b: _bytearray_like) -> int: ... - if sys.version_info >= (3, 4): - def read(self, size: Optional[int] = ...) -> bytes: ... - def read1(self, size: int = ...) -> bytes: ... - else: - def read(self, n: Optional[int] = ...) -> bytes: ... - def read1(self, n: int = ...) -> bytes: ... + def read(self, size: Optional[int] = ...) -> bytes: ... + def read1(self, size: int = ...) -> bytes: ... class BufferedReader(BufferedIOBase): def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ... - if sys.version_info >= (3, 4): - def peek(self, size: int = ...) -> bytes: ... - else: - def peek(self, n: int = ...) -> bytes: ... + def peek(self, size: int = ...) -> bytes: ... class BufferedWriter(BufferedIOBase): def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ... @@ -177,31 +141,19 @@ class TextIOBase(IOBase): def __next__(self) -> str: ... # type: ignore def detach(self) -> IOBase: ... def write(self, s: str) -> int: ... - if sys.version_info >= (3, 4): - def readline(self, size: int = ...) -> str: ... # type: ignore - def read(self, size: Optional[int] = ...) -> str: ... - elif sys.version_info >= (3, 2): - def readline(self, limit: int = ...) -> str: ... # type: ignore - else: - def readline(self) -> str: ... - if sys.version_info >= (3, 2): - def seek(self, offset: int, whence: int = ...) -> int: ... - def tell(self) -> int: ... + def readline(self, size: int = ...) -> str: ... # type: ignore + def read(self, size: Optional[int] = ...) -> str: ... + def seek(self, offset: int, whence: int = ...) -> int: ... + def tell(self) -> int: ... # TODO should extend from TextIOBase class TextIOWrapper(TextIO): line_buffering = ... # type: bool # TODO uncomment after fixing mypy about using write_through - # if sys.version_info >= (3, 3): - # def __init__(self, buffer: IO[bytes], encoding: str = ..., - # errors: Optional[str] = ..., newline: Optional[str] = ..., - # line_buffering: bool = ..., write_through: bool = ...) \ - # -> None: ... - # else: - # def __init__(self, buffer: IO[bytes], - # encoding: str = ..., errors: Optional[str] = ..., - # newline: Optional[str] = ..., line_buffering: bool = ...) \ - # -> None: ... + # def __init__(self, buffer: IO[bytes], encoding: str = ..., + # errors: Optional[str] = ..., newline: Optional[str] = ..., + # line_buffering: bool = ..., write_through: bool = ...) \ + # -> None: ... def __init__( self, buffer: IO[bytes], @@ -226,12 +178,8 @@ class TextIOWrapper(TextIO): # TODO should be the next line instead # def writelines(self, lines: List[str]) -> None: ... def writelines(self, lines: Any) -> None: ... - if sys.version_info >= (3, 4): - def __del__(self) -> None: ... - if sys.version_info >= (3, 2): - closed = ... # type: bool - else: - def closed(self) -> bool: ... + def __del__(self) -> None: ... + closed = ... # type: bool # copied from TextIOBase encoding = ... # type: str errors = ... # type: Optional[str] @@ -241,17 +189,10 @@ class TextIOWrapper(TextIO): def __enter__(self) -> 'TextIO': ... def detach(self) -> IOBase: ... def write(self, s: str) -> int: ... - if sys.version_info >= (3, 4): - def readline(self, size: int = ...) -> str: ... - def read(self, size: Optional[int] = ...) -> str: ... - elif sys.version_info >= (3, 2): - def readline(self, limit: int = ...) -> str: ... - def read(self, size: Optional[int] = ...) -> str: ... - else: - def readline(self) -> str: ... - if sys.version_info >= (3, 2): - def seek(self, offset: int, whence: int = ...) -> int: ... - def tell(self) -> int: ... + def readline(self, size: int = ...) -> str: ... + def read(self, size: Optional[int] = ...) -> str: ... + def seek(self, offset: int, whence: int = ...) -> int: ... + def tell(self) -> int: ... class StringIO(TextIOWrapper): def __init__(self, initial_value: str = ..., diff --git a/stdlib/3/multiprocessing/__init__.pyi b/stdlib/3/multiprocessing/__init__.pyi index 2914c99f1..c5e1e6e08 100644 --- a/stdlib/3/multiprocessing/__init__.pyi +++ b/stdlib/3/multiprocessing/__init__.pyi @@ -76,10 +76,8 @@ def get_logger() -> Logger: ... def log_to_stderr(level: Optional[Union[str, int]] = ...) -> Logger: ... def Manager() -> SyncManager: ... def set_forkserver_preload(module_names: List[str]) -> None: ... -if sys.platform == 'win32' or sys.version_info >= (3, 4): - def set_executable(executable: str) -> None: ... -if sys.version_info >= (3, 4): - def get_all_start_methods() -> List[str]: ... - def get_context(method: Optional[str] = ...) -> BaseContext: ... - def get_start_method(allow_none: Optional[bool]) -> Optional[str]: ... - def set_start_method(method: str, force: Optional[bool] = ...) -> None: ... +def set_executable(executable: str) -> None: ... +def get_all_start_methods() -> List[str]: ... +def get_context(method: Optional[str] = ...) -> BaseContext: ... +def get_start_method(allow_none: Optional[bool]) -> Optional[str]: ... +def set_start_method(method: str, force: Optional[bool] = ...) -> None: ... diff --git a/stdlib/3/multiprocessing/connection.pyi b/stdlib/3/multiprocessing/connection.pyi index e12cba6cb..7627b5226 100644 --- a/stdlib/3/multiprocessing/connection.pyi +++ b/stdlib/3/multiprocessing/connection.pyi @@ -1,6 +1,5 @@ from typing import Any, Iterable, List, Optional, Tuple, Type, Union import socket -import sys import types # https://docs.python.org/3/library/multiprocessing.html#address-formats @@ -8,8 +7,7 @@ _Address = Union[str, Tuple[str, int]] def deliver_challenge(connection: Connection, authkey: bytes) -> None: ... def answer_challenge(connection: Connection, authkey: bytes) -> None: ... -if sys.version_info >= (3, 3): - def wait(object_list: Iterable[Union[Connection, socket.socket, int]], timeout: Optional[float] = ...) -> List[Union[Connection, socket.socket, int]]: ... +def wait(object_list: Iterable[Union[Connection, socket.socket, int]], timeout: Optional[float] = ...) -> List[Union[Connection, socket.socket, int]]: ... def Client(address: _Address, family: Optional[str] = ..., authkey: Optional[bytes] = ...) -> Connection: ... def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ... @@ -21,9 +19,8 @@ class Listener: def address(self) -> _Address: ... @property def last_accepted(self) -> Optional[_Address]: ... - if sys.version_info >= (3, 3): - def __enter__(self) -> Listener: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], exc_tb: Optional[types.TracebackType]) -> None: ... + def __enter__(self) -> Listener: ... + def __exit__(self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], exc_tb: Optional[types.TracebackType]) -> None: ... class Connection: def close(self) -> None: ... diff --git a/stdlib/3/multiprocessing/synchronize.pyi b/stdlib/3/multiprocessing/synchronize.pyi index 3b8f0fd86..9b226810e 100644 --- a/stdlib/3/multiprocessing/synchronize.pyi +++ b/stdlib/3/multiprocessing/synchronize.pyi @@ -28,10 +28,9 @@ class Condition(ContextManager[bool]): def notify(self) -> None: ... def notify_all(self) -> None: ... def wait(self, timeout: Optional[float] = ...) -> bool: ... - if sys.version_info >= (3, 3): - def wait_for(self, - predicate: Callable[[], bool], - timeout: Optional[float] = ...) -> bool: ... + def wait_for(self, + predicate: Callable[[], bool], + timeout: Optional[float] = ...) -> bool: ... def acquire(self, block: bool = ..., timeout: Optional[float] = ...) -> bool: ... diff --git a/stdlib/3/nntplib.pyi b/stdlib/3/nntplib.pyi index 1bf2f4196..00abdd994 100644 --- a/stdlib/3/nntplib.pyi +++ b/stdlib/3/nntplib.pyi @@ -3,7 +3,6 @@ import datetime import socket import ssl -import sys from typing import Any, Dict, IO, Iterable, List, NamedTuple, Optional, Tuple, TypeVar, Union _SelfT = TypeVar('_SelfT', bound=_NNTPBase) @@ -51,9 +50,8 @@ class _NNTPBase: def __init__(self, file: IO[bytes], host: str, readermode: Optional[bool] = ..., timeout: float = ...) -> None: ... - if sys.version_info >= (3, 3): - def __enter__(self: _SelfT) -> _SelfT: ... - def __exit__(self, *args: Any) -> None: ... + def __enter__(self: _SelfT) -> _SelfT: ... + def __exit__(self, *args: Any) -> None: ... def getwelcome(self) -> str: ... def getcapabilities(self) -> Dict[str, List[str]]: ... def set_debuglevel(self, level: int) -> None: ... diff --git a/stdlib/3/posix.pyi b/stdlib/3/posix.pyi index 059c31dc4..51fa9ea67 100644 --- a/stdlib/3/posix.pyi +++ b/stdlib/3/posix.pyi @@ -23,11 +23,9 @@ class stat_result: st_atime: float # time of most recent access, st_mtime: float # time of most recent content modification, st_ctime: float # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) - - if sys.version_info >= (3, 3): - st_atime_ns: int # time of most recent access, in nanoseconds - st_mtime_ns: int # time of most recent content modification in nanoseconds - st_ctime_ns: int # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) in nanoseconds + st_atime_ns: int # time of most recent access, in nanoseconds + st_mtime_ns: int # time of most recent content modification in nanoseconds + st_ctime_ns: int # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) in nanoseconds # not documented def __init__(self, tuple: Tuple[int, ...]) -> None: ... @@ -49,26 +47,25 @@ class stat_result: st_creator: int st_type: int -if sys.version_info >= (3, 3): - uname_result = NamedTuple('uname_result', [('sysname', str), ('nodename', str), - ('release', str), ('version', str), ('machine', str)]) +uname_result = NamedTuple('uname_result', [('sysname', str), ('nodename', str), + ('release', str), ('version', str), ('machine', str)]) - times_result = NamedTuple('times_result', [ - ('user', float), - ('system', float), - ('children_user', float), - ('children_system', float), - ('elapsed', float), - ]) +times_result = NamedTuple('times_result', [ + ('user', float), + ('system', float), + ('children_user', float), + ('children_system', float), + ('elapsed', float), +]) - waitid_result = NamedTuple('waitid_result', [ - ('si_pid', int), - ('si_uid', int), - ('si_signo', int), - ('si_status', int), - ('si_code', int), - ]) +waitid_result = NamedTuple('waitid_result', [ + ('si_pid', int), + ('si_uid', int), + ('si_signo', int), + ('si_status', int), + ('si_code', int), +]) - sched_param = NamedTuple('sched_priority', [ - ('sched_priority', int), - ]) +sched_param = NamedTuple('sched_priority', [ + ('sched_priority', int), +]) diff --git a/stdlib/3/stat.pyi b/stdlib/3/stat.pyi index 1ed7d6c02..c45a06863 100644 --- a/stdlib/3/stat.pyi +++ b/stdlib/3/stat.pyi @@ -16,8 +16,7 @@ def S_ISSOCK(mode: int) -> bool: ... def S_IMODE(mode: int) -> int: ... def S_IFMT(mode: int) -> int: ... -if sys.version_info >= (3, 3): - def filemode(mode: int) -> str: ... +def filemode(mode: int) -> str: ... ST_MODE = 0 ST_INO = 0 diff --git a/stdlib/3/symbol.pyi b/stdlib/3/symbol.pyi index 82f5e2c8f..f228cf7ba 100644 --- a/stdlib/3/symbol.pyi +++ b/stdlib/3/symbol.pyi @@ -92,7 +92,6 @@ comp_for = ... # type: int comp_if = ... # type: int encoding_decl = ... # type: int yield_expr = ... # type: int -if sys.version_info >= (3, 3): - yield_arg = ... # type: int +yield_arg = ... # type: int sym_name = ... # type: Dict[int, str] diff --git a/stdlib/3/sys.pyi b/stdlib/3/sys.pyi index 9874934b1..128be7ba0 100644 --- a/stdlib/3/sys.pyi +++ b/stdlib/3/sys.pyi @@ -10,10 +10,7 @@ from typing import ( import sys from types import FrameType, ModuleType, TracebackType -if sys.version_info >= (3, 3): - from importlib.abc import MetaPathFinder -else: - MetaPathFinder = Any +from importlib.abc import MetaPathFinder _T = TypeVar('_T') diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index 5512f7f26..b8ec829cc 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -47,8 +47,7 @@ Set = TypeAlias(object) FrozenSet = TypeAlias(object) Counter = TypeAlias(object) Deque = TypeAlias(object) -if sys.version_info >= (3, 3): - ChainMap = TypeAlias(object) +ChainMap = TypeAlias(object) # Predefined type variables. AnyStr = TypeVar('AnyStr', str, bytes) @@ -553,10 +552,7 @@ class NamedTuple(tuple): @classmethod def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ... - if sys.version_info >= (3, 1): - def _asdict(self) -> collections.OrderedDict[str, Any]: ... - else: - def _asdict(self) -> Dict[str, Any]: ... + def _asdict(self) -> collections.OrderedDict[str, Any]: ... def _replace(self: _T, **kwargs: Any) -> _T: ... def NewType(name: str, tp: Type[_T]) -> Type[_T]: ... diff --git a/stdlib/3/unittest/__init__.pyi b/stdlib/3/unittest/__init__.pyi index f78a9a4bd..5ef71a243 100644 --- a/stdlib/3/unittest/__init__.pyi +++ b/stdlib/3/unittest/__init__.pyi @@ -37,8 +37,7 @@ class TestCase: def tearDownClass(cls) -> None: ... def run(self, result: Optional[TestResult] = ...) -> TestCase: ... def skipTest(self, reason: Any) -> None: ... - if sys.version_info >= (3, 4): - def subTest(self, msg: Any = ..., **params: Any) -> ContextManager[None]: ... + def subTest(self, msg: Any = ..., **params: Any) -> ContextManager[None]: ... def debug(self) -> None: ... def assertEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... def assertNotEqual(self, first: Any, second: Any, @@ -103,11 +102,10 @@ class TestCase: def assertWarnsRegex(self, exception: Union[Type[Warning], Tuple[Type[Warning], ...]], msg: Any = ...) -> _AssertWarnsContext: ... - if sys.version_info >= (3, 4): - def assertLogs( - self, logger: Optional[logging.Logger] = ..., - level: Union[int, str, None] = ... - ) -> _AssertLogsContext: ... + def assertLogs( + self, logger: Optional[logging.Logger] = ..., + level: Union[int, str, None] = ... + ) -> _AssertLogsContext: ... def assertAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ..., delta: float = ...) -> None: ... def assertNotAlmostEqual(self, first: float, second: float, @@ -273,9 +271,8 @@ class TestResult: def addExpectedFailure(self, test: TestCase, err: _SysExcInfoType) -> None: ... def addUnexpectedSuccess(self, test: TestCase) -> None: ... - if sys.version_info >= (3, 4): - def addSubTest(self, test: TestCase, subtest: TestCase, - outcome: Optional[_SysExcInfoType]) -> None: ... + def addSubTest(self, test: TestCase, subtest: TestCase, + outcome: Optional[_SysExcInfoType]) -> None: ... class TextTestResult(TestResult): def __init__(self, stream: TextIO, descriptions: bool, @@ -306,16 +303,12 @@ class TextTestRunner(TestRunner): warnings: Optional[Type[Warning]] = ...) -> None: ... def _makeResult(self) -> TestResult: ... -if sys.version_info >= (3, 4): - _DefaultTestType = Union[str, Iterable[str], None] -else: - _DefaultTestType = Union[str, None] - # not really documented class TestProgram: result = ... # type: TestResult -def main(module: str = ..., defaultTest: _DefaultTestType = ..., +def main(module: str = ..., + defaultTest: Union[str, Iterable[str], None] = ..., argv: Optional[List[str]] = ..., testRunner: Union[Type[TestRunner], TestRunner, None] = ..., testLoader: TestLoader = ..., exit: bool = ..., verbosity: int = ..., diff --git a/stdlib/3/urllib/request.pyi b/stdlib/3/urllib/request.pyi index 299ba467a..dfedf4773 100644 --- a/stdlib/3/urllib/request.pyi +++ b/stdlib/3/urllib/request.pyi @@ -33,15 +33,12 @@ def parse_http_list(s: str) -> List[str]: ... def parse_keqv_list(l: List[str]) -> Dict[str, str]: ... class Request: - if sys.version_info >= (3, 4): - @property - def full_url(self) -> str: ... - @full_url.setter - def full_url(self, value: str) -> None: ... - @full_url.deleter - def full_url(self) -> None: ... - else: - full_url: str + @property + def full_url(self) -> str: ... + @full_url.setter + def full_url(self, value: str) -> None: ... + @full_url.deleter + def full_url(self) -> None: ... type: str host: str origin_req_host: str @@ -57,8 +54,7 @@ class Request: def add_header(self, key: str, val: str) -> None: ... def add_unredirected_header(self, key: str, val: str) -> None: ... def has_header(self, header_name: str) -> bool: ... - if sys.version_info >= (3, 4): - def remove_header(self, header_name: str) -> None: ... + def remove_header(self, header_name: str) -> None: ... def get_full_url(self) -> str: ... def set_proxy(self, host: str, type: str) -> None: ... @overload diff --git a/third_party/3/pkg_resources.pyi b/third_party/3/pkg_resources.pyi index 042f55fec..f0e1163ff 100644 --- a/third_party/3/pkg_resources.pyi +++ b/third_party/3/pkg_resources.pyi @@ -7,7 +7,6 @@ from typing import ( ) from abc import ABCMeta import importlib.abc -import sys import types import zipimport @@ -248,10 +247,7 @@ class ExtractionError(Exception): original_error = ... # type: Exception -if sys.version_info >= (3, 3): - class _Importer(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader, metaclass=ABCMeta): ... -else: - class _Importer(importlib.abc.InspectLoader, metaclass=ABCMeta): ... +class _Importer(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader, metaclass=ABCMeta): ... def register_finder(importer_type: type, distribution_finder: _DistFinderType) -> None: ... diff --git a/third_party/3/six/moves/__init__.pyi b/third_party/3/six/moves/__init__.pyi index be4a7c878..3d6efced3 100644 --- a/third_party/3/six/moves/__init__.pyi +++ b/third_party/3/six/moves/__init__.pyi @@ -66,7 +66,4 @@ from . import urllib_robotparser # import xmlrpc.client as xmlrpc_client # import xmlrpc.server as xmlrpc_server -if sys.version_info >= (3, 4): - from importlib import reload as reload_module -else: - from imp import reload as reload_module +from importlib import reload as reload_module