Skip to content

Remove Python 3.7 branches #11238

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

Merged
merged 11 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 6 additions & 9 deletions scripts/create_baseline_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
import subprocess
import sys
import urllib.parse
from importlib.metadata import distribution

import aiohttp
import termcolor

if sys.version_info >= (3, 8):
from importlib.metadata import distribution

PYRIGHT_CONFIG = "pyrightconfig.stricter.json"


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

Expand Down
66 changes: 22 additions & 44 deletions stdlib/_ast.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ from typing import Any, ClassVar
from typing_extensions import Literal

PyCF_ONLY_AST: Literal[1024]
if sys.version_info >= (3, 8):
PyCF_TYPE_COMMENTS: Literal[4096]
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
PyCF_TYPE_COMMENTS: Literal[4096]
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]

_Identifier: typing_extensions.TypeAlias = str

Expand All @@ -19,33 +18,29 @@ class AST:
# TODO: Not all nodes have all of the following attributes
lineno: int
col_offset: int
if sys.version_info >= (3, 8):
end_lineno: int | None
end_col_offset: int | None
type_comment: str | None
end_lineno: int | None
end_col_offset: int | None
type_comment: str | None

class mod(AST): ...
class type_ignore(AST): ...

if sys.version_info >= (3, 8):
class type_ignore(AST): ...

class TypeIgnore(type_ignore):
if sys.version_info >= (3, 10):
__match_args__ = ("lineno", "tag")
tag: str
class TypeIgnore(type_ignore):
if sys.version_info >= (3, 10):
__match_args__ = ("lineno", "tag")
tag: str

class FunctionType(mod):
if sys.version_info >= (3, 10):
__match_args__ = ("argtypes", "returns")
argtypes: list[expr]
returns: expr
class FunctionType(mod):
if sys.version_info >= (3, 10):
__match_args__ = ("argtypes", "returns")
argtypes: list[expr]
returns: expr

class Module(mod):
if sys.version_info >= (3, 10):
__match_args__ = ("body", "type_ignores")
body: list[stmt]
if sys.version_info >= (3, 8):
type_ignores: list[TypeIgnore]
type_ignores: list[TypeIgnore]

class Interactive(mod):
if sys.version_info >= (3, 10):
Expand Down Expand Up @@ -340,21 +335,6 @@ class JoinedStr(expr):
__match_args__ = ("values",)
values: list[expr]

if sys.version_info < (3, 8):
class Num(expr): # Deprecated in 3.8; use Constant
n: int | float | complex

class Str(expr): # Deprecated in 3.8; use Constant
s: str

class Bytes(expr): # Deprecated in 3.8; use Constant
s: bytes

class NameConstant(expr): # Deprecated in 3.8; use Constant
value: Any

class Ellipsis(expr): ... # Deprecated in 3.8; use Constant

class Constant(expr):
if sys.version_info >= (3, 10):
__match_args__ = ("value", "kind")
Expand All @@ -364,12 +344,11 @@ class Constant(expr):
s: Any
n: int | float | complex

if sys.version_info >= (3, 8):
class NamedExpr(expr):
if sys.version_info >= (3, 10):
__match_args__ = ("target", "value")
target: Name
value: expr
class NamedExpr(expr):
if sys.version_info >= (3, 10):
__match_args__ = ("target", "value")
target: Name
value: expr

class Attribute(expr):
if sys.version_info >= (3, 10):
Expand Down Expand Up @@ -498,8 +477,7 @@ class ExceptHandler(excepthandler):
class arguments(AST):
if sys.version_info >= (3, 10):
__match_args__ = ("posonlyargs", "args", "vararg", "kwonlyargs", "kw_defaults", "kwarg", "defaults")
if sys.version_info >= (3, 8):
posonlyargs: list[arg]
posonlyargs: list[arg]
args: list[arg]
vararg: arg | None
kwonlyargs: list[arg]
Expand Down
5 changes: 0 additions & 5 deletions stdlib/_codecs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ else:
def unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...

def unicode_escape_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...

if sys.version_info < (3, 8):
def unicode_internal_decode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
def unicode_internal_encode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[bytes, int]: ...

def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
def utf_16_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
def utf_16_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
Expand Down
14 changes: 7 additions & 7 deletions stdlib/_curses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,10 @@ if sys.platform != "win32":
def vline(self, ch: _ChType, n: int) -> None: ...
@overload
def vline(self, y: int, x: int, ch: _ChType, n: int) -> None: ...
if sys.version_info >= (3, 8):
class _ncurses_version(NamedTuple):
major: int
minor: int
patch: int
ncurses_version: _ncurses_version
window = _CursesWindow # undocumented

class _ncurses_version(NamedTuple):
major: int
minor: int
patch: int
ncurses_version: _ncurses_version
window = _CursesWindow # undocumented
19 changes: 7 additions & 12 deletions stdlib/_dummy_threading.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from _thread import _excepthook, _ExceptHookArgs
from _typeshed import ProfileFunction, TraceFunction
from collections.abc import Callable, Iterable, Mapping
from types import TracebackType
Expand Down Expand Up @@ -28,11 +29,10 @@ __all__ = [
"settrace",
"local",
"stack_size",
"ExceptHookArgs",
"excepthook",
]

if sys.version_info >= (3, 8):
__all__ += ["ExceptHookArgs", "excepthook"]

def active_count() -> int: ...
def current_thread() -> Thread: ...
def currentThread() -> Thread: ...
Expand Down Expand Up @@ -72,10 +72,8 @@ class Thread:
def join(self, timeout: float | None = None) -> None: ...
def getName(self) -> str: ...
def setName(self, name: str) -> None: ...
if sys.version_info >= (3, 8):
@property
def native_id(self) -> int | None: ... # only available on some platforms

@property
def native_id(self) -> int | None: ... # only available on some platforms
def is_alive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...
Expand Down Expand Up @@ -138,11 +136,8 @@ class Event:
def clear(self) -> None: ...
def wait(self, timeout: float | None = None) -> bool: ...

if sys.version_info >= (3, 8):
from _thread import _excepthook, _ExceptHookArgs

excepthook = _excepthook
ExceptHookArgs = _ExceptHookArgs
excepthook = _excepthook
ExceptHookArgs = _ExceptHookArgs

class Timer(Thread):
def __init__(
Expand Down
9 changes: 1 addition & 8 deletions stdlib/_osx_support.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from collections.abc import Iterable, Sequence
from typing import TypeVar

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

def _find_executable(executable: str, path: str | None = None) -> str | None: ... # undocumented

if sys.version_info >= (3, 8):
def _read_output(commandstring: str, capture_stderr: bool = False) -> str | None: ... # undocumented

else:
def _read_output(commandstring: str) -> str | None: ... # undocumented

def _read_output(commandstring: str, capture_stderr: bool = False) -> str | None: ... # undocumented
def _find_build_tool(toolname: str) -> str: ... # undocumented

_SYSTEM_VERSION: str | None # undocumented
Expand Down
Loading