Skip to content

Commit edc0ecd

Browse files
authored
Remove Python 3.6 branches from typeshed (#8269)
1 parent 29c17ff commit edc0ecd

File tree

114 files changed

+1019
-2645
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1019
-2645
lines changed

stdlib/__future__.pyi

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sys
21
from typing_extensions import TypeAlias
32

43
_VersionInfo: TypeAlias = tuple[int, int, int, str, int]
@@ -18,9 +17,7 @@ unicode_literals: _Feature
1817
with_statement: _Feature
1918
barry_as_FLUFL: _Feature
2019
generator_stop: _Feature
21-
22-
if sys.version_info >= (3, 7):
23-
annotations: _Feature
20+
annotations: _Feature
2421

2522
all_feature_names: list[str] # undocumented
2623

@@ -35,7 +32,5 @@ __all__ = [
3532
"with_statement",
3633
"barry_as_FLUFL",
3734
"generator_stop",
35+
"annotations",
3836
]
39-
40-
if sys.version_info >= (3, 7):
41-
__all__ += ["annotations"]

stdlib/_curses.pyi

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ if sys.platform != "win32":
6060
A_DIM: int
6161
A_HORIZONTAL: int
6262
A_INVIS: int
63-
if sys.version_info >= (3, 7):
64-
A_ITALIC: int
63+
A_ITALIC: int
6564
A_LEFT: int
6665
A_LOW: int
6766
A_NORMAL: int

stdlib/_decimal.pyi

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ ROUND_FLOOR: str
2626
ROUND_UP: str
2727
ROUND_HALF_DOWN: str
2828
ROUND_05UP: str
29-
30-
if sys.version_info >= (3, 7):
31-
HAVE_CONTEXTVAR: bool
29+
HAVE_CONTEXTVAR: bool
3230
HAVE_THREADS: bool
3331
MAX_EMAX: int
3432
MAX_PREC: int

stdlib/_dummy_thread.pyi

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import sys
21
from collections.abc import Callable
32
from types import TracebackType
43
from typing import Any, NoReturn
54

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

117
TIMEOUT_MAX: int
128
error = RuntimeError
@@ -26,8 +22,7 @@ class LockType:
2622
def release(self) -> bool: ...
2723
def locked(self) -> bool: ...
2824

29-
if sys.version_info >= (3, 7):
30-
class RLock(LockType):
31-
def release(self) -> None: ... # type: ignore[override]
25+
class RLock(LockType):
26+
def release(self) -> None: ... # type: ignore[override]
3227

3328
def interrupt_main() -> None: ...

stdlib/_imp.pyi

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ from _typeshed import ReadableBuffer
44
from importlib.machinery import ModuleSpec
55
from typing import Any
66

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

9+
def source_hash(key: int, source: ReadableBuffer) -> bytes: ...
1110
def create_builtin(__spec: ModuleSpec) -> types.ModuleType: ...
1211
def create_dynamic(__spec: ModuleSpec, __file: Any = ...) -> types.ModuleType: ...
1312
def acquire_lock() -> None: ...

stdlib/_pydecimal.pyi

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import sys
2-
31
# This is a slight lie, the implementations aren't exactly identical
42
# However, in all likelihood, the differences are inconsequential
53
from _decimal import *
@@ -41,7 +39,5 @@ __all__ = [
4139
"MIN_EMIN",
4240
"MIN_ETINY",
4341
"HAVE_THREADS",
42+
"HAVE_CONTEXTVAR",
4443
]
45-
46-
if sys.version_info >= (3, 7):
47-
__all__ += ["HAVE_CONTEXTVAR"]

stdlib/_socket.pyi

+9-15
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ MSG_CTRUNC: int
176176
MSG_DONTROUTE: int
177177

178178
if sys.platform != "darwin":
179-
if sys.platform != "win32" or sys.version_info >= (3, 7):
180-
MSG_ERRQUEUE: int
179+
MSG_ERRQUEUE: int
181180

182181
MSG_OOB: int
183182
MSG_PEEK: int
@@ -218,15 +217,14 @@ if sys.platform == "linux" and sys.version_info >= (3, 11):
218217
SO_INCOMING_CPU: int
219218
TCP_FASTOPEN: int
220219
TCP_KEEPCNT: int
220+
TCP_KEEPINTVL: int
221221

222-
if sys.platform != "win32" or sys.version_info >= (3, 7):
223-
TCP_KEEPINTVL: int
224-
if sys.platform != "darwin":
225-
TCP_KEEPIDLE: int
222+
if sys.platform != "darwin":
223+
TCP_KEEPIDLE: int
226224

227225
TCP_MAXSEG: int
228226
TCP_NODELAY: int
229-
if sys.version_info >= (3, 7) and sys.platform != "win32":
227+
if sys.platform != "win32":
230228
TCP_NOTSENT_LOWAT: int
231229
if sys.version_info >= (3, 10) and sys.platform == "darwin":
232230
TCP_KEEPALIVE: int
@@ -368,7 +366,7 @@ if sys.platform == "linux" and sys.version_info >= (3, 8):
368366
CAN_BCM_RX_RTR_FRAME: int
369367
CAN_BCM_CAN_FD_FRAME: int
370368

371-
if sys.platform == "linux" and sys.version_info >= (3, 7):
369+
if sys.platform == "linux":
372370
CAN_ISOTP: int
373371

374372
if sys.platform == "linux" and sys.version_info >= (3, 9):
@@ -491,7 +489,7 @@ if sys.platform == "linux":
491489
ALG_SET_OP: int
492490
ALG_SET_PUBKEY: int
493491

494-
if sys.platform == "linux" and sys.version_info >= (3, 7):
492+
if sys.platform == "linux":
495493
AF_VSOCK: int
496494
IOCTL_VM_SOCKETS_GET_LOCAL_CID: int
497495
VMADDR_CID_ANY: int
@@ -598,9 +596,7 @@ class socket:
598596
def getsockopt(self, __level: int, __optname: int) -> int: ...
599597
@overload
600598
def getsockopt(self, __level: int, __optname: int, __buflen: int) -> bytes: ...
601-
if sys.version_info >= (3, 7):
602-
def getblocking(self) -> bool: ...
603-
599+
def getblocking(self) -> bool: ...
604600
def gettimeout(self) -> float | None: ...
605601
if sys.platform == "win32":
606602
def ioctl(self, __control: int, __option: int | tuple[int, int, int] | bool) -> None: ...
@@ -650,9 +646,7 @@ SocketType = socket
650646

651647
# ----- Functions -----
652648

653-
if sys.version_info >= (3, 7):
654-
def close(__fd: _FD) -> None: ...
655-
649+
def close(__fd: _FD) -> None: ...
656650
def dup(__fd: _FD) -> int: ...
657651

658652
# the 5th tuple item is an address

stdlib/_winapi.pyi

+17-24
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ from typing import Any, NoReturn, overload
44
from typing_extensions import Literal, final
55

66
if sys.platform == "win32":
7-
if sys.version_info >= (3, 7):
8-
ABOVE_NORMAL_PRIORITY_CLASS: Literal[32768]
9-
BELOW_NORMAL_PRIORITY_CLASS: Literal[16384]
10-
CREATE_BREAKAWAY_FROM_JOB: Literal[16777216]
11-
CREATE_DEFAULT_ERROR_MODE: Literal[67108864]
12-
CREATE_NO_WINDOW: Literal[134217728]
7+
ABOVE_NORMAL_PRIORITY_CLASS: Literal[32768]
8+
BELOW_NORMAL_PRIORITY_CLASS: Literal[16384]
9+
CREATE_BREAKAWAY_FROM_JOB: Literal[16777216]
10+
CREATE_DEFAULT_ERROR_MODE: Literal[67108864]
11+
CREATE_NO_WINDOW: Literal[134217728]
1312
CREATE_NEW_CONSOLE: Literal[16]
1413
CREATE_NEW_PROCESS_GROUP: Literal[512]
15-
if sys.version_info >= (3, 7):
16-
DETACHED_PROCESS: Literal[8]
14+
DETACHED_PROCESS: Literal[8]
1715
DUPLICATE_CLOSE_SOURCE: Literal[1]
1816
DUPLICATE_SAME_ACCESS: Literal[2]
1917

@@ -39,24 +37,21 @@ if sys.platform == "win32":
3937
FILE_MAP_EXECUTE: Literal[32]
4038
FILE_MAP_READ: Literal[4]
4139
FILE_MAP_WRITE: Literal[2]
42-
if sys.version_info >= (3, 7):
43-
FILE_TYPE_CHAR: Literal[2]
44-
FILE_TYPE_DISK: Literal[1]
45-
FILE_TYPE_PIPE: Literal[3]
46-
FILE_TYPE_REMOTE: Literal[32768]
47-
FILE_TYPE_UNKNOWN: Literal[0]
40+
FILE_TYPE_CHAR: Literal[2]
41+
FILE_TYPE_DISK: Literal[1]
42+
FILE_TYPE_PIPE: Literal[3]
43+
FILE_TYPE_REMOTE: Literal[32768]
44+
FILE_TYPE_UNKNOWN: Literal[0]
4845

4946
GENERIC_READ: Literal[2147483648]
5047
GENERIC_WRITE: Literal[1073741824]
51-
if sys.version_info >= (3, 7):
52-
HIGH_PRIORITY_CLASS: Literal[128]
48+
HIGH_PRIORITY_CLASS: Literal[128]
5349
INFINITE: Literal[4294967295]
5450
if sys.version_info >= (3, 8):
5551
INVALID_HANDLE_VALUE: int # very large number
56-
if sys.version_info >= (3, 7):
57-
IDLE_PRIORITY_CLASS: Literal[64]
58-
NORMAL_PRIORITY_CLASS: Literal[32]
59-
REALTIME_PRIORITY_CLASS: Literal[256]
52+
IDLE_PRIORITY_CLASS: Literal[64]
53+
NORMAL_PRIORITY_CLASS: Literal[32]
54+
REALTIME_PRIORITY_CLASS: Literal[256]
6055
NMPWAIT_WAIT_FOREVER: Literal[4294967295]
6156

6257
if sys.version_info >= (3, 8):
@@ -158,10 +153,8 @@ if sys.platform == "win32":
158153
__options: int = ...,
159154
) -> int: ...
160155
def ExitProcess(__ExitCode: int) -> NoReturn: ...
161-
if sys.version_info >= (3, 7):
162-
def GetACP() -> int: ...
163-
def GetFileType(handle: int) -> int: ...
164-
156+
def GetACP() -> int: ...
157+
def GetFileType(handle: int) -> int: ...
165158
def GetCurrentProcess() -> int: ...
166159
def GetExitCodeProcess(__process: int) -> int: ...
167160
def GetLastError() -> int: ...

stdlib/argparse.pyi

+43-89
Original file line numberDiff line numberDiff line change
@@ -171,65 +171,35 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
171171
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore[misc]
172172
@overload
173173
def parse_args(self, *, namespace: _N) -> _N: ...
174-
if sys.version_info >= (3, 7):
175-
@overload
176-
def add_subparsers(
177-
self: _ArgumentParserT,
178-
*,
179-
title: str = ...,
180-
description: str | None = ...,
181-
prog: str = ...,
182-
action: type[Action] = ...,
183-
option_string: str = ...,
184-
dest: str | None = ...,
185-
required: bool = ...,
186-
help: str | None = ...,
187-
metavar: str | None = ...,
188-
) -> _SubParsersAction[_ArgumentParserT]: ...
189-
@overload
190-
def add_subparsers(
191-
self,
192-
*,
193-
title: str = ...,
194-
description: str | None = ...,
195-
prog: str = ...,
196-
parser_class: type[_ArgumentParserT],
197-
action: type[Action] = ...,
198-
option_string: str = ...,
199-
dest: str | None = ...,
200-
required: bool = ...,
201-
help: str | None = ...,
202-
metavar: str | None = ...,
203-
) -> _SubParsersAction[_ArgumentParserT]: ...
204-
else:
205-
@overload
206-
def add_subparsers(
207-
self: _ArgumentParserT,
208-
*,
209-
title: str = ...,
210-
description: str | None = ...,
211-
prog: str = ...,
212-
action: type[Action] = ...,
213-
option_string: str = ...,
214-
dest: str | None = ...,
215-
help: str | None = ...,
216-
metavar: str | None = ...,
217-
) -> _SubParsersAction[_ArgumentParserT]: ...
218-
@overload
219-
def add_subparsers(
220-
self,
221-
*,
222-
title: str = ...,
223-
description: str | None = ...,
224-
prog: str = ...,
225-
parser_class: type[_ArgumentParserT],
226-
action: type[Action] = ...,
227-
option_string: str = ...,
228-
dest: str | None = ...,
229-
help: str | None = ...,
230-
metavar: str | None = ...,
231-
) -> _SubParsersAction[_ArgumentParserT]: ...
232-
174+
@overload
175+
def add_subparsers(
176+
self: _ArgumentParserT,
177+
*,
178+
title: str = ...,
179+
description: str | None = ...,
180+
prog: str = ...,
181+
action: type[Action] = ...,
182+
option_string: str = ...,
183+
dest: str | None = ...,
184+
required: bool = ...,
185+
help: str | None = ...,
186+
metavar: str | None = ...,
187+
) -> _SubParsersAction[_ArgumentParserT]: ...
188+
@overload
189+
def add_subparsers(
190+
self,
191+
*,
192+
title: str = ...,
193+
description: str | None = ...,
194+
prog: str = ...,
195+
parser_class: type[_ArgumentParserT],
196+
action: type[Action] = ...,
197+
option_string: str = ...,
198+
dest: str | None = ...,
199+
required: bool = ...,
200+
help: str | None = ...,
201+
metavar: str | None = ...,
202+
) -> _SubParsersAction[_ArgumentParserT]: ...
233203
def print_usage(self, file: IO[str] | None = ...) -> None: ...
234204
def print_help(self, file: IO[str] | None = ...) -> None: ...
235205
def format_usage(self) -> str: ...
@@ -240,11 +210,10 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
240210
def convert_arg_line_to_args(self, arg_line: str) -> list[str]: ...
241211
def exit(self, status: int = ..., message: str | None = ...) -> NoReturn: ...
242212
def error(self, message: str) -> NoReturn: ...
243-
if sys.version_info >= (3, 7):
244-
def parse_intermixed_args(self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...) -> Namespace: ...
245-
def parse_known_intermixed_args(
246-
self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...
247-
) -> tuple[Namespace, list[str]]: ...
213+
def parse_intermixed_args(self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...) -> Namespace: ...
214+
def parse_known_intermixed_args(
215+
self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...
216+
) -> tuple[Namespace, list[str]]: ...
248217
# undocumented
249218
def _get_optional_actions(self) -> list[Action]: ...
250219
def _get_positional_actions(self) -> list[Action]: ...
@@ -478,37 +447,22 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
478447
_name_parser_map: dict[str, _ArgumentParserT]
479448
choices: dict[str, _ArgumentParserT]
480449
_choices_actions: list[Action]
481-
if sys.version_info >= (3, 7):
482-
def __init__(
483-
self,
484-
option_strings: Sequence[str],
485-
prog: str,
486-
parser_class: type[_ArgumentParserT],
487-
dest: str = ...,
488-
required: bool = ...,
489-
help: str | None = ...,
490-
metavar: str | tuple[str, ...] | None = ...,
491-
) -> None: ...
492-
else:
493-
def __init__(
494-
self,
495-
option_strings: Sequence[str],
496-
prog: str,
497-
parser_class: type[_ArgumentParserT],
498-
dest: str = ...,
499-
help: str | None = ...,
500-
metavar: str | tuple[str, ...] | None = ...,
501-
) -> None: ...
450+
def __init__(
451+
self,
452+
option_strings: Sequence[str],
453+
prog: str,
454+
parser_class: type[_ArgumentParserT],
455+
dest: str = ...,
456+
required: bool = ...,
457+
help: str | None = ...,
458+
metavar: str | tuple[str, ...] | None = ...,
459+
) -> None: ...
502460
# TODO: Type keyword args properly.
503461
def add_parser(self, name: str, **kwargs: Any) -> _ArgumentParserT: ...
504462
def _get_subactions(self) -> list[Action]: ...
505463

506464
# undocumented
507465
class ArgumentTypeError(Exception): ...
508466

509-
if sys.version_info < (3, 7):
510-
# undocumented
511-
def _ensure_value(namespace: Namespace, name: str, value: Any) -> Any: ...
512-
513467
# undocumented
514468
def _get_action_name(argument: Action | None) -> str | None: ...

0 commit comments

Comments
 (0)