diff --git a/stdlib/distutils/command/check.pyi b/stdlib/distutils/command/check.pyi index 36895d2c1..cdbe40fff 100644 --- a/stdlib/distutils/command/check.pyi +++ b/stdlib/distutils/command/check.pyi @@ -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): diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index de5ff024c..0f45a9687 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -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 diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 400bdaac3..a7111ff2d 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -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: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/apply.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/apply.pyi index 44aacc72f..9b500b238 100644 --- a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/apply.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/apply.pyi @@ -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] diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/decl_class.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/decl_class.pyi index 0a417cb58..de36aa89a 100644 --- a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/decl_class.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/decl_class.pyi @@ -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 = ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/infer.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/infer.pyi index 7faabc366..b453badee 100644 --- a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/infer.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/infer.pyi @@ -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, diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/plugin.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/plugin.pyi index 8ec411585..521bed863 100644 --- a/stubs/SQLAlchemy/sqlalchemy/ext/mypy/plugin.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/ext/mypy/plugin.pyi @@ -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: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/util/_concurrency_py3k.pyi b/stubs/SQLAlchemy/sqlalchemy/util/_concurrency_py3k.pyi index b900f1a84..2cf494840 100644 --- a/stubs/SQLAlchemy/sqlalchemy/util/_concurrency_py3k.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/util/_concurrency_py3k.pyi @@ -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): ... diff --git a/stubs/characteristic/characteristic/__init__.pyi b/stubs/characteristic/characteristic/__init__.pyi index 905fdaa2c..92abbd5a4 100644 --- a/stubs/characteristic/characteristic/__init__.pyi +++ b/stubs/characteristic/characteristic/__init__.pyi @@ -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") diff --git a/stubs/ldap3/ldap3/protocol/microsoft.pyi b/stubs/ldap3/ldap3/protocol/microsoft.pyi index 204a718e3..8c3f8ddc1 100644 --- a/stubs/ldap3/ldap3/protocol/microsoft.pyi +++ b/stubs/ldap3/ldap3/protocol/microsoft.pyi @@ -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 diff --git a/stubs/ldap3/ldap3/protocol/novell.pyi b/stubs/ldap3/ldap3/protocol/novell.pyi index 8ced7089e..97cd30705 100644 --- a/stubs/ldap3/ldap3/protocol/novell.pyi +++ b/stubs/ldap3/ldap3/protocol/novell.pyi @@ -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 diff --git a/stubs/ldap3/ldap3/protocol/persistentSearch.pyi b/stubs/ldap3/ldap3/protocol/persistentSearch.pyi index 933ae390b..5714e7db6 100644 --- a/stubs/ldap3/ldap3/protocol/persistentSearch.pyi +++ b/stubs/ldap3/ldap3/protocol/persistentSearch.pyi @@ -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 diff --git a/stubs/ldap3/ldap3/protocol/rfc2696.pyi b/stubs/ldap3/ldap3/protocol/rfc2696.pyi index 8cb346f03..829e5e83a 100644 --- a/stubs/ldap3/ldap3/protocol/rfc2696.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc2696.pyi @@ -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 diff --git a/stubs/ldap3/ldap3/protocol/rfc3062.pyi b/stubs/ldap3/ldap3/protocol/rfc3062.pyi index c508ccbbf..945468e3e 100644 --- a/stubs/ldap3/ldap3/protocol/rfc3062.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc3062.pyi @@ -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 diff --git a/stubs/mock/mock/mock.pyi b/stubs/mock/mock/mock.pyi index 98502e8c9..9c072f588 100644 --- a/stubs/mock/mock/mock.pyi +++ b/stubs/mock/mock/mock.pyi @@ -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: ... diff --git a/stubs/openpyxl/openpyxl/descriptors/__init__.pyi b/stubs/openpyxl/openpyxl/descriptors/__init__.pyi index 228fef44e..bf8523313 100644 --- a/stubs/openpyxl/openpyxl/descriptors/__init__.pyi +++ b/stubs/openpyxl/openpyxl/descriptors/__init__.pyi @@ -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): ... diff --git a/stubs/psutil/psutil/__init__.pyi b/stubs/psutil/psutil/__init__.pyi index c8df27ad5..309b25ac6 100644 --- a/stubs/psutil/psutil/__init__.pyi +++ b/stubs/psutil/psutil/__init__.pyi @@ -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