11from datetime import datetime
2- from typing import Any , Mapping , Iterable , Tuple
2+ from typing import Any , Mapping , Iterable , Tuple , Callable , Optional
33
44def jump_consistent_hash (key : int , num_bucket : int ) -> int : pass
55
66def strhash (s : str ) -> int : ...
77
88def int8_to_datetime (date_integer : int ) -> datetime : ...
99
10+ dict .setdefault ()
1011
1112class LFUCache :
1213
1314 def __init__ (self , capacity : int ) -> None : ...
1415
15- def get (self , key , default = None ) -> Any : ...
16-
17- def pop (self , key , default = None ) -> Any : ...
18-
19- def setdefault (self , key , default = None ) -> Any : ...
20-
21- def update (self , map : Mapping , ** kwargs ) -> None : ...
22-
23- def keys (self ) -> Iterable : ...
24-
25- def values (self ) -> Iterable : ...
16+ def get (self , key , default = None ):
17+ """ Return the value for key if key is in the cache, else default. """
18+ pass
2619
27- def items (self ) -> Iterable [Tuple ]: ...
20+ def pop (self , key , default = None ): # real signature unknown; restored from __doc__
21+ """
22+ Cache.pop(k[,default]) -> v, remove specified key and return the corresponding value.
23+ If key is not found, default is returned
24+ """
25+ pass
2826
29- def clear (self ): ...
27+ def setdefault (self , * args , ** kwargs ): # real signature unknown
28+ """
29+ Insert key with a value of default if key is not in the dictionary.
3030
31- def __contains__ ( self , * args , ** kwargs ): # real signature unknown
32- """ True if the dictionary has the specified key, else False. """
31+ Return the value for key if key is in the dictionary, else default.
32+ """
3333 pass
3434
35- def __delitem__ (self , * args , ** kwargs ): # real signature unknown
36- """ Delete self[key]. """
35+ def update (self , mp : Optional [Mapping ] = None , ** kwargs ): # known special case of dict.update
36+ """
37+ Cache.update([mp, ]**kwargs) -> None. Update Cache from dict/iterable mp and kwargs.
38+ If mp is present then does: for k in mp: Cache[k] = mp[k]
39+ In either case, this is followed by: for k in kwargs: Cache[k] = kwargs[k]
40+ """
3741 pass
3842
39- def __eq__ (self , * args , ** kwargs ): # real signature unknown
40- """ Return self==value. """
43+ def keys (self ) -> Iterable :
44+ """Return key list. """
4145 pass
4246
43- def __getattribute__ (self , * args , ** kwargs ): # real signature unknown
44- """ Return getattr(self, name). """
47+ def values (self ) -> Iterable :
48+ """Return value list. """
4549 pass
4650
47- def __getitem__ (self , y ): # real signature unknown; restored from __doc__
48- """ x.__getitem__(y) <==> x[y] """
51+ def items (self ) -> Iterable [ Tuple ]:
52+ """Return (k, v) pairs list. """
4953 pass
5054
51- def __ge__ (self , * args , ** kwargs ): # real signature unknown
52- """ Return self>=value . """
55+ def clear (self ):
56+ """ Cache.clear() -> None. Remove all items from Cache . """
5357 pass
5458
55- def __gt__ (self , * args , ** kwargs ): # real signature unknown
56- """ Return self>value . """
59+ def __contains__ (self , key ): # real signature unknown
60+ """ True if the dictionary has the specified key, else False . """
5761 pass
5862
59- def __iter__ (self , * args , ** kwargs ): # real signature unknown
60- """ Implement iter( self) . """
63+ def __delitem__ (self , key ): # real signature unknown
64+ """ Delete self[key] . """
6165 pass
6266
63- def __len__ (self , * args , ** kwargs ): # real signature unknown
64- """ Return len( self) . """
67+ def __setitem__ (self , key , value ): # real signature unknown
68+ """ self[key] = value . """
6569 pass
6670
67- def __le__ (self , * args , ** kwargs ): # real signature unknown
68- """ Return self<=value. """
71+ def __getitem__ (self , key ): # real signature unknown; restored from __doc__
72+ """ Return self[key] """
6973 pass
7074
71- def __lt__ (self , * args , ** kwargs ): # real signature unknown
72- """ Return self<value . """
75+ def __len__ (self , * args , ** kwargs ): # real signature unknown
76+ """ Return len( self) . """
7377 pass
7478
7579 def evict (self ) -> None : ...
@@ -80,4 +84,10 @@ class LFUCache:
8084
8185 def lfu (self ) -> Any : ...
8286
83- def lfu_of (self , key : Any ) -> int : ...
87+ def setnx (self , key , callback : Callable [[], Any ]):
88+ """
89+ Insert key with a value of callback() if key is not in the dictionary.
90+
91+ Return the value for key if key is in the dictionary, else callback().
92+ """
93+ pass
0 commit comments