Skip to content

Commit 11ed2a4

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
1 parent 6cc21db commit 11ed2a4

File tree

3 files changed

+18
-75
lines changed

3 files changed

+18
-75
lines changed

stubs/cachetools/cachetools/__init__.pyi

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,9 @@
11
import random
22
from collections.abc import Callable, Iterator, MutableMapping, Sequence
33
from contextlib import AbstractContextManager
4-
from typing import (
5-
Any,
6-
Final,
7-
Generic,
8-
Literal,
9-
NamedTuple,
10-
Protocol,
11-
TypeVar,
12-
overload,
13-
type_check_only,
14-
)
15-
16-
__all__: Final = (
17-
"Cache",
18-
"FIFOCache",
19-
"LFUCache",
20-
"LRUCache",
21-
"RRCache",
22-
"TLRUCache",
23-
"TTLCache",
24-
"cached",
25-
"cachedmethod",
26-
)
4+
from typing import Any, Final, Generic, Literal, NamedTuple, Protocol, TypeVar, overload, type_check_only
5+
6+
__all__: Final = ("Cache", "FIFOCache", "LFUCache", "LRUCache", "RRCache", "TLRUCache", "TTLCache", "cached", "cachedmethod")
277
__version__: str
288

299
_KT = TypeVar("_KT")
@@ -35,9 +15,7 @@ _KT2 = TypeVar("_KT2")
3515
_VT2 = TypeVar("_VT2")
3616

3717
class Cache(MutableMapping[_KT, _VT]):
38-
def __init__(
39-
self, maxsize: float, getsizeof: Callable[[_VT], float] | None = None
40-
) -> None: ...
18+
def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = None) -> None: ...
4119
def __getitem__(self, key: _KT) -> _VT: ...
4220
def __setitem__(self, key: _KT, value: _VT) -> None: ...
4321
def __delitem__(self, key: _KT) -> None: ...
@@ -71,12 +49,7 @@ class RRCache(Cache[_KT, _VT]):
7149
def choice(self) -> Callable[[Sequence[_KT]], _KT]: ...
7250

7351
class _TimedCache(Cache[_KT, _VT], Generic[_KT, _VT, _TT]):
74-
def __init__(
75-
self,
76-
maxsize: float,
77-
timer: Callable[[], _TT],
78-
getsizeof: Callable[[_VT], float] | None = None,
79-
) -> None: ...
52+
def __init__(self, maxsize: float, timer: Callable[[], _TT], getsizeof: Callable[[_VT], float] | None = None) -> None: ...
8053

8154
class _Timer(AbstractContextManager[_T]):
8255
def __init__(self, timer: Callable[[], _T]) -> None: ...
@@ -91,11 +64,7 @@ class _TimedCache(Cache[_KT, _VT], Generic[_KT, _VT, _TT]):
9164
class TTLCache(_TimedCache[_KT, _VT, _TT]):
9265
@overload
9366
def __init__(
94-
self: TTLCache[_KT2, _VT2, float],
95-
maxsize: float,
96-
ttl: float,
97-
*,
98-
getsizeof: Callable[[_VT2], float] | None = None,
67+
self: TTLCache[_KT2, _VT2, float], maxsize: float, ttl: float, *, getsizeof: Callable[[_VT2], float] | None = None
9968
) -> None: ...
10069
@overload
10170
def __init__(
@@ -139,9 +108,7 @@ class _CacheInfo(NamedTuple):
139108
@type_check_only
140109
class _AbstractCondition(AbstractContextManager[Any], Protocol):
141110
# implementation an unit tests do not use plain wait() and notify()
142-
def wait_for(
143-
self, predicate: Callable[[], _T], timeout: float | None = None
144-
) -> _T: ...
111+
def wait_for(self, predicate: Callable[[], _T], timeout: float | None = None) -> _T: ...
145112
def notify_all(self) -> None: ...
146113

147114
@type_check_only

stubs/cachetools/cachetools/func.pyi

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,28 @@ def fifo_cache(
2121
maxsize: int | None = 128, typed: bool = False
2222
) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
2323
@overload
24-
def fifo_cache(
25-
maxsize: Callable[..., _R], typed: bool = False
26-
) -> _cachetools_cache_wrapper[_R]: ...
24+
def fifo_cache(maxsize: Callable[..., _R], typed: bool = False) -> _cachetools_cache_wrapper[_R]: ...
2725
@overload
28-
def lfu_cache(
29-
maxsize: int | None = 128, typed: bool = False
30-
) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
26+
def lfu_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
3127
@overload
32-
def lfu_cache(
33-
maxsize: Callable[..., _R], typed: bool = False
34-
) -> _cachetools_cache_wrapper[_R]: ...
28+
def lfu_cache(maxsize: Callable[..., _R], typed: bool = False) -> _cachetools_cache_wrapper[_R]: ...
3529
@overload
36-
def lru_cache(
37-
maxsize: int | None = 128, typed: bool = False
38-
) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
30+
def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
3931
@overload
40-
def lru_cache(
41-
maxsize: Callable[..., _R], typed: bool = False
42-
) -> _cachetools_cache_wrapper[_R]: ...
32+
def lru_cache(maxsize: Callable[..., _R], typed: bool = False) -> _cachetools_cache_wrapper[_R]: ...
4333
@overload
4434
def rr_cache(
45-
maxsize: int | None = 128,
46-
choice: Callable[[Sequence[_T]], _T] = ...,
47-
typed: bool = False,
35+
maxsize: int | None = 128, choice: Callable[[Sequence[_T]], _T] = ..., typed: bool = False
4836
) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
4937
@overload
5038
def rr_cache(
51-
maxsize: Callable[..., _R],
52-
choice: Callable[[Sequence[_T]], _T] = ...,
53-
typed: bool = False,
39+
maxsize: Callable[..., _R], choice: Callable[[Sequence[_T]], _T] = ..., typed: bool = False
5440
) -> _cachetools_cache_wrapper[_R]: ...
5541
@overload
5642
def ttl_cache(
57-
maxsize: int | None = 128,
58-
ttl: Any = 600,
59-
timer: Callable[[], _T] = ...,
60-
typed: bool = False,
43+
maxsize: int | None = 128, ttl: Any = 600, timer: Callable[[], _T] = ..., typed: bool = False
6144
) -> Callable[[Callable[..., _R]], _cachetools_cache_wrapper[_R]]: ...
6245
@overload
6346
def ttl_cache(
64-
maxsize: Callable[..., _R],
65-
ttl: Any = 600,
66-
timer: Callable[[], _T] = ...,
67-
typed: bool = False,
47+
maxsize: Callable[..., _R], ttl: Any = 600, timer: Callable[[], _T] = ..., typed: bool = False
6848
) -> _cachetools_cache_wrapper[_R]: ...

stubs/cachetools/cachetools/keys.pyi

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ from typing import Final
55
__all__: Final = ("hashkey", "methodkey", "typedkey", "typedmethodkey")
66

77
def hashkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
8-
def methodkey(
9-
self: Unused, /, *args: Hashable, **kwargs: Hashable
10-
) -> tuple[Hashable, ...]: ...
8+
def methodkey(self: Unused, /, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
119
def typedkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
12-
def typedmethodkey(
13-
self: Unused, /, *args: Hashable, **kwargs: Hashable
14-
) -> tuple[Hashable, ...]: ...
10+
def typedmethodkey(self: Unused, /, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...

0 commit comments

Comments
 (0)