Third-party stubs: fix several fictitious type aliases (#7958)

This commit is contained in:
Alex Waygood
2022-05-26 14:26:26 +01:00
committed by GitHub
parent 597be79b18
commit fa636bc044
15 changed files with 69 additions and 73 deletions

View File

@@ -1,4 +1,6 @@
PIL.FpxImagePlugin
PIL.ImageQt.ImageQt
PIL.ImageQt.QImage # Does exist at runtime usually, but stubtest can't see it
PIL.ImageQt.QPixmap # Does exist at runtime usually, but stubtest can't see it
PIL.MicImagePlugin
PIL.WmfImagePlugin.WmfHandler

View File

@@ -1,10 +1,10 @@
from typing import Any
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias
from .Image import Image
QImage = Any # imported from either of {PyQt6,PySide6,PyQt5,PySide2}.QtGui
QPixmap = Any
QImage: TypeAlias = Any # imported from either of {PyQt6,PySide6,PyQt5,PySide2}.QtGui
QPixmap: TypeAlias = Any
qt_versions: Any
qt_is_installed: bool

View File

@@ -1,16 +1,16 @@
from typing import Any
from typing_extensions import TypeAlias
from ...util import symbol
ClassDef = Any # from mypy.nodes
Expression = Any # from mypy.nodes
MemberExpr = Any # from mypy.nodes
NameExpr = Any # from mypy.nodes
SymbolNode = Any # from mypy.nodes
TypeInfo = Any # from mypy.nodes
StrExpr = Any # from mypy.nodes
SemanticAnalyzerPluginInterface = Any # from mypy.plugin
UnboundType = Any # from mypy.types
ClassDef: TypeAlias = Any # from mypy.nodes
Expression: TypeAlias = Any # from mypy.nodes
MemberExpr: TypeAlias = Any # from mypy.nodes
NameExpr: TypeAlias = Any # from mypy.nodes
SymbolNode: TypeAlias = Any # from mypy.nodes
TypeInfo: TypeAlias = Any # from mypy.nodes
SemanticAnalyzerPluginInterface: TypeAlias = Any # from mypy.plugin
UnboundType: TypeAlias = Any # from mypy.types
COLUMN: symbol
RELATIONSHIP: symbol

View File

@@ -1,18 +1,18 @@
from collections.abc import Iterable, Iterator
from typing import Any, TypeVar, overload
from typing_extensions import TypeAlias
CallExpr = Any # from mypy.nodes
Context = Any # from mypy.nodes
Expression = Any # from mypy.nodes
JsonDict = Any # from mypy.nodes
NameExpr = Any # from mypy.nodes
Statement = Any # from mypy.nodes
TypeInfo = Any # from mypy.nodes
AttributeContext = Any # from mypy.plugin
ClassDefContext = Any # from mypy.plugin
DynamicClassDefContext = Any # from mypy.plugin
SemanticAnalyzerPluginInterface = Any # from mypy.plugin
Type = Any # from mypy.types
CallExpr: TypeAlias = Any # from mypy.nodes
Context: TypeAlias = Any # from mypy.nodes
Expression: TypeAlias = Any # from mypy.nodes
JsonDict: TypeAlias = Any # from mypy.nodes
NameExpr: TypeAlias = Any # from mypy.nodes
Statement: TypeAlias = Any # from mypy.nodes
TypeInfo: TypeAlias = Any # from mypy.nodes
ClassDefContext: TypeAlias = Any # from mypy.plugin
DynamicClassDefContext: TypeAlias = Any # from mypy.plugin
SemanticAnalyzerPluginInterface: TypeAlias = Any # from mypy.plugin
Type: TypeAlias = Any # from mypy.types
_TArgType = TypeVar("_TArgType", bound=CallExpr | NameExpr)

View File

@@ -0,0 +1 @@
protobuf==3.20.1

View File

@@ -24,14 +24,14 @@ class UserNotFoundError(exceptions.Error): ...
class _NotEqualMixin:
def __ne__(self, other: object) -> bool: ...
DirectionT: TypeAlias = Literal["asc", "desc"]
_Direction: TypeAlias = Literal["asc", "desc"]
class IndexProperty(_NotEqualMixin):
def __new__(cls: type[Self], name: str, direction: DirectionT) -> Self: ...
def __new__(cls: type[Self], name: str, direction: _Direction) -> Self: ...
@property
def name(self) -> str: ...
@property
def direction(self) -> DirectionT: ...
def direction(self) -> _Direction: ...
def __eq__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...

View File

@@ -1,9 +1,9 @@
from typing import Any
from typing_extensions import TypeAlias
# Enable when pyasn1 gets stubs:
# from pyasn1.codec.ber.encoder import AbstractItemEncoder, BooleanEncoder
AbstractItemEncoder = Any
BooleanEncoder = Any
# from pyasn1.codec.ber.encoder import AbstractItemEncoder
AbstractItemEncoder: TypeAlias = Any
CLASSES: Any

View File

@@ -1,18 +1,19 @@
from typing import Any
from typing_extensions import TypeAlias
# Enable when pyasn1 gets stubs:
# from pyasn1.type import univ
Sequence = Any
_Sequence: TypeAlias = Any
RSA_ENCRYPTION_ASN1_OID: str
class RsaAlgorithmIdentifier(Sequence):
class RsaAlgorithmIdentifier(_Sequence):
componentType: Any
class PKCS8PrivateKey(Sequence):
class PKCS8PrivateKey(_Sequence):
componentType: Any
class PublicKeyInfo(Sequence):
class PublicKeyInfo(_Sequence):
componentType: Any
def rsa_private_key_pkcs8_to_pkcs1(pkcs8_key): ...

View File

@@ -6,7 +6,6 @@ from urllib3.util import retry
from . import cookies, exceptions, models, structures, utils
PreparedRequest = models.PreparedRequest
Response = models.Response
PoolManager = poolmanager.PoolManager
proxy_from_url = poolmanager.proxy_from_url
@@ -40,7 +39,7 @@ class BaseAdapter:
def __init__(self) -> None: ...
def send(
self,
request: PreparedRequest,
request: models.PreparedRequest,
stream: bool = ...,
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
verify: bool | str = ...,
@@ -69,7 +68,7 @@ class HTTPAdapter(BaseAdapter):
def proxy_headers(self, proxy): ...
def send(
self,
request: PreparedRequest,
request: models.PreparedRequest,
stream: bool = ...,
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
verify: bool | str = ...,

View File

@@ -4,7 +4,6 @@ from typing import Any, AnyStr
from . import compat, cookies, exceptions, structures
OrderedDict = compat.OrderedDict
RequestsCookieJar = cookies.RequestsCookieJar
cookiejar_from_dict = cookies.cookiejar_from_dict
CaseInsensitiveDict = structures.CaseInsensitiveDict
InvalidURL = exceptions.InvalidURL

View File

@@ -7,8 +7,8 @@ from collections.abc import Callable, Generator, Iterable, Sequence
from typing import IO, Any, TypeVar, overload
from typing_extensions import TypeAlias
LegacyVersion: TypeAlias = Any # from packaging.version
Version: TypeAlias = Any # from packaging.version
_LegacyVersion: TypeAlias = Any # from packaging.version
_Version: TypeAlias = Any # from packaging.version
_T = TypeVar("_T")
_NestedStr: TypeAlias = str | Iterable[str | Iterable[Any]]
@@ -262,7 +262,7 @@ empty_provider: EmptyProvider
class FileMetadata(EmptyProvider, IResourceProvider):
def __init__(self, path_to_pkg_info: str) -> None: ...
def parse_version(v: str) -> Version | LegacyVersion: ...
def parse_version(v: str) -> _Version | _LegacyVersion: ...
def yield_lines(strs: _NestedStr) -> Generator[str, None, None]: ...
def split_sections(strs: _NestedStr) -> Generator[tuple[str | None, str], None, None]: ...
def safe_name(name: str) -> str: ...

View File

@@ -24,7 +24,7 @@ PyCF_ONLY_AST: int
# ast classes
identifier = str
_identifier: TypeAlias = str
class AST:
_attributes: tuple[str, ...]
@@ -55,14 +55,14 @@ class stmt(AST):
col_offset: int
class FunctionDef(stmt):
name: identifier
name: _identifier
args: arguments
body: list[stmt]
decorator_list: list[expr]
type_comment: str | None
class ClassDef(stmt):
name: identifier
name: _identifier
bases: list[expr]
body: list[stmt]
decorator_list: list[expr]
@@ -133,7 +133,7 @@ class Import(stmt):
names: list[alias]
class ImportFrom(stmt):
module: identifier | None
module: _identifier | None
names: list[alias]
level: int | None
@@ -143,7 +143,7 @@ class Exec(stmt):
locals: expr | None
class Global(stmt):
names: list[identifier]
names: list[_identifier]
class Expr(stmt):
value: expr
@@ -245,7 +245,7 @@ class Str(expr):
class Attribute(expr):
value: expr
attr: identifier
attr: _identifier
ctx: expr_context
class Subscript(expr):
@@ -254,7 +254,7 @@ class Subscript(expr):
ctx: expr_context
class Name(expr):
id: identifier
id: _identifier
ctx: expr_context
class List(expr):
@@ -319,18 +319,18 @@ class ExceptHandler(AST):
class arguments(AST):
args: list[expr]
vararg: identifier | None
kwarg: identifier | None
vararg: _identifier | None
kwarg: _identifier | None
defaults: list[expr]
type_comments: list[str | None]
class keyword(AST):
arg: identifier
arg: _identifier
value: expr
class alias(AST):
name: identifier
asname: identifier | None
name: _identifier
asname: _identifier | None
class TypeIgnore(AST):
lineno: int

View File

@@ -24,7 +24,7 @@ PyCF_ONLY_AST: int
# ast classes
identifier = str
_identifier: TypeAlias = str
class AST:
_attributes: tuple[str, ...]
@@ -55,7 +55,7 @@ class stmt(AST):
col_offset: int
class FunctionDef(stmt):
name: identifier
name: _identifier
args: arguments
body: list[stmt]
decorator_list: list[expr]
@@ -63,7 +63,7 @@ class FunctionDef(stmt):
type_comment: str | None
class AsyncFunctionDef(stmt):
name: identifier
name: _identifier
args: arguments
body: list[stmt]
decorator_list: list[expr]
@@ -71,7 +71,7 @@ class AsyncFunctionDef(stmt):
type_comment: str | None
class ClassDef(stmt):
name: identifier
name: _identifier
bases: list[expr]
keywords: list[keyword]
body: list[stmt]
@@ -151,15 +151,15 @@ class Import(stmt):
names: list[alias]
class ImportFrom(stmt):
module: identifier | None
module: _identifier | None
names: list[alias]
level: int | None
class Global(stmt):
names: list[identifier]
names: list[_identifier]
class Nonlocal(stmt):
names: list[identifier]
names: list[_identifier]
class Expr(stmt):
value: expr
@@ -276,7 +276,7 @@ class Ellipsis(expr): ...
class Attribute(expr):
value: expr
attr: identifier
attr: _identifier
ctx: expr_context
class Subscript(expr):
@@ -289,7 +289,7 @@ class Starred(expr):
ctx: expr_context
class Name(expr):
id: identifier
id: _identifier
ctx: expr_context
class List(expr):
@@ -349,7 +349,7 @@ class comprehension(AST):
class ExceptHandler(AST):
type: expr | None
name: identifier | None
name: _identifier | None
body: list[stmt]
lineno: int
col_offset: int
@@ -363,19 +363,19 @@ class arguments(AST):
defaults: list[expr]
class arg(AST):
arg: identifier
arg: _identifier
annotation: expr | None
lineno: int
col_offset: int
type_comment: str | None
class keyword(AST):
arg: identifier | None
arg: _identifier | None
value: expr
class alias(AST):
name: identifier
asname: identifier | None
name: _identifier
asname: _identifier | None
class withitem(AST):
context_expr: expr

View File

@@ -17,7 +17,6 @@ BaseSSLError = ssl.SSLError
ConnectTimeoutError = exceptions.ConnectTimeoutError
SystemTimeWarning = exceptions.SystemTimeWarning
SecurityWarning = exceptions.SecurityWarning
match_hostname = ssl_match_hostname.match_hostname
resolve_cert_reqs = ssl_.resolve_cert_reqs
resolve_ssl_version = ssl_.resolve_ssl_version
@@ -58,5 +57,3 @@ class VerifiedHTTPSConnection(HTTPSConnection):
auto_open: Any
is_verified: Any
def connect(self): ...
UnverifiedHTTPSConnection = HTTPSConnection

View File

@@ -7,9 +7,6 @@ WIN: bool
string_types: tuple[str]
integer_types: tuple[int]
class_types: tuple[type]
text_type = str
binary_type = bytes
long = int
def unquote_bytes_to_wsgi(bytestring: bytes) -> str: ...
def text_(s: str, encoding: str = ..., errors: str = ...) -> str: ...