mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-04 17:12:47 +08:00
Re-organize directory structure (#4971)
See discussion in #2491 Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
This commit is contained in:
2
stubs/cachetools/METADATA.toml
Normal file
2
stubs/cachetools/METADATA.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
version = "0.1"
|
||||
python2 = true
|
||||
6
stubs/cachetools/cachetools/__init__.pyi
Normal file
6
stubs/cachetools/cachetools/__init__.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from .cache import Cache as Cache
|
||||
from .decorators import cached as cached, cachedmethod as cachedmethod
|
||||
from .lfu import LFUCache as LFUCache
|
||||
from .lru import LRUCache as LRUCache
|
||||
from .rr import RRCache as RRCache
|
||||
from .ttl import TTLCache as TTLCache
|
||||
7
stubs/cachetools/cachetools/abc.pyi
Normal file
7
stubs/cachetools/cachetools/abc.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from abc import ABCMeta
|
||||
from typing import MutableMapping, TypeVar
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
|
||||
class DefaultMapping(MutableMapping[_KT, _VT], metaclass=ABCMeta): ...
|
||||
20
stubs/cachetools/cachetools/cache.pyi
Normal file
20
stubs/cachetools/cachetools/cache.pyi
Normal file
@@ -0,0 +1,20 @@
|
||||
from typing import Callable, Generic, Iterator, Optional, TypeVar
|
||||
|
||||
from .abc import DefaultMapping as DefaultMapping
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
|
||||
class Cache(DefaultMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __init__(self, maxsize: int, getsizeof: Optional[Callable[[_VT], int]] = ...) -> None: ...
|
||||
def __getitem__(self, key: _KT) -> _VT: ...
|
||||
def __setitem__(self, key: _KT, value: _VT) -> None: ...
|
||||
def __delitem__(self, key: _KT) -> None: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@property
|
||||
def maxsize(self) -> int: ...
|
||||
@property
|
||||
def currsize(self) -> int: ...
|
||||
@staticmethod
|
||||
def getsizeof(value: _VT) -> int: ...
|
||||
16
stubs/cachetools/cachetools/decorators.pyi
Normal file
16
stubs/cachetools/cachetools/decorators.pyi
Normal file
@@ -0,0 +1,16 @@
|
||||
from typing import Any, Callable, ContextManager, MutableMapping, Optional, TypeVar
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
_T = TypeVar("_T", bound=Callable[..., Any])
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
_T_self = TypeVar("_T_self")
|
||||
|
||||
def cached(
|
||||
cache: Optional[MutableMapping[_KT, _VT]], key: Callable[..., _KT] = ..., lock: Optional[ContextManager[_T_co]] = ...
|
||||
) -> Callable[[_T], _T]: ...
|
||||
def cachedmethod(
|
||||
cache: Callable[[_T_self], Optional[MutableMapping[_KT, _VT]]],
|
||||
key: Callable[..., _KT] = ...,
|
||||
lock: Optional[ContextManager[_T_co]] = ...,
|
||||
) -> Callable[[_T], _T]: ...
|
||||
11
stubs/cachetools/cachetools/func.pyi
Normal file
11
stubs/cachetools/cachetools/func.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from typing import Any, Callable, Optional, Sequence, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
_RET = Callable[[_F], _F]
|
||||
|
||||
def lfu_cache(maxsize: int = ..., typed: bool = ...) -> _RET: ...
|
||||
def lru_cache(maxsize: int = ..., typed: bool = ...) -> _RET: ...
|
||||
def rr_cache(maxsize: int = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...) -> _RET: ...
|
||||
def ttl_cache(maxsize: int = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> _RET: ...
|
||||
14
stubs/cachetools/cachetools/lfu.pyi
Normal file
14
stubs/cachetools/cachetools/lfu.pyi
Normal file
@@ -0,0 +1,14 @@
|
||||
from typing import Callable, Iterator, Optional, TypeVar
|
||||
|
||||
from .cache import Cache
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
|
||||
class LFUCache(Cache[_KT, _VT]):
|
||||
def __init__(self, maxsize: int, getsizeof: Optional[Callable[[_VT], int]] = ...) -> None: ...
|
||||
def __getitem__(self, key: _KT, cache_getitem: Callable[[_KT], _VT] = ...) -> _VT: ...
|
||||
def __setitem__(self, key: _KT, value: _VT, cache_setitem: Callable[[_KT, _VT], None] = ...) -> None: ...
|
||||
def __delitem__(self, key: _KT, cache_delitem: Callable[[_KT], None] = ...) -> None: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __len__(self) -> int: ...
|
||||
13
stubs/cachetools/cachetools/lru.pyi
Normal file
13
stubs/cachetools/cachetools/lru.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from typing import Callable, Iterator, Optional, TypeVar
|
||||
|
||||
from .cache import Cache as Cache
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
|
||||
class LRUCache(Cache[_KT, _VT]):
|
||||
def __init__(self, maxsize: int, getsizeof: Optional[Callable[[_VT], int]] = ...) -> None: ...
|
||||
def __getitem__(self, key: _KT, cache_getitem: Callable[[_KT], _VT] = ...) -> _VT: ...
|
||||
def __setitem__(self, key: _KT, value: _VT, cache_setitem: Callable[[_KT, _VT], None] = ...) -> None: ...
|
||||
def __delitem__(self, key: _KT, cache_delitem: Callable[[_KT], None] = ...) -> None: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
21
stubs/cachetools/cachetools/rr.pyi
Normal file
21
stubs/cachetools/cachetools/rr.pyi
Normal file
@@ -0,0 +1,21 @@
|
||||
from typing import Callable, Iterator, Optional, Sequence, TypeVar
|
||||
|
||||
from .cache import Cache as Cache
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
|
||||
class RRCache(Cache[_KT, _VT]):
|
||||
def __init__(
|
||||
self,
|
||||
maxsize: int,
|
||||
choice: Optional[Callable[[Sequence[_KT]], _KT]] = ...,
|
||||
getsizeof: Optional[Callable[[_VT], int]] = ...,
|
||||
) -> None: ...
|
||||
def __getitem__(self, key: _KT) -> _VT: ...
|
||||
def __setitem__(self, key: _KT, value: _VT) -> None: ...
|
||||
def __delitem__(self, key: _KT) -> None: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@property
|
||||
def choice(self) -> Callable[[Sequence[_KT]], _KT]: ...
|
||||
23
stubs/cachetools/cachetools/ttl.pyi
Normal file
23
stubs/cachetools/cachetools/ttl.pyi
Normal file
@@ -0,0 +1,23 @@
|
||||
from typing import Callable, Iterator, Optional, TypeVar
|
||||
|
||||
from .cache import Cache
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
|
||||
class TTLCache(Cache[_KT, _VT]):
|
||||
def __init__(
|
||||
self, maxsize: int, ttl: float, timer: Callable[[], float] = ..., getsizeof: Optional[Callable[[_VT], int]] = ...
|
||||
) -> None: ...
|
||||
def __getitem__(self, key: _KT, cache_getitem: Callable[[_KT], _VT] = ...) -> _VT: ...
|
||||
def __setitem__(self, key: _KT, value: _VT, cache_setitem: Callable[[_KT, _VT], None] = ...) -> None: ...
|
||||
def __delitem__(self, key: _KT, cache_delitem: Callable[[_KT], None] = ...) -> None: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@property
|
||||
def currsize(self) -> int: ...
|
||||
@property
|
||||
def timer(self) -> Callable[[], float]: ...
|
||||
@property
|
||||
def ttl(self) -> float: ...
|
||||
def expire(self, time: Optional[Callable[[], float]] = ...) -> None: ...
|
||||
Reference in New Issue
Block a user