Skip to content

Stubs replace : Any | None with : Incomplete | None #9565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions stubs/Pillow/PIL/ImageFile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
8 changes: 6 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Member

@AlexWaygood AlexWaygood Jan 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the ones in this file are stubgen artefacts; they were all added in https://github.com/python/typeshed/pull/7603/files. But, there's no source-code comment indicating why they used Any here (and the comments on the PR thread give no insight), so I think it's fine to change the Any uses in this file to Incomplete.

(Same comment applies to a few other files touched by this PR.)

def lateral(self: Self, name: Incomplete | None = ...) -> Self: ...
def data(self: Self, values) -> Self: ...

Expand Down Expand Up @@ -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: ...

Expand Down
4 changes: 2 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/util/concurrency.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any
from _typeshed import Incomplete

from ._compat_py3k import asynccontextmanager as asynccontextmanager
from ._concurrency_py3k import (
Expand All @@ -10,4 +10,4 @@ from ._concurrency_py3k import (
)

have_greenlet: bool
asyncio: Any | None
asyncio: Incomplete | None
5 changes: 3 additions & 2 deletions stubs/beautifulsoup4/bs4/dammit.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Iterable, Iterator
from logging import Logger
from typing import Any
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions stubs/caldav/caldav/elements/base.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/console-menu/consolemenu/items/function_item.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Callable, Mapping, Sequence
from typing import Any

Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions stubs/mock/mock/mock.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ...,
Expand Down
4 changes: 2 additions & 2 deletions stubs/passlib/passlib/handlers/scram.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing import ClassVar

import passlib.utils.handlers as uh

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stubs/passlib/passlib/utils/handlers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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): ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/pyOpenSSL/OpenSSL/crypto.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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): ...

Expand Down
2 changes: 1 addition & 1 deletion stubs/redis/redis/commands/json/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...

Expand Down
21 changes: 11 additions & 10 deletions stubs/redis/redis/commands/timeseries/info.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
8 changes: 4 additions & 4 deletions stubs/redis/redis/connection.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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=...,
Expand Down
4 changes: 2 additions & 2 deletions stubs/setuptools/pkg_resources/__init__.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Comment on lines 80 to +82
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, we should, you know, take action on this comment now (in a separate PR)

@staticmethod
def parse(s: str | Iterable[str]) -> Requirement: ...
def __contains__(self, item: Distribution | str | tuple[str, ...]) -> bool: ...
Expand Down
6 changes: 3 additions & 3 deletions stubs/vobject/vobject/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down