Skip to content

Commit 2360485

Browse files
authored
Remove Python 3.7 branches (#11238)
1 parent 4e62577 commit 2360485

File tree

122 files changed

+1884
-3732
lines changed

Some content is hidden

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

122 files changed

+1884
-3732
lines changed

scripts/create_baseline_stubs.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@
1717
import subprocess
1818
import sys
1919
import urllib.parse
20+
from importlib.metadata import distribution
2021

2122
import aiohttp
2223
import termcolor
2324

24-
if sys.version_info >= (3, 8):
25-
from importlib.metadata import distribution
26-
2725
PYRIGHT_CONFIG = "pyrightconfig.stricter.json"
2826

2927

@@ -204,12 +202,11 @@ def main() -> None:
204202
#
205203
# The importlib.metadata module is used for projects whose name is different
206204
# from the runtime Python package name (example: PyYAML/yaml)
207-
if sys.version_info >= (3, 8):
208-
dist = distribution(project).read_text("top_level.txt")
209-
if dist is not None:
210-
packages = [name for name in dist.split() if not name.startswith("_")]
211-
if len(packages) == 1:
212-
package = packages[0]
205+
dist = distribution(project).read_text("top_level.txt")
206+
if dist is not None:
207+
packages = [name for name in dist.split() if not name.startswith("_")]
208+
if len(packages) == 1:
209+
package = packages[0]
213210
print(f'Using detected package "{package}" for project "{project}"', file=sys.stderr)
214211
print("Suggestion: Try again with --package argument if that's not what you wanted", file=sys.stderr)
215212

stdlib/_ast.pyi

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ from typing import Any, ClassVar
44
from typing_extensions import Literal
55

66
PyCF_ONLY_AST: Literal[1024]
7-
if sys.version_info >= (3, 8):
8-
PyCF_TYPE_COMMENTS: Literal[4096]
9-
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
7+
PyCF_TYPE_COMMENTS: Literal[4096]
8+
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
109

1110
_Identifier: typing_extensions.TypeAlias = str
1211

@@ -19,33 +18,29 @@ class AST:
1918
# TODO: Not all nodes have all of the following attributes
2019
lineno: int
2120
col_offset: int
22-
if sys.version_info >= (3, 8):
23-
end_lineno: int | None
24-
end_col_offset: int | None
25-
type_comment: str | None
21+
end_lineno: int | None
22+
end_col_offset: int | None
23+
type_comment: str | None
2624

2725
class mod(AST): ...
26+
class type_ignore(AST): ...
2827

29-
if sys.version_info >= (3, 8):
30-
class type_ignore(AST): ...
31-
32-
class TypeIgnore(type_ignore):
33-
if sys.version_info >= (3, 10):
34-
__match_args__ = ("lineno", "tag")
35-
tag: str
28+
class TypeIgnore(type_ignore):
29+
if sys.version_info >= (3, 10):
30+
__match_args__ = ("lineno", "tag")
31+
tag: str
3632

37-
class FunctionType(mod):
38-
if sys.version_info >= (3, 10):
39-
__match_args__ = ("argtypes", "returns")
40-
argtypes: list[expr]
41-
returns: expr
33+
class FunctionType(mod):
34+
if sys.version_info >= (3, 10):
35+
__match_args__ = ("argtypes", "returns")
36+
argtypes: list[expr]
37+
returns: expr
4238

4339
class Module(mod):
4440
if sys.version_info >= (3, 10):
4541
__match_args__ = ("body", "type_ignores")
4642
body: list[stmt]
47-
if sys.version_info >= (3, 8):
48-
type_ignores: list[TypeIgnore]
43+
type_ignores: list[TypeIgnore]
4944

5045
class Interactive(mod):
5146
if sys.version_info >= (3, 10):
@@ -340,21 +335,6 @@ class JoinedStr(expr):
340335
__match_args__ = ("values",)
341336
values: list[expr]
342337

343-
if sys.version_info < (3, 8):
344-
class Num(expr): # Deprecated in 3.8; use Constant
345-
n: int | float | complex
346-
347-
class Str(expr): # Deprecated in 3.8; use Constant
348-
s: str
349-
350-
class Bytes(expr): # Deprecated in 3.8; use Constant
351-
s: bytes
352-
353-
class NameConstant(expr): # Deprecated in 3.8; use Constant
354-
value: Any
355-
356-
class Ellipsis(expr): ... # Deprecated in 3.8; use Constant
357-
358338
class Constant(expr):
359339
if sys.version_info >= (3, 10):
360340
__match_args__ = ("value", "kind")
@@ -364,12 +344,11 @@ class Constant(expr):
364344
s: Any
365345
n: int | float | complex
366346

367-
if sys.version_info >= (3, 8):
368-
class NamedExpr(expr):
369-
if sys.version_info >= (3, 10):
370-
__match_args__ = ("target", "value")
371-
target: Name
372-
value: expr
347+
class NamedExpr(expr):
348+
if sys.version_info >= (3, 10):
349+
__match_args__ = ("target", "value")
350+
target: Name
351+
value: expr
373352

374353
class Attribute(expr):
375354
if sys.version_info >= (3, 10):
@@ -498,8 +477,7 @@ class ExceptHandler(excepthandler):
498477
class arguments(AST):
499478
if sys.version_info >= (3, 10):
500479
__match_args__ = ("posonlyargs", "args", "vararg", "kwonlyargs", "kw_defaults", "kwarg", "defaults")
501-
if sys.version_info >= (3, 8):
502-
posonlyargs: list[arg]
480+
posonlyargs: list[arg]
503481
args: list[arg]
504482
vararg: arg | None
505483
kwonlyargs: list[arg]

stdlib/_codecs.pyi

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ else:
9999
def unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
100100

101101
def unicode_escape_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
102-
103-
if sys.version_info < (3, 8):
104-
def unicode_internal_decode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
105-
def unicode_internal_encode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[bytes, int]: ...
106-
107102
def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
108103
def utf_16_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
109104
def utf_16_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...

stdlib/_curses.pyi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,10 @@ if sys.platform != "win32":
548548
def vline(self, ch: _ChType, n: int) -> None: ...
549549
@overload
550550
def vline(self, y: int, x: int, ch: _ChType, n: int) -> None: ...
551-
if sys.version_info >= (3, 8):
552-
class _ncurses_version(NamedTuple):
553-
major: int
554-
minor: int
555-
patch: int
556-
ncurses_version: _ncurses_version
557-
window = _CursesWindow # undocumented
551+
552+
class _ncurses_version(NamedTuple):
553+
major: int
554+
minor: int
555+
patch: int
556+
ncurses_version: _ncurses_version
557+
window = _CursesWindow # undocumented

stdlib/_dummy_threading.pyi

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
from _thread import _excepthook, _ExceptHookArgs
23
from _typeshed import ProfileFunction, TraceFunction
34
from collections.abc import Callable, Iterable, Mapping
45
from types import TracebackType
@@ -28,11 +29,10 @@ __all__ = [
2829
"settrace",
2930
"local",
3031
"stack_size",
32+
"ExceptHookArgs",
33+
"excepthook",
3134
]
3235

33-
if sys.version_info >= (3, 8):
34-
__all__ += ["ExceptHookArgs", "excepthook"]
35-
3636
def active_count() -> int: ...
3737
def current_thread() -> Thread: ...
3838
def currentThread() -> Thread: ...
@@ -72,10 +72,8 @@ class Thread:
7272
def join(self, timeout: float | None = None) -> None: ...
7373
def getName(self) -> str: ...
7474
def setName(self, name: str) -> None: ...
75-
if sys.version_info >= (3, 8):
76-
@property
77-
def native_id(self) -> int | None: ... # only available on some platforms
78-
75+
@property
76+
def native_id(self) -> int | None: ... # only available on some platforms
7977
def is_alive(self) -> bool: ...
8078
if sys.version_info < (3, 9):
8179
def isAlive(self) -> bool: ...
@@ -138,11 +136,8 @@ class Event:
138136
def clear(self) -> None: ...
139137
def wait(self, timeout: float | None = None) -> bool: ...
140138

141-
if sys.version_info >= (3, 8):
142-
from _thread import _excepthook, _ExceptHookArgs
143-
144-
excepthook = _excepthook
145-
ExceptHookArgs = _ExceptHookArgs
139+
excepthook = _excepthook
140+
ExceptHookArgs = _ExceptHookArgs
146141

147142
class Timer(Thread):
148143
def __init__(

stdlib/_osx_support.pyi

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sys
21
from collections.abc import Iterable, Sequence
32
from typing import TypeVar
43

@@ -13,13 +12,7 @@ _COMPILER_CONFIG_VARS: tuple[str, ...] # undocumented
1312
_INITPRE: str # undocumented
1413

1514
def _find_executable(executable: str, path: str | None = None) -> str | None: ... # undocumented
16-
17-
if sys.version_info >= (3, 8):
18-
def _read_output(commandstring: str, capture_stderr: bool = False) -> str | None: ... # undocumented
19-
20-
else:
21-
def _read_output(commandstring: str) -> str | None: ... # undocumented
22-
15+
def _read_output(commandstring: str, capture_stderr: bool = False) -> str | None: ... # undocumented
2316
def _find_build_tool(toolname: str) -> str: ... # undocumented
2417

2518
_SYSTEM_VERSION: str | None # undocumented

0 commit comments

Comments
 (0)