Skip to content

Commit fa636bc

Browse files
authored
Third-party stubs: fix several fictitious type aliases (#7958)
1 parent 597be79 commit fa636bc

File tree

15 files changed

+69
-73
lines changed

15 files changed

+69
-73
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
PIL.FpxImagePlugin
22
PIL.ImageQt.ImageQt
3+
PIL.ImageQt.QImage # Does exist at runtime usually, but stubtest can't see it
4+
PIL.ImageQt.QPixmap # Does exist at runtime usually, but stubtest can't see it
35
PIL.MicImagePlugin
46
PIL.WmfImagePlugin.WmfHandler

stubs/Pillow/PIL/ImageQt.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from typing import Any
2-
from typing_extensions import Literal
2+
from typing_extensions import Literal, TypeAlias
33

44
from .Image import Image
55

6-
QImage = Any # imported from either of {PyQt6,PySide6,PyQt5,PySide2}.QtGui
7-
QPixmap = Any
6+
QImage: TypeAlias = Any # imported from either of {PyQt6,PySide6,PyQt5,PySide2}.QtGui
7+
QPixmap: TypeAlias = Any
88

99
qt_versions: Any
1010
qt_is_installed: bool

stubs/SQLAlchemy/sqlalchemy/ext/mypy/names.pyi

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
from typing import Any
2+
from typing_extensions import TypeAlias
23

34
from ...util import symbol
45

5-
ClassDef = Any # from mypy.nodes
6-
Expression = Any # from mypy.nodes
7-
MemberExpr = Any # from mypy.nodes
8-
NameExpr = Any # from mypy.nodes
9-
SymbolNode = Any # from mypy.nodes
10-
TypeInfo = Any # from mypy.nodes
11-
StrExpr = Any # from mypy.nodes
12-
SemanticAnalyzerPluginInterface = Any # from mypy.plugin
13-
UnboundType = Any # from mypy.types
6+
ClassDef: TypeAlias = Any # from mypy.nodes
7+
Expression: TypeAlias = Any # from mypy.nodes
8+
MemberExpr: TypeAlias = Any # from mypy.nodes
9+
NameExpr: TypeAlias = Any # from mypy.nodes
10+
SymbolNode: TypeAlias = Any # from mypy.nodes
11+
TypeInfo: TypeAlias = Any # from mypy.nodes
12+
SemanticAnalyzerPluginInterface: TypeAlias = Any # from mypy.plugin
13+
UnboundType: TypeAlias = Any # from mypy.types
1414

1515
COLUMN: symbol
1616
RELATIONSHIP: symbol

stubs/SQLAlchemy/sqlalchemy/ext/mypy/util.pyi

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
from collections.abc import Iterable, Iterator
22
from typing import Any, TypeVar, overload
3+
from typing_extensions import TypeAlias
34

4-
CallExpr = Any # from mypy.nodes
5-
Context = Any # from mypy.nodes
6-
Expression = Any # from mypy.nodes
7-
JsonDict = Any # from mypy.nodes
8-
NameExpr = Any # from mypy.nodes
9-
Statement = Any # from mypy.nodes
10-
TypeInfo = Any # from mypy.nodes
11-
AttributeContext = Any # from mypy.plugin
12-
ClassDefContext = Any # from mypy.plugin
13-
DynamicClassDefContext = Any # from mypy.plugin
14-
SemanticAnalyzerPluginInterface = Any # from mypy.plugin
15-
Type = Any # from mypy.types
5+
CallExpr: TypeAlias = Any # from mypy.nodes
6+
Context: TypeAlias = Any # from mypy.nodes
7+
Expression: TypeAlias = Any # from mypy.nodes
8+
JsonDict: TypeAlias = Any # from mypy.nodes
9+
NameExpr: TypeAlias = Any # from mypy.nodes
10+
Statement: TypeAlias = Any # from mypy.nodes
11+
TypeInfo: TypeAlias = Any # from mypy.nodes
12+
ClassDefContext: TypeAlias = Any # from mypy.plugin
13+
DynamicClassDefContext: TypeAlias = Any # from mypy.plugin
14+
SemanticAnalyzerPluginInterface: TypeAlias = Any # from mypy.plugin
15+
Type: TypeAlias = Any # from mypy.types
1616

1717
_TArgType = TypeVar("_TArgType", bound=CallExpr | NameExpr)
1818

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
protobuf==3.20.1

stubs/google-cloud-ndb/google/cloud/ndb/model.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ class UserNotFoundError(exceptions.Error): ...
2424
class _NotEqualMixin:
2525
def __ne__(self, other: object) -> bool: ...
2626

27-
DirectionT: TypeAlias = Literal["asc", "desc"]
27+
_Direction: TypeAlias = Literal["asc", "desc"]
2828

2929
class IndexProperty(_NotEqualMixin):
30-
def __new__(cls: type[Self], name: str, direction: DirectionT) -> Self: ...
30+
def __new__(cls: type[Self], name: str, direction: _Direction) -> Self: ...
3131
@property
3232
def name(self) -> str: ...
3333
@property
34-
def direction(self) -> DirectionT: ...
34+
def direction(self) -> _Direction: ...
3535
def __eq__(self, other: object) -> bool: ...
3636
def __hash__(self) -> int: ...
3737

stubs/ldap3/ldap3/utils/asn1.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from typing import Any
2+
from typing_extensions import TypeAlias
23

34
# Enable when pyasn1 gets stubs:
4-
# from pyasn1.codec.ber.encoder import AbstractItemEncoder, BooleanEncoder
5-
AbstractItemEncoder = Any
6-
BooleanEncoder = Any
5+
# from pyasn1.codec.ber.encoder import AbstractItemEncoder
6+
AbstractItemEncoder: TypeAlias = Any
77

88
CLASSES: Any
99

stubs/python-jose/jose/backends/_asn1.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
from typing import Any
2+
from typing_extensions import TypeAlias
23

34
# Enable when pyasn1 gets stubs:
45
# from pyasn1.type import univ
5-
Sequence = Any
6+
_Sequence: TypeAlias = Any
67

78
RSA_ENCRYPTION_ASN1_OID: str
89

9-
class RsaAlgorithmIdentifier(Sequence):
10+
class RsaAlgorithmIdentifier(_Sequence):
1011
componentType: Any
1112

12-
class PKCS8PrivateKey(Sequence):
13+
class PKCS8PrivateKey(_Sequence):
1314
componentType: Any
1415

15-
class PublicKeyInfo(Sequence):
16+
class PublicKeyInfo(_Sequence):
1617
componentType: Any
1718

1819
def rsa_private_key_pkcs8_to_pkcs1(pkcs8_key): ...

stubs/requests/requests/adapters.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ from urllib3.util import retry
66

77
from . import cookies, exceptions, models, structures, utils
88

9-
PreparedRequest = models.PreparedRequest
109
Response = models.Response
1110
PoolManager = poolmanager.PoolManager
1211
proxy_from_url = poolmanager.proxy_from_url
@@ -40,7 +39,7 @@ class BaseAdapter:
4039
def __init__(self) -> None: ...
4140
def send(
4241
self,
43-
request: PreparedRequest,
42+
request: models.PreparedRequest,
4443
stream: bool = ...,
4544
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
4645
verify: bool | str = ...,
@@ -69,7 +68,7 @@ class HTTPAdapter(BaseAdapter):
6968
def proxy_headers(self, proxy): ...
7069
def send(
7170
self,
72-
request: PreparedRequest,
71+
request: models.PreparedRequest,
7372
stream: bool = ...,
7473
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
7574
verify: bool | str = ...,

stubs/requests/requests/utils.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ from typing import Any, AnyStr
44
from . import compat, cookies, exceptions, structures
55

66
OrderedDict = compat.OrderedDict
7-
RequestsCookieJar = cookies.RequestsCookieJar
87
cookiejar_from_dict = cookies.cookiejar_from_dict
98
CaseInsensitiveDict = structures.CaseInsensitiveDict
109
InvalidURL = exceptions.InvalidURL

0 commit comments

Comments
 (0)