Skip to content

Commit 2db1ba4

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
1 parent 3ee0c68 commit 2db1ba4

1 file changed

Lines changed: 7 additions & 41 deletions

File tree

stubs/cachetools/cachetools/__init__.pyi

Lines changed: 7 additions & 41 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
def wait(self, timeout: float | None = None) -> bool: ...
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(self, n: int = 1) -> None: ...
146113
def notify_all(self) -> None: ...
147114

@@ -177,7 +144,6 @@ def cached(
177144
condition: _AbstractCondition | None = None,
178145
info: Literal[False] = ...,
179146
) -> Callable[[Callable[..., _R]], _cached_wrapper[_R]]: ...
180-
181147
@type_check_only
182148
class _cachedmethod_wrapper(Generic[_R]):
183149
__wrapped__: Callable[..., _R]

0 commit comments

Comments
 (0)