From 6ac24ed923cf4c70b8002d665f1df49e93e2d70b Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 18 Jan 2023 14:12:46 -0500 Subject: [PATCH] Replace `Any` with `Incomplete` in many places (#9565) --- stubs/Pillow/PIL/ImageFile.pyi | 8 +++---- stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi | 8 +++++-- .../SQLAlchemy/sqlalchemy/sql/selectable.pyi | 10 ++++----- .../sqlalchemy/util/concurrency.pyi | 4 ++-- stubs/beautifulsoup4/bs4/dammit.pyi | 5 +++-- stubs/caldav/caldav/elements/base.pyi | 6 +++--- .../consolemenu/items/function_item.pyi | 3 ++- stubs/mock/mock/mock.pyi | 8 +++---- stubs/passlib/passlib/handlers/scram.pyi | 4 ++-- stubs/passlib/passlib/utils/handlers.pyi | 2 +- stubs/pyOpenSSL/OpenSSL/crypto.pyi | 4 ++-- stubs/redis/redis/commands/json/__init__.pyi | 2 +- .../redis/redis/commands/timeseries/info.pyi | 21 ++++++++++--------- stubs/redis/redis/connection.pyi | 8 +++---- stubs/setuptools/pkg_resources/__init__.pyi | 4 ++-- stubs/vobject/vobject/base.pyi | 6 +++--- 16 files changed, 55 insertions(+), 48 deletions(-) diff --git a/stubs/Pillow/PIL/ImageFile.pyi b/stubs/Pillow/PIL/ImageFile.pyi index 69dddcc29..678b04508 100644 --- a/stubs/Pillow/PIL/ImageFile.pyi +++ b/stubs/Pillow/PIL/ImageFile.pyi @@ -31,10 +31,10 @@ class StubImageFile(ImageFile): def load(self) -> None: ... class Parser: - incremental: Any | None - image: Any | None - data: Any | None - decoder: Any | None + incremental: Incomplete | None + image: Incomplete | None + data: Incomplete | None + decoder: Incomplete | None offset: int finished: bool def reset(self) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi index c4e338036..8938a45ad 100644 --- a/stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi @@ -72,7 +72,7 @@ def declarative_base( def declarative_base( bind: Connectable | None, metadata: MetaData | None, - mapper: Any | None, + mapper: Incomplete | None, cls: type[Any] | tuple[type[Any], ...], name: str, constructor: Callable[..., None], @@ -109,7 +109,11 @@ class registry: ) -> _DeclT: ... @overload def generate_base( - self, mapper: Any | None, cls: type[Any] | tuple[type[Any], ...], name: str, metaclass: _DeclarativeBaseMeta[_DeclT] + self, + mapper: Incomplete | None, + cls: type[Any] | tuple[type[Any], ...], + name: str, + metaclass: _DeclarativeBaseMeta[_DeclT], ) -> type[_DeclarativeBase]: ... def mapped(self, cls: _ClsT) -> _ClsT: ... # Return type of the callable is a _DeclarativeBase class with the passed in class as base. diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi index f329d9a41..cdf9bf417 100644 --- a/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi @@ -191,7 +191,7 @@ class Values(Generative, FromClause): name: Any literal_binds: Any def __init__(self, *columns, **kw) -> None: ... - def alias(self: Self, name: Any | None, **kw) -> Self: ... # type: ignore[override] + def alias(self: Self, name: Incomplete | None, **kw) -> Self: ... # type: ignore[override] def lateral(self: Self, name: Incomplete | None = ...) -> Self: ... def data(self: Self, values) -> Self: ... @@ -261,10 +261,10 @@ class GenerativeSelect(DeprecatedSelectBaseGenerations, SelectBase): def get_label_style(self): ... def set_label_style(self, style): ... def apply_labels(self): ... - def limit(self: Self, limit: Any | None) -> Self: ... - def fetch(self: Self, count: Any | None, with_ties: bool = ..., percent: bool = ...) -> Self: ... - def offset(self: Self, offset: Any | None) -> Self: ... - def slice(self: Self, start: Any | None, stop: Any | None) -> Self: ... + def limit(self: Self, limit: Incomplete | None) -> Self: ... + def fetch(self: Self, count: Incomplete | None, with_ties: bool = ..., percent: bool = ...) -> Self: ... + def offset(self: Self, offset: Incomplete | None) -> Self: ... + def slice(self: Self, start: Incomplete | None, stop: Incomplete | None) -> Self: ... def order_by(self: Self, *clauses) -> Self: ... def group_by(self: Self, *clauses) -> Self: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/util/concurrency.pyi b/stubs/SQLAlchemy/sqlalchemy/util/concurrency.pyi index 40fbc5750..7fe1879c1 100644 --- a/stubs/SQLAlchemy/sqlalchemy/util/concurrency.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/util/concurrency.pyi @@ -1,4 +1,4 @@ -from typing import Any +from _typeshed import Incomplete from ._compat_py3k import asynccontextmanager as asynccontextmanager from ._concurrency_py3k import ( @@ -10,4 +10,4 @@ from ._concurrency_py3k import ( ) have_greenlet: bool -asyncio: Any | None +asyncio: Incomplete | None diff --git a/stubs/beautifulsoup4/bs4/dammit.pyi b/stubs/beautifulsoup4/bs4/dammit.pyi index 87c3b2be9..6422049e0 100644 --- a/stubs/beautifulsoup4/bs4/dammit.pyi +++ b/stubs/beautifulsoup4/bs4/dammit.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from collections.abc import Iterable, Iterator from logging import Logger from typing import Any @@ -29,7 +30,7 @@ class EncodingDetector: known_definite_encodings: list[str] user_encodings: list[str] exclude_encodings: set[str] - chardet_encoding: Any | None + chardet_encoding: Incomplete | None is_html: bool declared_encoding: str | None markup: Any @@ -61,7 +62,7 @@ class UnicodeDammit: detector: EncodingDetector markup: Any unicode_markup: str - original_encoding: Any | None + original_encoding: Incomplete | None def __init__( self, markup, diff --git a/stubs/caldav/caldav/elements/base.pyi b/stubs/caldav/caldav/elements/base.pyi index 264c1c722..84e229ea6 100644 --- a/stubs/caldav/caldav/elements/base.pyi +++ b/stubs/caldav/caldav/elements/base.pyi @@ -1,4 +1,4 @@ -from _typeshed import Self +from _typeshed import Incomplete, Self from collections.abc import Iterable from typing import Any, ClassVar from typing_extensions import TypeAlias @@ -9,8 +9,8 @@ class BaseElement: tag: ClassVar[str | None] children: list[BaseElement] value: str | None - attributes: Any | None - caldav_class: Any | None + attributes: Incomplete | None + caldav_class: Incomplete | None def __init__(self, name: str | None = ..., value: str | bytes | None = ...) -> None: ... def __add__(self: Self, other: BaseElement) -> Self: ... def xmlelement(self) -> _Element: ... diff --git a/stubs/console-menu/consolemenu/items/function_item.pyi b/stubs/console-menu/consolemenu/items/function_item.pyi index 190778567..60df226e7 100644 --- a/stubs/console-menu/consolemenu/items/function_item.pyi +++ b/stubs/console-menu/consolemenu/items/function_item.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from collections.abc import Callable, Mapping, Sequence from typing import Any @@ -8,7 +9,7 @@ class FunctionItem(ExternalItem): function: Callable[..., Any] args: Sequence[Any] kwargs: Mapping[str, Any] - return_value: Any | None + return_value: Incomplete | None def __init__( self, text: str, diff --git a/stubs/mock/mock/mock.pyi b/stubs/mock/mock/mock.pyi index 70c8deedd..5fd3bdefd 100644 --- a/stubs/mock/mock/mock.pyi +++ b/stubs/mock/mock/mock.pyi @@ -177,11 +177,11 @@ class _patch(Generic[_T]): getter: Callable[[], Any], attribute: str, new: _T, - spec: Any | None, + spec: Incomplete | None, create: bool, - spec_set: Any | None, - autospec: Any | None, - new_callable: Any | None, + spec_set: Incomplete | None, + autospec: Incomplete | None, + new_callable: Incomplete | None, kwargs: Mapping[str, Any], *, unsafe: bool = ..., diff --git a/stubs/passlib/passlib/handlers/scram.pyi b/stubs/passlib/passlib/handlers/scram.pyi index 64b6a2d6b..80e4586c5 100644 --- a/stubs/passlib/passlib/handlers/scram.pyi +++ b/stubs/passlib/passlib/handlers/scram.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete -from typing import Any, ClassVar +from typing import ClassVar import passlib.utils.handlers as uh @@ -13,7 +13,7 @@ class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): max_rounds: ClassVar[int] rounds_cost: ClassVar[str] default_algs: ClassVar[list[str]] - algs: Any | None + algs: Incomplete | None @classmethod def extract_digest_info(cls, hash, alg): ... @classmethod diff --git a/stubs/passlib/passlib/utils/handlers.pyi b/stubs/passlib/passlib/utils/handlers.pyi index b474606b0..9d3e80ba8 100644 --- a/stubs/passlib/passlib/utils/handlers.pyi +++ b/stubs/passlib/passlib/utils/handlers.pyi @@ -66,7 +66,7 @@ class HasEncodingContext(GenericHandler): def __init__(self, encoding: str | None = ..., **kwds) -> None: ... class HasUserContext(GenericHandler): - user: Any | None + user: Incomplete | None def __init__(self, user: Incomplete | None = ..., **kwds) -> None: ... @classmethod def hash(cls, secret, user: Incomplete | None = ..., **context): ... diff --git a/stubs/pyOpenSSL/OpenSSL/crypto.pyi b/stubs/pyOpenSSL/OpenSSL/crypto.pyi index f9e1fead8..bfc66d3fc 100644 --- a/stubs/pyOpenSSL/OpenSSL/crypto.pyi +++ b/stubs/pyOpenSSL/OpenSSL/crypto.pyi @@ -1,4 +1,4 @@ -from _typeshed import StrOrBytesPath +from _typeshed import Incomplete, StrOrBytesPath from collections.abc import Callable, Iterable, Sequence from datetime import datetime from typing import Any @@ -18,7 +18,7 @@ TYPE_RSA: int TYPE_DSA: int class _EllipticCurve: - def __init__(self, lib: Any | None, nid: int, name: str) -> None: ... + def __init__(self, lib: Incomplete | None, nid: int, name: str) -> None: ... class Error(Exception): ... diff --git a/stubs/redis/redis/commands/json/__init__.pyi b/stubs/redis/redis/commands/json/__init__.pyi index 35ce19483..ef69aceb6 100644 --- a/stubs/redis/redis/commands/json/__init__.pyi +++ b/stubs/redis/redis/commands/json/__init__.pyi @@ -8,7 +8,7 @@ class JSON(JSONCommands): MODULE_CALLBACKS: dict[str, Any] client: Any execute_command: Any - MODULE_VERSION: Any | None + MODULE_VERSION: Incomplete | None def __init__(self, client, version: Incomplete | None = ..., decoder=..., encoder=...) -> None: ... def pipeline(self, transaction: bool = ..., shard_hint: Incomplete | None = ...) -> Pipeline: ... diff --git a/stubs/redis/redis/commands/timeseries/info.pyi b/stubs/redis/redis/commands/timeseries/info.pyi index 425dd29d5..8b082c7d6 100644 --- a/stubs/redis/redis/commands/timeseries/info.pyi +++ b/stubs/redis/redis/commands/timeseries/info.pyi @@ -1,17 +1,18 @@ +from _typeshed import Incomplete from typing import Any class TSInfo: rules: list[Any] labels: list[Any] - sourceKey: Any | None - chunk_count: Any | None - memory_usage: Any | None - total_samples: Any | None - retention_msecs: Any | None - last_time_stamp: Any | None - first_time_stamp: Any | None + sourceKey: Incomplete | None + chunk_count: Incomplete | None + memory_usage: Incomplete | None + total_samples: Incomplete | None + retention_msecs: Incomplete | None + last_time_stamp: Incomplete | None + first_time_stamp: Incomplete | None - max_samples_per_chunk: Any | None - chunk_size: Any | None - duplicate_policy: Any | None + max_samples_per_chunk: Incomplete | None + chunk_size: Incomplete | None + duplicate_policy: Incomplete | None def __init__(self, args) -> None: ... diff --git a/stubs/redis/redis/connection.pyi b/stubs/redis/redis/connection.pyi index 804fda305..87853369e 100644 --- a/stubs/redis/redis/connection.pyi +++ b/stubs/redis/redis/connection.pyi @@ -145,13 +145,13 @@ class SSLConnection(Connection): certfile: Any cert_reqs: Any ca_certs: Any - ca_path: Any | None + ca_path: Incomplete | None check_hostname: bool - certificate_password: Any | None + certificate_password: Incomplete | None ssl_validate_ocsp: bool ssl_validate_ocsp_stapled: bool # added in 4.1.1 - ssl_ocsp_context: Any | None # added in 4.1.1 - ssl_ocsp_expected_cert: Any | None # added in 4.1.1 + ssl_ocsp_context: Incomplete | None # added in 4.1.1 + ssl_ocsp_expected_cert: Incomplete | None # added in 4.1.1 def __init__( self, ssl_keyfile=..., diff --git a/stubs/setuptools/pkg_resources/__init__.pyi b/stubs/setuptools/pkg_resources/__init__.pyi index d256d2198..f42fe6088 100644 --- a/stubs/setuptools/pkg_resources/__init__.pyi +++ b/stubs/setuptools/pkg_resources/__init__.pyi @@ -1,7 +1,7 @@ import importlib.abc import types import zipimport -from _typeshed import Self +from _typeshed import Incomplete, Self from abc import ABCMeta from collections.abc import Callable, Generator, Iterable, Sequence from typing import IO, Any, TypeVar, overload @@ -79,7 +79,7 @@ class Requirement: specs: list[tuple[str, str]] # TODO: change this to packaging.markers.Marker | None once we can import # packaging.markers - marker: Any | None + marker: Incomplete | None @staticmethod def parse(s: str | Iterable[str]) -> Requirement: ... def __contains__(self, item: Distribution | str | tuple[str, ...]) -> bool: ... diff --git a/stubs/vobject/vobject/base.pyi b/stubs/vobject/vobject/base.pyi index 3abe276e2..3631dc804 100644 --- a/stubs/vobject/vobject/base.pyi +++ b/stubs/vobject/vobject/base.pyi @@ -15,9 +15,9 @@ _V = TypeVar("_V", bound=VBase) _W = TypeVar("_W", bound=SupportsWrite[bytes]) class VBase: - group: Any | None - behavior: Any | None - parentBehavior: Any | None + group: Incomplete | None + behavior: Incomplete | None + parentBehavior: Incomplete | None isNative: bool def __init__(self, group: Incomplete | None = ...) -> None: ... def copy(self, copyit: VBase) -> None: ...