Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Python 3.6 branches from typeshed #8269

Merged
merged 6 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions stdlib/__future__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from typing_extensions import TypeAlias

_VersionInfo: TypeAlias = tuple[int, int, int, str, int]
Expand All @@ -18,9 +17,7 @@ unicode_literals: _Feature
with_statement: _Feature
barry_as_FLUFL: _Feature
generator_stop: _Feature

if sys.version_info >= (3, 7):
annotations: _Feature
annotations: _Feature

all_feature_names: list[str] # undocumented

Expand All @@ -35,7 +32,5 @@ __all__ = [
"with_statement",
"barry_as_FLUFL",
"generator_stop",
"annotations",
]

if sys.version_info >= (3, 7):
__all__ += ["annotations"]
3 changes: 1 addition & 2 deletions stdlib/_curses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ if sys.platform != "win32":
A_DIM: int
A_HORIZONTAL: int
A_INVIS: int
if sys.version_info >= (3, 7):
A_ITALIC: int
A_ITALIC: int
A_LEFT: int
A_LOW: int
A_NORMAL: int
Expand Down
4 changes: 1 addition & 3 deletions stdlib/_decimal.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ ROUND_FLOOR: str
ROUND_UP: str
ROUND_HALF_DOWN: str
ROUND_05UP: str

if sys.version_info >= (3, 7):
HAVE_CONTEXTVAR: bool
HAVE_CONTEXTVAR: bool
HAVE_THREADS: bool
MAX_EMAX: int
MAX_PREC: int
Expand Down
11 changes: 3 additions & 8 deletions stdlib/_dummy_thread.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import sys
from collections.abc import Callable
from types import TracebackType
from typing import Any, NoReturn

__all__ = ["error", "start_new_thread", "exit", "get_ident", "allocate_lock", "interrupt_main", "LockType"]

if sys.version_info >= (3, 7):
__all__ += ["RLock"]
__all__ = ["error", "start_new_thread", "exit", "get_ident", "allocate_lock", "interrupt_main", "LockType", "RLock"]

TIMEOUT_MAX: int
error = RuntimeError
Expand All @@ -26,8 +22,7 @@ class LockType:
def release(self) -> bool: ...
def locked(self) -> bool: ...

if sys.version_info >= (3, 7):
class RLock(LockType):
def release(self) -> None: ... # type: ignore[override]
class RLock(LockType):
def release(self) -> None: ... # type: ignore[override]

def interrupt_main() -> None: ...
5 changes: 2 additions & 3 deletions stdlib/_imp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ from _typeshed import ReadableBuffer
from importlib.machinery import ModuleSpec
from typing import Any

if sys.version_info >= (3, 7):
check_hash_based_pycs: str
def source_hash(key: int, source: ReadableBuffer) -> bytes: ...
check_hash_based_pycs: str

def source_hash(key: int, source: ReadableBuffer) -> bytes: ...
def create_builtin(__spec: ModuleSpec) -> types.ModuleType: ...
def create_dynamic(__spec: ModuleSpec, __file: Any = ...) -> types.ModuleType: ...
def acquire_lock() -> None: ...
Expand Down
6 changes: 1 addition & 5 deletions stdlib/_pydecimal.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

# This is a slight lie, the implementations aren't exactly identical
# However, in all likelihood, the differences are inconsequential
from _decimal import *
Expand Down Expand Up @@ -41,7 +39,5 @@ __all__ = [
"MIN_EMIN",
"MIN_ETINY",
"HAVE_THREADS",
"HAVE_CONTEXTVAR",
]

if sys.version_info >= (3, 7):
__all__ += ["HAVE_CONTEXTVAR"]
24 changes: 9 additions & 15 deletions stdlib/_socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ MSG_CTRUNC: int
MSG_DONTROUTE: int

if sys.platform != "darwin":
if sys.platform != "win32" or sys.version_info >= (3, 7):
MSG_ERRQUEUE: int
MSG_ERRQUEUE: int

MSG_OOB: int
MSG_PEEK: int
Expand Down Expand Up @@ -218,15 +217,14 @@ if sys.platform == "linux" and sys.version_info >= (3, 11):
SO_INCOMING_CPU: int
TCP_FASTOPEN: int
TCP_KEEPCNT: int
TCP_KEEPINTVL: int

if sys.platform != "win32" or sys.version_info >= (3, 7):
TCP_KEEPINTVL: int
if sys.platform != "darwin":
TCP_KEEPIDLE: int
if sys.platform != "darwin":
TCP_KEEPIDLE: int

TCP_MAXSEG: int
TCP_NODELAY: int
if sys.version_info >= (3, 7) and sys.platform != "win32":
if sys.platform != "win32":
TCP_NOTSENT_LOWAT: int
if sys.version_info >= (3, 10) and sys.platform == "darwin":
TCP_KEEPALIVE: int
Expand Down Expand Up @@ -368,7 +366,7 @@ if sys.platform == "linux" and sys.version_info >= (3, 8):
CAN_BCM_RX_RTR_FRAME: int
CAN_BCM_CAN_FD_FRAME: int

if sys.platform == "linux" and sys.version_info >= (3, 7):
if sys.platform == "linux":
CAN_ISOTP: int

if sys.platform == "linux" and sys.version_info >= (3, 9):
Expand Down Expand Up @@ -491,7 +489,7 @@ if sys.platform == "linux":
ALG_SET_OP: int
ALG_SET_PUBKEY: int

if sys.platform == "linux" and sys.version_info >= (3, 7):
if sys.platform == "linux":
AF_VSOCK: int
IOCTL_VM_SOCKETS_GET_LOCAL_CID: int
VMADDR_CID_ANY: int
Expand Down Expand Up @@ -598,9 +596,7 @@ class socket:
def getsockopt(self, __level: int, __optname: int) -> int: ...
@overload
def getsockopt(self, __level: int, __optname: int, __buflen: int) -> bytes: ...
if sys.version_info >= (3, 7):
def getblocking(self) -> bool: ...

def getblocking(self) -> bool: ...
def gettimeout(self) -> float | None: ...
if sys.platform == "win32":
def ioctl(self, __control: int, __option: int | tuple[int, int, int] | bool) -> None: ...
Expand Down Expand Up @@ -650,9 +646,7 @@ SocketType = socket

# ----- Functions -----

if sys.version_info >= (3, 7):
def close(__fd: _FD) -> None: ...

def close(__fd: _FD) -> None: ...
def dup(__fd: _FD) -> int: ...

# the 5th tuple item is an address
Expand Down
41 changes: 17 additions & 24 deletions stdlib/_winapi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ from typing import Any, NoReturn, overload
from typing_extensions import Literal, final

if sys.platform == "win32":
if sys.version_info >= (3, 7):
ABOVE_NORMAL_PRIORITY_CLASS: Literal[32768]
BELOW_NORMAL_PRIORITY_CLASS: Literal[16384]
CREATE_BREAKAWAY_FROM_JOB: Literal[16777216]
CREATE_DEFAULT_ERROR_MODE: Literal[67108864]
CREATE_NO_WINDOW: Literal[134217728]
ABOVE_NORMAL_PRIORITY_CLASS: Literal[32768]
BELOW_NORMAL_PRIORITY_CLASS: Literal[16384]
CREATE_BREAKAWAY_FROM_JOB: Literal[16777216]
CREATE_DEFAULT_ERROR_MODE: Literal[67108864]
CREATE_NO_WINDOW: Literal[134217728]
CREATE_NEW_CONSOLE: Literal[16]
CREATE_NEW_PROCESS_GROUP: Literal[512]
if sys.version_info >= (3, 7):
DETACHED_PROCESS: Literal[8]
DETACHED_PROCESS: Literal[8]
DUPLICATE_CLOSE_SOURCE: Literal[1]
DUPLICATE_SAME_ACCESS: Literal[2]

Expand All @@ -39,24 +37,21 @@ if sys.platform == "win32":
FILE_MAP_EXECUTE: Literal[32]
FILE_MAP_READ: Literal[4]
FILE_MAP_WRITE: Literal[2]
if sys.version_info >= (3, 7):
FILE_TYPE_CHAR: Literal[2]
FILE_TYPE_DISK: Literal[1]
FILE_TYPE_PIPE: Literal[3]
FILE_TYPE_REMOTE: Literal[32768]
FILE_TYPE_UNKNOWN: Literal[0]
FILE_TYPE_CHAR: Literal[2]
FILE_TYPE_DISK: Literal[1]
FILE_TYPE_PIPE: Literal[3]
FILE_TYPE_REMOTE: Literal[32768]
FILE_TYPE_UNKNOWN: Literal[0]

GENERIC_READ: Literal[2147483648]
GENERIC_WRITE: Literal[1073741824]
if sys.version_info >= (3, 7):
HIGH_PRIORITY_CLASS: Literal[128]
HIGH_PRIORITY_CLASS: Literal[128]
INFINITE: Literal[4294967295]
if sys.version_info >= (3, 8):
INVALID_HANDLE_VALUE: int # very large number
if sys.version_info >= (3, 7):
IDLE_PRIORITY_CLASS: Literal[64]
NORMAL_PRIORITY_CLASS: Literal[32]
REALTIME_PRIORITY_CLASS: Literal[256]
IDLE_PRIORITY_CLASS: Literal[64]
NORMAL_PRIORITY_CLASS: Literal[32]
REALTIME_PRIORITY_CLASS: Literal[256]
NMPWAIT_WAIT_FOREVER: Literal[4294967295]

if sys.version_info >= (3, 8):
Expand Down Expand Up @@ -158,10 +153,8 @@ if sys.platform == "win32":
__options: int = ...,
) -> int: ...
def ExitProcess(__ExitCode: int) -> NoReturn: ...
if sys.version_info >= (3, 7):
def GetACP() -> int: ...
def GetFileType(handle: int) -> int: ...

def GetACP() -> int: ...
def GetFileType(handle: int) -> int: ...
def GetCurrentProcess() -> int: ...
def GetExitCodeProcess(__process: int) -> int: ...
def GetLastError() -> int: ...
Expand Down
132 changes: 43 additions & 89 deletions stdlib/argparse.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -171,65 +171,35 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore[misc]
@overload
def parse_args(self, *, namespace: _N) -> _N: ...
if sys.version_info >= (3, 7):
@overload
def add_subparsers(
self: _ArgumentParserT,
*,
title: str = ...,
description: str | None = ...,
prog: str = ...,
action: type[Action] = ...,
option_string: str = ...,
dest: str | None = ...,
required: bool = ...,
help: str | None = ...,
metavar: str | None = ...,
) -> _SubParsersAction[_ArgumentParserT]: ...
@overload
def add_subparsers(
self,
*,
title: str = ...,
description: str | None = ...,
prog: str = ...,
parser_class: type[_ArgumentParserT],
action: type[Action] = ...,
option_string: str = ...,
dest: str | None = ...,
required: bool = ...,
help: str | None = ...,
metavar: str | None = ...,
) -> _SubParsersAction[_ArgumentParserT]: ...
else:
@overload
def add_subparsers(
self: _ArgumentParserT,
*,
title: str = ...,
description: str | None = ...,
prog: str = ...,
action: type[Action] = ...,
option_string: str = ...,
dest: str | None = ...,
help: str | None = ...,
metavar: str | None = ...,
) -> _SubParsersAction[_ArgumentParserT]: ...
@overload
def add_subparsers(
self,
*,
title: str = ...,
description: str | None = ...,
prog: str = ...,
parser_class: type[_ArgumentParserT],
action: type[Action] = ...,
option_string: str = ...,
dest: str | None = ...,
help: str | None = ...,
metavar: str | None = ...,
) -> _SubParsersAction[_ArgumentParserT]: ...

@overload
def add_subparsers(
self: _ArgumentParserT,
*,
title: str = ...,
description: str | None = ...,
prog: str = ...,
action: type[Action] = ...,
option_string: str = ...,
dest: str | None = ...,
required: bool = ...,
help: str | None = ...,
metavar: str | None = ...,
) -> _SubParsersAction[_ArgumentParserT]: ...
@overload
def add_subparsers(
self,
*,
title: str = ...,
description: str | None = ...,
prog: str = ...,
parser_class: type[_ArgumentParserT],
action: type[Action] = ...,
option_string: str = ...,
dest: str | None = ...,
required: bool = ...,
help: str | None = ...,
metavar: str | None = ...,
) -> _SubParsersAction[_ArgumentParserT]: ...
def print_usage(self, file: IO[str] | None = ...) -> None: ...
def print_help(self, file: IO[str] | None = ...) -> None: ...
def format_usage(self) -> str: ...
Expand All @@ -240,11 +210,10 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def convert_arg_line_to_args(self, arg_line: str) -> list[str]: ...
def exit(self, status: int = ..., message: str | None = ...) -> NoReturn: ...
def error(self, message: str) -> NoReturn: ...
if sys.version_info >= (3, 7):
def parse_intermixed_args(self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...) -> Namespace: ...
def parse_known_intermixed_args(
self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...
) -> tuple[Namespace, list[str]]: ...
def parse_intermixed_args(self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...) -> Namespace: ...
def parse_known_intermixed_args(
self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...
) -> tuple[Namespace, list[str]]: ...
# undocumented
def _get_optional_actions(self) -> list[Action]: ...
def _get_positional_actions(self) -> list[Action]: ...
Expand Down Expand Up @@ -478,37 +447,22 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
_name_parser_map: dict[str, _ArgumentParserT]
choices: dict[str, _ArgumentParserT]
_choices_actions: list[Action]
if sys.version_info >= (3, 7):
def __init__(
self,
option_strings: Sequence[str],
prog: str,
parser_class: type[_ArgumentParserT],
dest: str = ...,
required: bool = ...,
help: str | None = ...,
metavar: str | tuple[str, ...] | None = ...,
) -> None: ...
else:
def __init__(
self,
option_strings: Sequence[str],
prog: str,
parser_class: type[_ArgumentParserT],
dest: str = ...,
help: str | None = ...,
metavar: str | tuple[str, ...] | None = ...,
) -> None: ...
def __init__(
self,
option_strings: Sequence[str],
prog: str,
parser_class: type[_ArgumentParserT],
dest: str = ...,
required: bool = ...,
help: str | None = ...,
metavar: str | tuple[str, ...] | None = ...,
) -> None: ...
# TODO: Type keyword args properly.
def add_parser(self, name: str, **kwargs: Any) -> _ArgumentParserT: ...
def _get_subactions(self) -> list[Action]: ...

# undocumented
class ArgumentTypeError(Exception): ...

if sys.version_info < (3, 7):
# undocumented
def _ensure_value(namespace: Namespace, name: str, value: Any) -> Any: ...

# undocumented
def _get_action_name(argument: Action | None) -> str | None: ...
Loading