mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-25 04:16:44 +08:00
Always use TypeAlias when assigning to Any (#8021)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
_Reporter = Any # really docutils.utils.Reporter
|
||||
_Reporter: TypeAlias = Any # really docutils.utils.Reporter
|
||||
|
||||
# Only defined if docutils is installed.
|
||||
class SilentReporter(_Reporter):
|
||||
|
||||
@@ -876,8 +876,8 @@ class PercentStyle: # undocumented
|
||||
def format(self, record: Any) -> str: ...
|
||||
|
||||
class StrFormatStyle(PercentStyle): # undocumented
|
||||
fmt_spec = Any
|
||||
field_spec = Any
|
||||
fmt_spec: Pattern[str]
|
||||
field_spec: Pattern[str]
|
||||
|
||||
class StringTemplateStyle(PercentStyle): # undocumented
|
||||
_tpl: Template
|
||||
|
||||
@@ -440,7 +440,13 @@ class _SpecState:
|
||||
|
||||
def mock_open(mock: Any | None = ..., read_data: Any = ...) -> Any: ...
|
||||
|
||||
PropertyMock = Any
|
||||
class PropertyMock(Mock):
|
||||
if sys.version_info >= (3, 8):
|
||||
def __get__(self: Self, obj: _T, obj_type: type[_T] | None = ...) -> Self: ...
|
||||
else:
|
||||
def __get__(self: Self, obj: _T, obj_type: type[_T] | None) -> Self: ...
|
||||
|
||||
def __set__(self, obj: Any, value: Any) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def seal(mock: Any) -> None: ...
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from . import util
|
||||
|
||||
AssignmentStmt = Any # from mypy.nodes
|
||||
NameExpr = Any # from mypy.nodes
|
||||
StrExpr = Any # from mypy.nodes
|
||||
SemanticAnalyzerPluginInterface = Any # from mypy.plugin
|
||||
ProperType = Any # from mypy.types
|
||||
AssignmentStmt: TypeAlias = Any # from mypy.nodes
|
||||
NameExpr: TypeAlias = Any # from mypy.nodes
|
||||
StrExpr: TypeAlias = Any # from mypy.nodes
|
||||
SemanticAnalyzerPluginInterface: TypeAlias = Any # from mypy.plugin
|
||||
ProperType: TypeAlias = Any # from mypy.types
|
||||
|
||||
def apply_mypy_mapped_attr(
|
||||
cls, api: SemanticAnalyzerPluginInterface, item: NameExpr | StrExpr, attributes: list[util.SQLAlchemyAttribute]
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from . import util
|
||||
|
||||
SemanticAnalyzerPluginInterface = Any # from mypy.plugin
|
||||
SemanticAnalyzerPluginInterface: TypeAlias = Any # from mypy.plugin
|
||||
|
||||
def scan_declarative_assignments_and_apply_types(
|
||||
cls, api: SemanticAnalyzerPluginInterface, is_mixin_scan: bool = ...
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
AssignmentStmt = Any # from mypy.nodes
|
||||
Expression = Any # from mypy.nodes
|
||||
RefExpr = Any # from mypy.nodes
|
||||
TypeInfo = Any # from mypy.nodes
|
||||
Var = Any # from mypy.nodes
|
||||
StrExpr = Any # from mypy.nodes
|
||||
SemanticAnalyzerPluginInterface = Any # from mypy.plugin
|
||||
ProperType = Any # from mypy.types
|
||||
AssignmentStmt: TypeAlias = Any # from mypy.nodes
|
||||
Expression: TypeAlias = Any # from mypy.nodes
|
||||
RefExpr: TypeAlias = Any # from mypy.nodes
|
||||
TypeInfo: TypeAlias = Any # from mypy.nodes
|
||||
Var: TypeAlias = Any # from mypy.nodes
|
||||
StrExpr: TypeAlias = Any # from mypy.nodes
|
||||
SemanticAnalyzerPluginInterface: TypeAlias = Any # from mypy.plugin
|
||||
ProperType: TypeAlias = Any # from mypy.types
|
||||
|
||||
def infer_type_from_right_hand_nameexpr(
|
||||
api: SemanticAnalyzerPluginInterface,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
MypyFile = Any # from mypy.nodes
|
||||
AttributeContext = Any # from mypy.plugin
|
||||
ClassDefContext = Any # from mypy.plugin
|
||||
DynamicClassDefContext = Any # from mypy.plugin
|
||||
Plugin = Any # from mypy.plugin
|
||||
Type = Any # from mypy.types
|
||||
MypyFile: TypeAlias = Any # from mypy.nodes
|
||||
AttributeContext: TypeAlias = Any # from mypy.plugin
|
||||
ClassDefContext: TypeAlias = Any # from mypy.plugin
|
||||
DynamicClassDefContext: TypeAlias = Any # from mypy.plugin
|
||||
Plugin: TypeAlias = Any # from mypy.plugin
|
||||
Type: TypeAlias = Any # from mypy.types
|
||||
|
||||
class SQLAlchemyPlugin(Plugin):
|
||||
def get_dynamic_class_hook(self, fullname: str) -> Callable[[DynamicClassDefContext], None] | None: ...
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import asyncio as asyncio
|
||||
from collections.abc import Callable, Coroutine
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .langhelpers import memoized_property
|
||||
|
||||
_greenlet = Any # actually greenlet.greenlet
|
||||
_greenlet: TypeAlias = Any # actually greenlet.greenlet
|
||||
|
||||
def is_exit_exception(e): ...
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ def with_init(attrs: Sequence[AnyStr | Attribute]) -> Callable[..., Any]: ...
|
||||
def immutable(attrs: Sequence[AnyStr | Attribute]) -> Callable[..., Any]: ...
|
||||
def strip_leading_underscores(attribute_name: AnyStr) -> AnyStr: ...
|
||||
|
||||
NOTHING = Any
|
||||
class _Nothing: ...
|
||||
|
||||
NOTHING: _Nothing
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
# Enable when pyasn1 gets stubs:
|
||||
# from pyasn1.type.univ import Sequence
|
||||
Sequence = Any
|
||||
Sequence: TypeAlias = Any
|
||||
|
||||
class SicilyBindResponse(Sequence):
|
||||
tagSet: Any
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
# Enable when pyasn1 gets stubs:
|
||||
# from pyasn1.type.univ import Integer, OctetString, Sequence, SequenceOf
|
||||
Integer = Any
|
||||
OctetString = Any
|
||||
Sequence = Any
|
||||
SequenceOf = Any
|
||||
Integer: TypeAlias = Any
|
||||
OctetString: TypeAlias = Any
|
||||
Sequence: TypeAlias = Any
|
||||
SequenceOf: TypeAlias = Any
|
||||
|
||||
NMAS_LDAP_EXT_VERSION: int
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
# Enable when pyasn1 gets stubs:
|
||||
# from pyasn1.type.univ import Enumerated, Sequence
|
||||
Enumerated = Any
|
||||
Sequence = Any
|
||||
Enumerated: TypeAlias = Any
|
||||
Sequence: TypeAlias = Any
|
||||
|
||||
class PersistentSearchControl(Sequence):
|
||||
componentType: Any
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
# Enable when pyasn1 gets stubs:
|
||||
# from pyasn1.type.univ import Integer, OctetString, Sequence
|
||||
Integer = Any
|
||||
OctetString = Any
|
||||
Sequence = Any
|
||||
Integer: TypeAlias = Any
|
||||
OctetString: TypeAlias = Any
|
||||
Sequence: TypeAlias = Any
|
||||
|
||||
MAXINT: Any
|
||||
rangeInt0ToMaxConstraint: Any
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
# Enable when pyasn1 gets stubs:
|
||||
# from pyasn1.type.univ import OctetString, Sequence
|
||||
OctetString = Any
|
||||
Sequence = Any
|
||||
OctetString: TypeAlias = Any
|
||||
Sequence: TypeAlias = Any
|
||||
|
||||
class UserIdentity(OctetString):
|
||||
tagSet: Any
|
||||
|
||||
@@ -316,6 +316,8 @@ class _SpecState:
|
||||
|
||||
def mock_open(mock: Any | None = ..., read_data: Any = ...) -> Any: ...
|
||||
|
||||
PropertyMock = Any
|
||||
class PropertyMock(Mock):
|
||||
def __get__(self: Self, obj: _T, obj_type: type[_T] | None = ...) -> Self: ...
|
||||
def __set__(self, obj: Any, value: Any) -> None: ...
|
||||
|
||||
def seal(mock: Any) -> None: ...
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Any
|
||||
|
||||
from .base import *
|
||||
from .sequence import Sequence as Sequence
|
||||
|
||||
@@ -9,5 +7,5 @@ class MetaStrict(type):
|
||||
class MetaSerialisable(type):
|
||||
def __new__(cls, clsname, bases, methods): ...
|
||||
|
||||
Strict: Any
|
||||
_Serialiasable = Any
|
||||
class Strict(metaclass=MetaStrict): ...
|
||||
class _Serialiasable(metaclass=MetaSerialisable): ...
|
||||
|
||||
@@ -3,6 +3,7 @@ from _typeshed import Self
|
||||
from collections.abc import Callable, Iterable, Iterator
|
||||
from contextlib import AbstractContextManager
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from ._common import (
|
||||
AIX as AIX,
|
||||
@@ -108,8 +109,8 @@ elif sys.platform == "darwin":
|
||||
elif sys.platform == "win32":
|
||||
from ._pswindows import pfullmem, pmem
|
||||
else:
|
||||
pmem = Any
|
||||
pfullmem = Any
|
||||
pmem: TypeAlias = Any
|
||||
pfullmem: TypeAlias = Any
|
||||
|
||||
if sys.platform == "linux":
|
||||
PROCFS_PATH: str
|
||||
|
||||
Reference in New Issue
Block a user