Import names from typing directly rather than importing module (#13761)

This commit is contained in:
Avasam
2025-04-12 19:10:09 +02:00
committed by GitHub
parent 7ffb7e0832
commit a045be8ed6
10 changed files with 43 additions and 34 deletions
+3 -4
View File
@@ -3,7 +3,6 @@
# See the README.md file in this directory for more information.
import sys
import typing_extensions
from collections.abc import Awaitable, Callable, Iterable, Sequence, Set as AbstractSet, Sized
from dataclasses import Field
from os import PathLike
@@ -23,7 +22,7 @@ from typing import (
final,
overload,
)
from typing_extensions import Buffer, LiteralString, TypeAlias
from typing_extensions import Buffer, LiteralString, Self as _Self, TypeAlias
_KT = TypeVar("_KT")
_KT_co = TypeVar("_KT_co", covariant=True)
@@ -329,9 +328,9 @@ class structseq(Generic[_T_co]):
# The second parameter will accept a dict of any kind without raising an exception,
# but only has any meaning if you supply it a dict where the keys are strings.
# https://github.com/python/typeshed/pull/6560#discussion_r767149830
def __new__(cls, sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> typing_extensions.Self: ...
def __new__(cls, sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> _Self: ...
if sys.version_info >= (3, 13):
def __replace__(self, **kwargs: Any) -> typing_extensions.Self: ...
def __replace__(self, **kwargs: Any) -> _Self: ...
# Superset of typing.AnyStr that also includes LiteralString
AnyOrLiteralStr = TypeVar("AnyOrLiteralStr", str, bytes, LiteralString) # noqa: Y001