From fca331ff234ef3140d32dff3f813f0dba075d846 Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 18 Jan 2023 13:03:36 -0500 Subject: [PATCH 1/3] `: Any | None\n` --> : `Incomplete | None\n` --- stubs/Pillow/PIL/ImageFile.pyi | 8 +++---- .../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/passlib/passlib/handlers/scram.pyi | 4 ++-- stubs/passlib/passlib/utils/handlers.pyi | 2 +- .../lib/modulegraph/modulegraph.pyi | 5 +++-- stubs/redis/redis/commands/json/__init__.pyi | 2 +- .../redis/redis/commands/timeseries/info.pyi | 21 ++++++++++--------- stubs/redis/redis/connection.pyi | 4 ++-- stubs/setuptools/pkg_resources/__init__.pyi | 4 ++-- stubs/vobject/vobject/base.pyi | 6 +++--- 13 files changed, 39 insertions(+), 35 deletions(-) diff --git a/stubs/Pillow/PIL/ImageFile.pyi b/stubs/Pillow/PIL/ImageFile.pyi index 69dddcc293b9..678b045083f5 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/util/concurrency.pyi b/stubs/SQLAlchemy/sqlalchemy/util/concurrency.pyi index 40fbc57509c5..7fe1879c18a2 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 87c3b2be9087..6422049e0928 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 264c1c722934..84e229ea66b3 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 190778567e42..60df226e74d1 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/passlib/passlib/handlers/scram.pyi b/stubs/passlib/passlib/handlers/scram.pyi index 64b6a2d6be0f..80e4586c5fbc 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 b474606b0473..9d3e80ba8de5 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/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi b/stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi index ebc7e1c5a8cd..0806e831e3be 100644 --- a/stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi +++ b/stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi @@ -2,7 +2,8 @@ # We reference the vendored package rather than depending on the original untyped module. # Anything not referenced in the PyInstaller stubs doesn't need to be added here. -from typing import Any, Protocol +from _typeshed import Incomplete +from typing import Protocol class _SupportsGraphident(Protocol): graphident: str @@ -10,7 +11,7 @@ class _SupportsGraphident(Protocol): # code, filename and packagepath are always initialized to None. But they can be given a value later. class Node: # Compiled code. See stdlib.builtins.compile - code: Any | None + code: Incomplete | None filename: str | None graphident: str identifier: str diff --git a/stubs/redis/redis/commands/json/__init__.pyi b/stubs/redis/redis/commands/json/__init__.pyi index 35ce19483cb7..ef69aceb6cb0 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 425dd29d5024..8b082c7d655e 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 804fda3052af..48c2e33a8457 100644 --- a/stubs/redis/redis/connection.pyi +++ b/stubs/redis/redis/connection.pyi @@ -145,9 +145,9 @@ 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 diff --git a/stubs/setuptools/pkg_resources/__init__.pyi b/stubs/setuptools/pkg_resources/__init__.pyi index d256d2198229..f42fe6088555 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 3abe276e24de..3631dc804bac 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: ... From 97a8b96c35a75b3a6ef8b9ab8516f118e7bec3a1 Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 18 Jan 2023 13:07:14 -0500 Subject: [PATCH 2/3] `: Any | None` --> : `Incomplete | None` --- stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi | 8 ++++++-- stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi | 10 +++++----- stubs/mock/mock/mock.pyi | 8 ++++---- stubs/pyOpenSSL/OpenSSL/crypto.pyi | 4 ++-- stubs/redis/redis/connection.pyi | 4 ++-- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi index c4e33803602a..8938a45ad691 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 f329d9a41028..cdf9bf417aa5 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/mock/mock/mock.pyi b/stubs/mock/mock/mock.pyi index 70c8deedd75b..5fd3bdefd404 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/pyOpenSSL/OpenSSL/crypto.pyi b/stubs/pyOpenSSL/OpenSSL/crypto.pyi index f9e1fead8a69..bfc66d3fc877 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/connection.pyi b/stubs/redis/redis/connection.pyi index 48c2e33a8457..87853369e3aa 100644 --- a/stubs/redis/redis/connection.pyi +++ b/stubs/redis/redis/connection.pyi @@ -150,8 +150,8 @@ class SSLConnection(Connection): 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=..., From e40a7a765bcf1c78261b121e0127185085556f6b Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 18 Jan 2023 13:56:30 -0500 Subject: [PATCH 3/3] Manual review --- .../pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi b/stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi index 0806e831e3be..ebc7e1c5a8cd 100644 --- a/stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi +++ b/stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi @@ -2,8 +2,7 @@ # We reference the vendored package rather than depending on the original untyped module. # Anything not referenced in the PyInstaller stubs doesn't need to be added here. -from _typeshed import Incomplete -from typing import Protocol +from typing import Any, Protocol class _SupportsGraphident(Protocol): graphident: str @@ -11,7 +10,7 @@ class _SupportsGraphident(Protocol): # code, filename and packagepath are always initialized to None. But they can be given a value later. class Node: # Compiled code. See stdlib.builtins.compile - code: Incomplete | None + code: Any | None filename: str | None graphident: str identifier: str