Skip to content
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

Manual changes of Any union to Incomplete in stubs folder #9566

Merged
merged 9 commits into from
Feb 2, 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
3 changes: 3 additions & 0 deletions stubs/PyYAML/yaml/nodes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ from typing import Any, ClassVar

from yaml.error import Mark

# Any Unions: Avoid forcing the user to check for None when they know what Node was instantiated with
# Using generics may be overkill without support for default Generics
# Permissive Unions could also be useful here.
class Node:
tag: str
value: Any
Expand Down
6 changes: 3 additions & 3 deletions stubs/PyYAML/yaml/representer.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import datetime
from _typeshed import SupportsItems
from _typeshed import Incomplete, SupportsItems
from collections.abc import Callable, Iterable, Mapping
from types import BuiltinFunctionType, FunctionType, ModuleType
from typing import Any, ClassVar, NoReturn, TypeVar
Expand All @@ -15,12 +15,12 @@ class RepresenterError(YAMLError): ...
class BaseRepresenter:
yaml_representers: ClassVar[dict[type[Any], Callable[[BaseRepresenter, Any], Node]]]
yaml_multi_representers: ClassVar[dict[type[Any], Callable[[BaseRepresenter, Any], Node]]]
default_style: str | Any
default_style: str | Incomplete
sort_keys: bool
default_flow_style: bool
represented_objects: dict[int, Node]
object_keeper: list[Any]
alias_key: int | Any
alias_key: int | Incomplete
def __init__(self, default_style: str | None = ..., default_flow_style: bool = ..., sort_keys: bool = ...) -> None: ...
def represent(self, data) -> None: ...
def represent_data(self, data) -> Node: ...
Expand Down
7 changes: 5 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/array.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any as _Any

import sqlalchemy.types as sqltypes
Expand All @@ -13,7 +14,7 @@ class array(expression.ClauseList, expression.ColumnElement[_Any]):
inherit_cache: bool
type: _Any
def __init__(self, clauses, **kw) -> None: ...
def self_group(self, against: _Any | None = ...): ...
def self_group(self, against: Incomplete | None = ...): ...

CONTAINS: _Any
CONTAINED_BY: _Any
Expand All @@ -29,7 +30,9 @@ class ARRAY(sqltypes.ARRAY):
as_tuple: _Any
dimensions: _Any
zero_indexes: _Any
def __init__(self, item_type, as_tuple: bool = ..., dimensions: _Any | None = ..., zero_indexes: bool = ...) -> None: ...
def __init__(
self, item_type, as_tuple: bool = ..., dimensions: Incomplete | None = ..., zero_indexes: bool = ...
) -> None: ...
@property
def hashable(self): ...
@property
Expand Down
5 changes: 3 additions & 2 deletions stubs/paho-mqtt/paho/mqtt/client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import socket as _socket
import ssl as _ssl
import time
import types
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Any, Optional, TypeVar
from typing_extensions import TypeAlias
Expand All @@ -16,7 +17,7 @@ ssl: types.ModuleType | None
socks: types.ModuleType | None
time_func = time.monotonic
HAVE_DNS: bool
EAGAIN: int | Any
EAGAIN: int | Incomplete
MQTTv31: int
MQTTv311: int
MQTTv5: int
Expand Down Expand Up @@ -86,7 +87,7 @@ MQTT_BRIDGE: int
MQTT_CLEAN_START_FIRST_ONLY: int
sockpair_data: bytes
_UserData: TypeAlias = Any
_Socket: TypeAlias = _socket.socket | _ssl.SSLSocket | Any
_Socket: TypeAlias = _socket.socket | _ssl.SSLSocket | Incomplete
_Payload: TypeAlias = str | bytes | bytearray | float
_ExtraHeader: TypeAlias = dict[str, str] | Callable[[dict[str, str]], dict[str, str]]
_OnLog: TypeAlias = Callable[[Client, _UserData, int, str], object]
Expand Down
3 changes: 2 additions & 1 deletion stubs/parsimonious/parsimonious/grammar.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import collections.abc
from _typeshed import Incomplete
from collections import OrderedDict
from collections.abc import Callable, Mapping
from typing import Any, NoReturn
Expand All @@ -7,7 +8,7 @@ from parsimonious.expressions import _CALLABLE_TYPE, Expression, Literal, Lookah
from parsimonious.nodes import Node, NodeVisitor

class Grammar(OrderedDict[str, Expression]):
default_rule: Expression | Any
default_rule: Expression | Incomplete
def __init__(self, rules: str = ..., **more_rules: Expression | _CALLABLE_TYPE) -> None: ...
def default(self, rule_name: str) -> Grammar: ...
def parse(self, text: str, pos: int = ...) -> Node: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/parsimonious/parsimonious/nodes.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Callable, Iterator, Sequence
from re import Match
from typing import Any, NoReturn, TypeVar
Expand Down Expand Up @@ -27,7 +28,7 @@ class RegexNode(Node):
class RuleDecoratorMeta(type): ...

class NodeVisitor(metaclass=RuleDecoratorMeta):
grammar: Grammar | Any
grammar: Grammar | Incomplete
unwrapped_exceptions: tuple[type[BaseException], ...]
def visit(self, node: Node) -> Any: ...
def generic_visit(self, node: Node, visited_children: Sequence[Any]) -> NoReturn: ...
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 @@ -110,7 +110,7 @@ class HasRounds(GenericHandler):
min_desired_rounds: ClassVar[int | None]
max_desired_rounds: ClassVar[int | None]
default_rounds: ClassVar[int | None]
vary_rounds: ClassVar[Any | None]
vary_rounds: ClassVar[Incomplete | None]
rounds: int
@classmethod
def using( # type: ignore[override]
Expand Down
6 changes: 3 additions & 3 deletions stubs/protobuf/google/protobuf/internal/well_known_types.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from _typeshed import SupportsItems
from _typeshed import Incomplete, SupportsItems
from collections.abc import Iterable, Iterator, KeysView, Mapping, Sequence
from datetime import datetime, timedelta, tzinfo
from typing import Any as tAny
Expand All @@ -9,7 +9,7 @@ from google.protobuf import struct_pb2
class Any:
type_url: tAny = ...
value: tAny = ...
def Pack(self, msg: tAny, type_url_prefix: str = ..., deterministic: tAny | None = ...) -> None: ...
def Pack(self, msg: tAny, type_url_prefix: str = ..., deterministic: Incomplete | None = ...) -> None: ...
def Unpack(self, msg: tAny) -> bool: ...
def TypeName(self) -> str: ...
def Is(self, descriptor: tAny) -> bool: ...
Expand Down Expand Up @@ -60,7 +60,7 @@ class FieldMask:
) -> None: ...

class _FieldMaskTree:
def __init__(self, field_mask: tAny | None = ...) -> None: ...
def __init__(self, field_mask: Incomplete | None = ...) -> None: ...
def MergeFromFieldMask(self, field_mask: tAny) -> None: ...
def AddPath(self, path: tAny): ...
def ToFieldMask(self, field_mask: tAny) -> None: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/pyinstaller/PyInstaller/depend/imphookapi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from _typeshed import StrOrBytesPath
from collections.abc import Generator, Iterable
from typing import Any
from types import CodeType
from typing_extensions import Literal

from PyInstaller.building.build_main import Analysis
Expand Down Expand Up @@ -50,7 +50,7 @@ class PostGraphAPI:
def __name__(self) -> str: ...
# Compiled code. See stdlib.builtins.compile
@property
def co(self) -> Any: ...
def co(self) -> CodeType: ...
@property
def analysis(self) -> Analysis: ...
@property
Expand Down
5 changes: 3 additions & 2 deletions stubs/pyinstaller/PyInstaller/lib/modulegraph/modulegraph.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
# 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 types import CodeType
from typing import Protocol

class _SupportsGraphident(Protocol):
graphident: str

# 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: CodeType | None
filename: str | None
graphident: str
identifier: str
Expand Down
8 changes: 4 additions & 4 deletions stubs/redis/redis/lock.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 types import TracebackType
from typing import Any, ClassVar, Protocol

Expand All @@ -11,9 +11,9 @@ class Lock:
LUA_EXTEND_SCRIPT: ClassVar[str]
LUA_REACQUIRE_SCRIPT: ClassVar[str]
LUA_RELEASE_SCRIPT: ClassVar[str]
lua_extend: ClassVar[Any | None]
lua_reacquire: ClassVar[Any | None]
lua_release: ClassVar[Any | None]
lua_extend: ClassVar[Incomplete | None]
lua_reacquire: ClassVar[Incomplete | None]
lua_release: ClassVar[Incomplete | None]
local: _Local
def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion stubs/toml/toml/encoder.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TomlEncoder(Generic[_MappingT]):
@overload
def __init__(self: TomlEncoder[dict[str, Any]], _dict: type[dict[str, Any]] = ..., preserve: bool = ...) -> None: ...
def get_empty_table(self) -> _MappingT: ...
def dump_list(self, v: Iterable[object]) -> str: ...
def dump_list(self, v: Iterable[Any]) -> str: ...
def dump_inline_table(self, section: dict[str, Any] | Any) -> str: ...
def dump_value(self, v: Any) -> str: ...
def dump_sections(self, o: _MappingT, sup: str) -> tuple[str, _MappingT]: ...
Expand Down