Skip to content

Commit

Permalink
correct types
Browse files Browse the repository at this point in the history
  • Loading branch information
blablatdinov committed Oct 15, 2022
1 parent cb6d6f3 commit 2b81822
Showing 1 changed file with 92 additions and 74 deletions.
166 changes: 92 additions & 74 deletions boltons/dictutils.pyi
Original file line number Diff line number Diff line change
@@ -1,100 +1,118 @@
from _typeshed import Incomplete
try:
from collections.abc import KeysView, ValuesView, ItemsView
except ImportError:
from collections import KeysView, ValuesView, ItemsView
from typing import Any, Never
from collections.abc import Hashable, Callable, Iterable, Iterator
from collections.abc import Generator

class OrderedMultiDict(dict):
def __init__(self, *args, **kwargs) -> None: ...
def add(self, k, v) -> None: ...
def addlist(self, k, v) -> None: ...
def get(self, k, default: Incomplete | None = ...): ...
def getlist(self, k, default=...): ...
def add(self, k: Hashable, v: Any) -> None: ...
def addlist(self, k: Hashable, v: Any) -> None: ...
def get(self, k: Hashable, default: Any | None = ...) -> Any: ...
def getlist(self, k: Hashable, default=...) -> list[Any]: ...
def clear(self) -> None: ...
def setdefault(self, k, default=...): ...
def copy(self): ...
def setdefault(self, k: Hashable, default: Any = ...) -> Any: ...
def copy(self) -> OrderedMultiDict: ...
@classmethod
def fromkeys(cls, keys, default: Incomplete | None = ...): ...
def update(self, E, **F) -> None: ...
def update_extend(self, E, **F) -> None: ...
def __setitem__(self, k, v) -> None: ...
def __getitem__(self, k): ...
def __delitem__(self, k) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def pop(self, k, default=...): ...
def popall(self, k, default=...): ...
def poplast(self, k=..., default=...): ...
def iteritems(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ...
def iterkeys(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ...
def itervalues(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ...
def todict(self, multi: bool = ...): ...
def sorted(self, key: Incomplete | None = ..., reverse: bool = ...): ...
def sortedvalues(self, key: Incomplete | None = ..., reverse: bool = ...): ...
def inverted(self): ...
def counts(self): ...
def keys(self, multi: bool = ...): ...
def values(self, multi: bool = ...): ...
def items(self, multi: bool = ...): ...
def __iter__(self): ...
def __reversed__(self) -> Generator[Incomplete, None, None]: ...
def viewkeys(self): ...
def viewvalues(self): ...
def viewitems(self): ...
def fromkeys(
cls, keys: list[Any], default: Any | None = ...
) -> OrderedMultiDict: ...
def update(self, E: dict[Any, Any] | Iterable, **F: dict[str, Any]) -> None: ...
def update_extend(
self, E: dict[Any, Any] | Iterable, **F: dict[str, Any]
) -> None: ...
def __setitem__(self, k: Hashable, v: Any) -> None: ...
def __getitem__(self, k: Hashable) -> Any: ...
def __delitem__(self, k: Hashable) -> None: ...
def __eq__(self, other: OrderedMultiDict) -> bool: ...
def __ne__(self, other: OrderedMultiDict) -> bool: ...
def pop(self, k: Hashable, default: Any = ...) -> None: ...
def popall(self, k: Hashable, default: Any = ...) -> None: ...
def poplast(self, k: Hashable = ..., default: Any = ...) -> None: ...
def iteritems(self, multi: bool = ...) -> Generator[Any, None, None]: ...
def iterkeys(self, multi: bool = ...) -> Generator[Any, None, None]: ...
def itervalues(self, multi: bool = ...) -> Generator[Any, None, None]: ...
def todict(self, multi: bool = ...) -> dict[Hashable, Any]: ...
def sorted(
self, key: Any | None = ..., reverse: bool = ...
) -> OrderedMultiDict: ...
def sortedvalues(
self, key: Any | None = ..., reverse: bool = ...
) -> OrderedMultiDict: ...
def inverted(self) -> OrderedMultiDict: ...
def counts(self) -> OrderedMultiDict: ...
def keys(self, multi: bool = ...) -> list[Hashable]: ...
def values(self, multi: bool = ...) -> list[Any]: ...
def items(self, multi: bool = ...) -> list[Generator[Any, None, None]]: ...
def __iter__(self) -> Generator[Any, None, None]: ...
def __reversed__(self) -> Generator[Any, None, None]: ...
def viewkeys(self) -> KeysView: ...
def viewvalues(self) -> ValuesView: ...
def viewitems(self) -> ItemsView: ...

OMD = OrderedMultiDict
MultiDict = OrderedMultiDict

class FastIterOrderedMultiDict(OrderedMultiDict):
def iteritems(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ...
def iterkeys(self, multi: bool = ...) -> Generator[Incomplete, None, None]: ...
def __reversed__(self) -> Generator[Incomplete, None, None]: ...
def iteritems(self, multi: bool = ...) -> Generator[Any, None, None]: ...
def iterkeys(self, multi: bool = ...) -> Generator[Any, None, None]: ...
def __reversed__(self) -> Generator[Any, None, None]: ...

class OneToOne(dict):
inv: Incomplete
inv: OneToOne
def __init__(self, *a, **kw) -> None: ...
@classmethod
def unique(cls, *a, **kw): ...
def __setitem__(self, key, val) -> None: ...
def __delitem__(self, key) -> None: ...
def __setitem__(self, key: Hashable, val: Hashable) -> None: ...
def __delitem__(self, key: Hashable) -> None: ...
def clear(self) -> None: ...
def copy(self): ...
def pop(self, key, default=...): ...
def popitem(self): ...
def setdefault(self, key, default: Incomplete | None = ...): ...
def update(self, dict_or_iterable, **kw) -> None: ...
def copy(self) -> OneToOne: ...
def pop(self, key: Hashable, default: Any = ...) -> Hashable: ...
def popitem(self) -> tuple[Hashable, Hashable]: ...
def setdefault(self, key, default: Any = ...) -> Hashable: ...
def update(
self, dict_or_iterable: dict | Iterable, **kw: dict[Hashable, Any]
) -> None: ...

class ManyToMany:
data: Incomplete
inv: Incomplete
def __init__(self, items: Incomplete | None = ...) -> None: ...
def get(self, key, default=...): ...
def __getitem__(self, key): ...
def __setitem__(self, key, vals) -> None: ...
def __delitem__(self, key) -> None: ...
def update(self, iterable) -> None: ...
def add(self, key, val) -> None: ...
def remove(self, key, val) -> None: ...
def replace(self, key, newkey) -> None: ...
def iteritems(self) -> Generator[Incomplete, None, None]: ...
def keys(self): ...
def __contains__(self, key): ...
def __iter__(self): ...
def __len__(self): ...
def __eq__(self, other): ...
data: dict[Hashable, Any]
inv: ManyToMany
def __init__(self, items: tuple[Hashable] | dict[Hashable, Any] = ...) -> None: ...
def get(self, key: Hashable, default: Any = ...) -> Any: ...
def __getitem__(self, key: Hashable) -> Any: ...
def __setitem__(self, key: Hashable, vals: Iterable) -> None: ...
def __delitem__(self, key: Hashable) -> None: ...
def update(self, iterable: Iterable) -> None: ...
def add(self, key: Hashable, val: Any) -> None: ...
def remove(self, key: Hashable, val: Any) -> None: ...
def replace(self, key: Hashable, newkey: Hashable) -> None: ...
def iteritems(self) -> Generator[Hashable, Any]: ...
def keys(self) -> Iterable[Hashable]: ...
def __contains__(self, key: Hashable) -> bool: ...
def __iter__(self) -> Iterator: ...
def __len__(self) -> int: ...
def __eq__(self, other) -> bool: ...

def subdict(d, keep: Incomplete | None = ..., drop: Incomplete | None = ...): ...
def subdict(
d, keep: dict[Hashable, Any] | None = ..., drop: list[Hashable] | None = ...
): ...

class FrozenHashError(TypeError): ...

class FrozenDict(dict):
def updated(self, *a, **kw): ...
@classmethod
def fromkeys(cls, keys, value: Incomplete | None = ...): ...
def fromkeys(cls, keys: Iterable | None, value: Any | None = ...): ...
def __reduce_ex__(self, protocol): ...
def __hash__(self): ...
def __copy__(self): ...
__ior__: Incomplete
__setitem__: Incomplete
__delitem__: Incomplete
update: Incomplete
setdefault: Incomplete
pop: Incomplete
popitem: Incomplete
clear: Incomplete
def __hash__(self) -> int: ...
def __copy__(self) -> FrozenDict: ...
__ior__: Callable[[Any], Never]
__setitem__: Callable[[Any], Never]
__delitem__: Callable[[Any], Never]
update: Callable[[Any], Never]
setdefault: Callable[[Any], Never]
pop: Callable[[Any], Never]
popitem: Callable[[Any], Never]
clear: Callable[[Any], Never]

0 comments on commit 2b81822

Please sign in to comment.