Skip to content

Commit 23840d8

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
1 parent eb4c33e commit 23840d8

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

stubs/cachetools/cachetools/__init__.pyi

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from collections.abc import Callable, Iterator, MutableMapping, Sequence
2-
from contextlib import AbstractContextManager
31
import random
42
import time
3+
from collections.abc import Callable, Iterator, MutableMapping, Sequence
4+
from contextlib import AbstractContextManager
55
from typing import Any, Final, Generic, Literal, NamedTuple, Protocol, TypeVar, overload, type_check_only
66

77
__all__: Final = ("Cache", "FIFOCache", "LFUCache", "LRUCache", "RRCache", "TLRUCache", "TTLCache", "cached", "cachedmethod")
@@ -38,12 +38,19 @@ class LFUCache(Cache[_KT, _VT]): ...
3838
class LRUCache(Cache[_KT, _VT]): ...
3939

4040
class RRCache(Cache[_KT, _VT]):
41-
def __init__(self, maxsize: float, choice: Callable[[Sequence[_KT]], _KT] = random.choice, getsizeof: Callable[[_VT], float] | None = None) -> None: ...
41+
def __init__(
42+
self,
43+
maxsize: float,
44+
choice: Callable[[Sequence[_KT]], _KT] = random.choice,
45+
getsizeof: Callable[[_VT], float] | None = None,
46+
) -> None: ...
4247
@property
4348
def choice(self) -> Callable[[Sequence[_KT]], _KT]: ...
4449

45-
class _TimedCache[_KT, _VT, _TT](Cache[_KT, _VT]):
46-
def __init__(self, maxsize: float, timer: Callable[..., _TT] = time.monotonic, getsizeof: Callable[[_VT], float] | None = None): ...
50+
class _TimedCache[KT, VT, TT](Cache[KT, VT]):
51+
def __init__(
52+
self, maxsize: float, timer: Callable[..., _TT] = time.monotonic, getsizeof: Callable[[_VT], float] | None = None
53+
): ...
4754

4855
class _Timer:
4956
def __init__(self, timer: Callable[[], _TT]) -> None: ...
@@ -57,13 +64,25 @@ class _TimedCache[_KT, _VT, _TT](Cache[_KT, _VT]):
5764

5865
# FIXME: ttl should be "addable" to _TT
5966
class TTLCache(_TimedCache[_KT, _VT, _TT]):
60-
def __init__(self, maxsize: float, ttl: Any, timer: Callable[..., _TT] = time.monotonic, getsizeof: Callable[[_VT], float] | None = None): ...
67+
def __init__(
68+
self,
69+
maxsize: float,
70+
ttl: Any,
71+
timer: Callable[..., _TT] = time.monotonic,
72+
getsizeof: Callable[[_VT], float] | None = None,
73+
): ...
6174
@property
6275
def ttl(self) -> Any: ...
6376
def expire(self, time: _TT | None = None) -> list[tuple[_KT, _VT]]: ...
6477

6578
class TLRUCache(_TimedCache[_KT, _VT, _TT]):
66-
def __init__(self, maxsize: float, ttu: Callable[[_KT, _VT, _TT], _TT], timer: Callable[..., _TT] = time.monotonic, getsizeof: Callable[[_VT], float] | None = None): ...
79+
def __init__(
80+
self,
81+
maxsize: float,
82+
ttu: Callable[[_KT, _VT, _TT], _TT],
83+
timer: Callable[..., _TT] = time.monotonic,
84+
getsizeof: Callable[[_VT], float] | None = None,
85+
): ...
6786
@property
6887
def ttu(self) -> Callable[[_KT, _VT, _TT], _TT]: ...
6988
def expire(self, time: _TT | None = None) -> list[tuple[_KT, _VT]]: ...

0 commit comments

Comments
 (0)