codekingpro/portable-devtools
114k
1from collections.abc import (
2 ItemsView,
3 Iterable,
4 Iterator,
5 KeysView,
6 Mapping,
7 ValuesView,
8)
9from typing import (
10 TypeVar,
11)
12
13_T = TypeVar("_T")
14_KT_co = TypeVar("_KT_co", covariant=True)
15_VT_co = TypeVar("_VT_co", covariant=True)
16_KU_co = TypeVar("_KU_co", covariant=True)
17_VU_co = TypeVar("_VU_co", covariant=True)
18
19class HashTrieMap(Mapping[_KT_co, _VT_co]):
20 def __init__(
21 self,
22 value: Mapping[_KT_co, _VT_co] | Iterable[tuple[_KT_co, _VT_co]] = {},
23 **kwds: Mapping[_KT_co, _VT_co],
24 ): ...
25 def __getitem__(self, key: _KT_co) -> _VT_co: ...
26 def __iter__(self) -> Iterator[_KT_co]: ...
27 def __len__(self) -> int: ...
28 def discard(self, key: _KT_co) -> HashTrieMap[_KT_co, _VT_co]: ...
29 def items(self) -> ItemsView[_KT_co, _VT_co]: ...
30 def keys(self) -> KeysView[_KT_co]: ...
31 def values(self) -> ValuesView[_VT_co]: ...
32 def remove(self, key: _KT_co) -> HashTrieMap[_KT_co, _VT_co]: ...
33 def insert(
34 self,
35 key: _KT_co,
36 val: _VT_co,
37 ) -> HashTrieMap[_KT_co, _VT_co]: ...
38 def update(
39 self,
40 *args: Mapping[_KU_co, _VU_co] | Iterable[tuple[_KU_co, _VU_co]],
41 ) -> HashTrieMap[_KT_co | _KU_co, _VT_co | _VU_co]: ...
42 @classmethod
43 def convert(
44 cls,
45 value: Mapping[_KT_co, _VT_co] | Iterable[tuple[_KT_co, _VT_co]],
46 ) -> HashTrieMap[_KT_co, _VT_co]: ...
47 @classmethod
48 def fromkeys(
49 cls,
50 keys: Iterable[_KT_co],
51 value: _VT_co = None,
52 ) -> HashTrieMap[_KT_co, _VT_co]: ...
53
54class HashTrieSet(frozenset[_T]):
55 def __init__(self, value: Iterable[_T] = ()): ...
56 def __iter__(self) -> Iterator[_T]: ...
57 def __len__(self) -> int: ...
58 def discard(self, value: _T) -> HashTrieSet[_T]: ...
59 def remove(self, value: _T) -> HashTrieSet[_T]: ...
60 def insert(self, value: _T) -> HashTrieSet[_T]: ...
61 def update(self, *args: Iterable[_T]) -> HashTrieSet[_T]: ...
62
63class List(Iterable[_T]):
64 def __init__(self, value: Iterable[_T] = (), *more: _T): ...
65 def __iter__(self) -> Iterator[_T]: ...
66 def __len__(self) -> int: ...
67 def push_front(self, value: _T) -> List[_T]: ...
68 def drop_first(self) -> List[_T]: ...
69
70class Queue(Iterable[_T]):
71 def __init__(self, value: Iterable[_T] = (), *more: _T): ...
72 def __iter__(self) -> Iterator[_T]: ...
73 def __len__(self) -> int: ...
74 def enqueue(self, value: _T) -> Queue[_T]: ...
75 def dequeue(self, value: _T) -> Queue[_T]: ...
76 @property
77 def is_empty(self) -> _T: ...
78 @property
79 def peek(self) -> _T: ...
80 