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

- ClassVar[Any | None]
- Missed previous changes due to alias
- Manual review of leftover Any unions (`| Any` and `Any |`)
This commit is contained in:
Avasam
2023-02-02 09:48:41 -05:00
committed by GitHub
parent 95dc689b28
commit f1aede7162
12 changed files with 32 additions and 22 deletions

View File

@@ -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

View File

@@ -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
@@ -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: ...

View File

@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any as _Any
import sqlalchemy.types as sqltypes
@@ -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
@@ -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

View File

@@ -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
@@ -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
@@ -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]

View File

@@ -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
@@ -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: ...

View File

@@ -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
@@ -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: ...

View File

@@ -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]

View File

@@ -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
@@ -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: ...
@@ -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: ...

View File

@@ -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
@@ -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

View File

@@ -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 types import CodeType
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: CodeType | None
filename: str | None
graphident: str
identifier: str

View File

@@ -1,4 +1,4 @@
from _typeshed import Self
from _typeshed import Incomplete, Self
from types import TracebackType
from typing import Any, ClassVar, Protocol
@@ -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,

View File

@@ -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]: ...