Module Expr Str Assign NameStore ListLoad Str Str Str Str Import alias ImportFrom alias TryExcept body ImportFrom alias handlers ExceptHandler type NameLoad body ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Pass decorator_list decorator_list TryExcept body ImportFrom alias Assign NameStore Call NameLoad keyword Str Assign NameStore Call NameLoad keyword Str handlers ExceptHandler type NameLoad body Assign NameStore Call NameLoad Assign NameStore Call NameLoad TryExcept body Expr NameLoad handlers ExceptHandler type NameLoad body Assign NameStore NameLoad Assign TupleStore NameStore NameStore NameStore NameStore Call NameLoad Num Assign NameStore Num ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body If CompareLtE NameLoad Num body Raise Call NameLoad BinOpMod Str NameLoad Assign AttributeStore NameLoad attr AttributeStore NameLoad attr AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Expr Call AttributeLoad NameLoad attr If BoolOpAnd CompareIsNot NameLoad NameLoad UnaryOpNot Call NameLoad NameLoad body Raise Call NameLoad BinOpMod Str NameLoad Assign AttributeStore NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore ListLoad Assign SubscriptStore NameLoad Slice ListLoad NameLoad NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad NameLoad attr Print Str While NameLoad body Print TupleLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad If CompareIs NameLoad AttributeLoad NameLoad attr body Break Print Str Return decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index NameLoad SubscriptStore NameLoad Index NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore ListLoad NameLoad NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad SubscriptStore NameLoad Index NameLoad NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign AttributeStore NameLoad attr NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index NameLoad SubscriptStore NameLoad Index NameLoad NameLoad Delete SubscriptDel AttributeLoad NameLoad attr Index NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body With AttributeLoad NameLoad attr body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body If CompareLt Call NameLoad NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad orelse Assign SubscriptStore NameLoad Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body With AttributeLoad NameLoad attr body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body AugAssignAdd AttributeStore NameLoad attr Num If UnaryOpNot AttributeLoad NameLoad attr body Raise Assign NameStore SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr NameLoad Return NameLoad AugAssignAdd AttributeStore NameLoad attr Num Return SubscriptLoad NameLoad Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body TryExcept body Return SubscriptLoad NameLoad Index NameLoad handlers ExceptHandler type NameLoad body AugAssignAdd AttributeStore NameLoad attr Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body With AttributeLoad NameLoad attr body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body With AttributeLoad NameLoad attr body TryExcept body Assign NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body If CompareIs NameLoad NameLoad body Raise Assign NameStore NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body With AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body With AttributeLoad NameLoad attr body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body With AttributeLoad NameLoad attr body TryExcept body Return SubscriptLoad NameLoad Index NameLoad handlers ExceptHandler type NameLoad body AugAssignAdd AttributeStore NameLoad attr Num Assign SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body With AttributeLoad NameLoad attr body If CompareIs NameLoad NameLoad body Return Assign NameStore AttributeLoad NameLoad attr If Call NameLoad Call NameLoad NameLoad Str NameLoad body For NameStore Call AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad orelse For TupleStore NameStore NameStore NameLoad body Expr Call NameLoad NameLoad NameLoad For NameStore NameLoad body Expr Call NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Return decorator_list FunctionDef arguments args NameParam NameParam defaults body With AttributeLoad NameLoad attr body If CompareIs NameLoad NameLoad body Return NameLoad If CompareNotEq Call NameLoad NameLoad Call NameLoad NameLoad body Return NameLoad If UnaryOpNot Call NameLoad NameLoad NameLoad body Return CompareEq NameLoad NameLoad Return Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return UnaryOpNot CompareEq NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr Return BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeStore NameLoad attr AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If CompareGtE Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Delete SubscriptDel NameLoad Index NameLoad Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body If CompareIs NameLoad NameLoad body Return Assign NameStore AttributeLoad NameLoad attr If Call NameLoad Call NameLoad NameLoad Str NameLoad body For NameStore Call AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad orelse For TupleStore NameStore NameStore NameLoad body Expr Call NameLoad NameLoad NameLoad For NameStore NameLoad body Expr Call NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Return decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body TryExcept body Assign NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body AugAssignAdd AttributeStore NameLoad attr Num If UnaryOpNot AttributeLoad NameLoad attr body Raise Assign NameStore SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr NameLoad Return NameLoad AugAssignAdd AttributeStore NameLoad attr Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body TryExcept body Return SubscriptLoad NameLoad Index NameLoad handlers ExceptHandler type NameLoad body AugAssignAdd AttributeStore NameLoad attr Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body TryExcept body Return SubscriptLoad NameLoad Index NameLoad handlers ExceptHandler type NameLoad body AugAssignAdd AttributeStore NameLoad attr Num Assign SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore Str FunctionDef arguments args NameParam NameParam defaults body Assign SubscriptStore NameLoad Slice NameLoad Assign AttributeStore NameLoad attr Call NameLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad Call NameLoad ListLoad NameLoad NameLoad NameLoad Call NameLoad NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad If NameLoad body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr ListComp Call NameLoad NameLoad comprehension NameStore NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr ListComp Call NameLoad NameLoad comprehension TupleStore NameStore NameStore NameLoad orelse If BoolOpAnd CompareEq Call NameLoad NameLoad Num CompareIn Call NameLoad SubscriptLoad NameLoad Index Num NameLoad body Return SubscriptLoad NameLoad Index Num Return Call NameLoad NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg kwarg body Assign NameStore Call NameLoad NameLoad NameLoad keyword AttributeLoad NameLoad attr TryExcept body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad handlers ExceptHandler type NameLoad body Assign NameStore SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr If AttributeLoad NameLoad attr body Return BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Return Call NameLoad NameLoad NameLoad keyword NameLoad decorator_list Return NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults Num body If UnaryOpNot CompareLtLt Num NameLoad Num body Raise Call NameLoad BinOpMod Str NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad BinOpDiv Num NameLoad Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str AugAssignAdd AttributeStore NameLoad attr Num TryExcept body AugAssignAdd SubscriptStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Num Num handlers ExceptHandler type NameLoad body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad ListLoad Num BinOpSub AttributeLoad NameLoad attr Num If CompareEq BinOpMod AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num body Assign AttributeStore NameLoad attr Call NameLoad ListComp TupleLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr CompareGt Call NameLoad NameLoad AttributeLoad NameLoad attr AugAssignAdd AttributeStore NameLoad attr Num Return decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If CompareLtE NameLoad Num body Return ListLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr keyword Lambda arguments args NameParam defaults SubscriptLoad SubscriptLoad NameLoad Index Num Index Num keyword NameLoad If BoolOpOr CompareIs NameLoad NameLoad CompareGtE NameLoad Call NameLoad NameLoad body Return NameLoad Return SubscriptLoad NameLoad Slice NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad ListComp NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BinOpSub AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BinOpDiv Call NameLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Num decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return CompareIn NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad NameLoad attr For NameStore NameLoad body Expr Yield SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Num decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad NameLoad attr For NameStore NameLoad body Expr Yield TupleLoad NameLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Num decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str TryExcept body Return SubscriptLoad NameLoad Index NameLoad handlers ExceptHandler type NameLoad body Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str If CompareIsNot NameLoad NameLoad body If Call NameLoad Call NameLoad NameLoad Str NameLoad body For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad orelse For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list
N/A N/A ``cacheutils`` contains consistent implementations of fundamental
cache types. Currently there are two to choose from:

  * :class:`LRI` - Least-recently inserted
  * :class:`LRU` - Least-recently used

Both caches are :class:`dict` subtypes, designed to be as
interchangeable as possible, to facilitate experimentation. A key
practice with performance enhancement with caching is ensuring that
the caching strategy is working. If the cache is constantly missing,
it is just adding more overhead and code complexity. The standard
statistics are:

  * ``hit_count`` - the number of times the queried key has been in
    the cache
  * ``miss_count`` - the number of times a key has been absent and/or
    fetched by the cache
  * ``soft_miss_count`` - the number of times a key has been absent,
    but a default has been provided by the caller, as with
    :meth:`dict.get` and :meth:`dict.setdefault`. Soft misses are a
    subset of misses, so this number is always less than or equal to
    ``miss_count``.

Additionally, ``cacheutils`` provides :class:`ThresholdCounter`, a
cache-like bounded counter useful for online statistics collection.

Learn more about `caching algorithms on Wikipedia
<https://en.wikipedia.org/wiki/Cache_algorithms#Examples>`_.

 N/A __all__ N/A LRI LRU cached ThresholdCache N/A itertools collections deque N/A N/A threading RLock N/A N/A N/A Exception N/A RLock N/A object N/A N/A Dummy reentrant lock for builds without threads __enter__ N/A N/A self N/A N/A N/A N/A __exit__ N/A N/A self exctype excinst exctb N/A N/A N/A N/A N/A N/A N/A typeutils make_sentinel N/A _MISSING N/A make_sentinel var_name _MISSING N/A _KWARG_MARK N/A make_sentinel var_name _KWARG_MARK N/A N/A N/A ImportError N/A N/A _MISSING N/A object N/A _KWARG_MARK N/A object N/A N/A N/A xrange N/A N/A N/A NameError N/A N/A xrange range N/A N/A PREV NEXT KEY VALUE N/A range 4 N/A DEFAULT_MAX_SIZE 128 LRU N/A dict N/A N/A The ``LRU`` is :class:`dict` subtype implementation of the
    *Least-Recently Used* caching strategy.

    Args:
        max_size (int): Max number of items to cache. Defaults to ``128``.
        values (iterable): Initial values for the cache. Defaults to ``None``.
        on_miss (callable): a callable which accepts a single argument, the
            key not present in the cache, and returns the value to be cached.

    >>> cap_cache = LRU(max_size=2)
    >>> cap_cache['a'], cap_cache['b'] = 'A', 'B'
    >>> from pprint import pprint as pp
    >>> pp(dict(cap_cache))
    {'a': 'A', 'b': 'B'}
    >>> [cap_cache['b'] for i in range(3)][0]
    'B'
    >>> cap_cache['c'] = 'C'
    >>> print(cap_cache.get('a'))
    None

    This cache is also instrumented with statistics
    collection. ``hit_count``, ``miss_count``, and ``soft_miss_count``
    are all integer members that can be used to introspect the
    performance of the cache. ("Soft" misses are misses that did not
    raise :exc:`KeyError`, e.g., ``LRU.get()`` or ``on_miss`` was used to
    cache a default.

    >>> cap_cache.hit_count, cap_cache.miss_count, cap_cache.soft_miss_count
    (3, 1, 1)

    Other than the size-limiting caching behavior and statistics,
    ``LRU`` acts like its parent class, the built-in Python :class:`dict`.
     __init__ N/A N/A self max_size values on_miss N/A DEFAULT_MAX_SIZE None None N/A N/A N/A max_size 0 N/A N/A N/A ValueError N/A expected max_size > 0, not %r max_size N/A N/A self hit_count N/A self miss_count N/A self soft_miss_count 0 N/A N/A self max_size max_size N/A N/A self _lock N/A RLock N/A N/A N/A self _init_ll N/A N/A N/A on_miss None N/A N/A callable on_miss N/A N/A N/A TypeError N/A expected on_miss to be a callable (or None), not %r on_miss N/A N/A self on_miss on_miss N/A values N/A N/A N/A N/A self update values N/A _init_ll N/A N/A self N/A N/A N/A anchor N/A N/A N/A anchor N/A N/A anchor anchor _MISSING _MISSING N/A N/A self _link_lookup N/A N/A N/A self _anchor anchor N/A _print_ll N/A N/A self N/A N/A N/A link N/A self _anchor N/A *** N/A True N/A N/A N/A N/A link N/A KEY N/A link N/A VALUE N/A link N/A link N/A NEXT N/A N/A link N/A self _anchor N/A N/A N/A *** N/A N/A _get_link_and_move_to_front_of_ll N/A N/A self key N/A N/A N/A newest N/A N/A self _link_lookup N/A key N/A N/A N/A newest N/A PREV N/A NEXT N/A newest N/A NEXT N/A N/A N/A newest N/A NEXT N/A PREV N/A newest N/A PREV N/A anchor N/A self _anchor N/A second_newest N/A anchor N/A PREV N/A N/A second_newest N/A NEXT N/A anchor N/A PREV newest N/A N/A newest N/A PREV second_newest N/A N/A newest N/A NEXT anchor N/A newest N/A _set_key_and_add_to_front_of_ll N/A N/A self key value N/A N/A N/A anchor N/A self _anchor N/A second_newest N/A anchor N/A PREV N/A newest N/A second_newest anchor key value N/A N/A second_newest N/A NEXT N/A anchor N/A PREV newest N/A N/A N/A self _link_lookup N/A key newest N/A _set_key_and_evict_last_in_ll N/A N/A self key value N/A N/A N/A oldanchor N/A self _anchor N/A N/A oldanchor N/A KEY key N/A N/A oldanchor N/A VALUE value N/A N/A self _anchor anchor N/A oldanchor N/A NEXT N/A evicted N/A anchor N/A KEY N/A N/A anchor N/A KEY N/A anchor N/A VALUE _MISSING N/A N/A N/A self _link_lookup N/A evicted N/A N/A N/A self _link_lookup N/A key oldanchor N/A evicted N/A _remove_from_ll N/A N/A self key N/A N/A N/A link N/A N/A N/A self _link_lookup pop key N/A N/A N/A link N/A PREV N/A NEXT N/A link N/A NEXT N/A N/A N/A link N/A NEXT N/A PREV N/A link N/A PREV N/A __setitem__ N/A N/A self key value N/A N/A N/A N/A self _lock N/A N/A N/A N/A link N/A N/A self _get_link_and_move_to_front_of_ll key N/A N/A N/A KeyError N/A N/A N/A N/A len self N/A self max_size N/A N/A N/A N/A self _set_key_and_add_to_front_of_ll key value N/A N/A evicted N/A N/A self _set_key_and_evict_last_in_ll key value N/A N/A N/A N/A super LRU self __delitem__ evicted N/A N/A N/A N/A super LRU self __setitem__ key value N/A N/A N/A link N/A VALUE value N/A __getitem__ N/A N/A self key N/A N/A N/A N/A self _lock N/A N/A N/A N/A link N/A N/A self _get_link_and_move_to_front_of_ll key N/A N/A N/A KeyError N/A N/A N/A self miss_count 1 N/A N/A N/A self on_miss N/A N/A N/A ret N/A self N/A key N/A N/A self on_miss key N/A ret N/A N/A self hit_count 1 N/A N/A link N/A VALUE N/A get N/A N/A self key default N/A None N/A N/A N/A N/A N/A self N/A key N/A N/A N/A KeyError N/A N/A N/A self soft_miss_count 1 N/A default N/A __delitem__ N/A N/A self key N/A N/A N/A N/A self _lock N/A N/A N/A N/A N/A super LRU self __delitem__ key N/A N/A N/A self _remove_from_ll key N/A pop N/A N/A self key default N/A _MISSING N/A N/A N/A self _lock N/A N/A N/A N/A ret N/A N/A N/A super LRU self pop key N/A N/A N/A KeyError N/A N/A N/A default _MISSING N/A N/A N/A ret default N/A N/A N/A N/A self _remove_from_ll key N/A ret N/A popitem N/A N/A self N/A N/A N/A N/A self _lock N/A N/A item N/A N/A N/A super LRU self popitem N/A N/A N/A self _remove_from_ll N/A item N/A 0 N/A item N/A clear N/A N/A self N/A N/A N/A N/A self _lock N/A N/A N/A N/A N/A super LRU self clear N/A N/A N/A self _init_ll N/A copy N/A N/A self N/A N/A N/A N/A N/A self __class__ max_size N/A self max_size values self N/A setdefault N/A N/A self key default N/A None N/A N/A N/A self _lock N/A N/A N/A N/A N/A self N/A key N/A N/A N/A KeyError N/A N/A N/A self soft_miss_count 1 N/A N/A self N/A key default N/A default N/A update N/A N/A self E N/A F N/A N/A N/A self _lock N/A N/A N/A E self N/A N/A N/A setitem N/A self __setitem__ N/A N/A callable N/A getattr E keys None N/A N/A k N/A N/A E keys N/A N/A N/A setitem k N/A E N/A k N/A N/A N/A k v E N/A N/A N/A setitem k v N/A k F N/A N/A N/A setitem k N/A F N/A k N/A N/A __eq__ N/A N/A self other N/A N/A N/A N/A self _lock N/A N/A N/A self other N/A N/A True N/A N/A N/A len other N/A len self N/A N/A False N/A N/A N/A isinstance other LRU N/A N/A N/A other self N/A N/A N/A N/A super LRU self __eq__ other N/A __ne__ N/A N/A self other N/A N/A N/A N/A N/A self other N/A __repr__ N/A N/A self N/A N/A N/A cn N/A N/A self __class__ __name__ N/A val_map N/A N/A N/A super LRU self __repr__ N/A N/A %s(max_size=%r, on_miss=%r, values=%s) N/A cn N/A self max_size N/A self on_miss val_map N/A N/A LRI N/A dict N/A N/A The ``LRI`` implements the basic *Least Recently Inserted* strategy to
    caching. One could also think of this as a ``SizeLimitedDefaultDict``.

    *on_miss* is a callable that accepts the missing key (as opposed
    to :class:`collections.defaultdict`'s "default_factory", which
    accepts no arguments.) Also note that, like the :class:`LRU`,
    the ``LRI`` is instrumented with statistics tracking.

    >>> cap_cache = LRI(max_size=2)
    >>> cap_cache['a'], cap_cache['b'] = 'A', 'B'
    >>> from pprint import pprint as pp
    >>> pp(cap_cache)
    {'a': 'A', 'b': 'B'}
    >>> [cap_cache['b'] for i in range(3)][0]
    'B'
    >>> cap_cache['c'] = 'C'
    >>> print(cap_cache.get('a'))
    None
    >>> cap_cache.hit_count, cap_cache.miss_count, cap_cache.soft_miss_count
    (3, 1, 1)
     __init__ N/A N/A self max_size values on_miss N/A DEFAULT_MAX_SIZE None None N/A N/A N/A N/A N/A super LRI self __init__ N/A N/A self hit_count N/A self miss_count N/A self soft_miss_count 0 N/A N/A self max_size max_size N/A N/A self on_miss on_miss N/A N/A self _queue N/A deque N/A values N/A N/A N/A N/A self update values N/A __setitem__ N/A N/A self key value N/A N/A N/A N/A N/A len self N/A self max_size N/A N/A old N/A N/A N/A self _queue popleft N/A N/A self N/A old N/A N/A N/A N/A super LRI self __setitem__ key value N/A N/A N/A N/A self _queue append key N/A update N/A N/A self E N/A F N/A N/A N/A E self N/A N/A N/A setitem N/A self __setitem__ N/A N/A callable N/A getattr E keys None N/A N/A k N/A N/A E keys N/A N/A N/A setitem k N/A E N/A k N/A N/A N/A k v E N/A N/A N/A setitem k v N/A k F N/A N/A N/A setitem k N/A F N/A k N/A N/A copy N/A N/A self N/A N/A N/A N/A N/A self __class__ max_size N/A self max_size values self N/A clear N/A N/A self N/A N/A N/A N/A N/A N/A self _queue clear N/A N/A N/A N/A super LRI self clear N/A __getitem__ N/A N/A self key N/A N/A N/A N/A N/A ret N/A N/A N/A super LRI self __getitem__ key N/A N/A N/A KeyError N/A N/A N/A self miss_count 1 N/A N/A N/A self on_miss N/A N/A N/A ret N/A self N/A key N/A N/A self on_miss key N/A ret N/A N/A self hit_count 1 N/A ret N/A get N/A N/A self key default N/A None N/A N/A N/A N/A N/A self N/A key N/A N/A N/A KeyError N/A N/A N/A self soft_miss_count 1 N/A default N/A setdefault N/A N/A self key default N/A None N/A N/A N/A N/A N/A self N/A key N/A N/A N/A KeyError N/A N/A N/A self soft_miss_count 1 N/A N/A self N/A key default N/A default N/A N/A _HashedKey N/A list N/A N/A The _HashedKey guarantees that hash() will be called no more than once
    per cached function invocation.
     N/A __slots__ hash_value __init__ N/A N/A self key N/A N/A N/A N/A self N/A key N/A N/A self hash_value N/A hash N/A tuple key N/A __hash__ N/A N/A self N/A N/A N/A N/A self hash_value N/A N/A _make_cache_key N/A N/A args kwargs typed kwarg_mark fasttypes N/A False _KWARG_MARK N/A frozenset N/A int str frozenset N/A type None N/A N/A Make a cache key from optionally typed positional and keyword
    arguments. If *typed* is ``True``, ``3`` and ``3.0`` will be
    treated as separate keys.

    The key is constructed in a way that is flat as possible rather than
    as a nested structure that would take more memory.

    If there is only a single argument and its data type is known to cache
    its hash value, then that argument is returned without a wrapper.  This
    saves space and improves lookup speed.
     N/A key N/A list args N/A kwargs N/A N/A sorted_items N/A sorted N/A N/A kwargs items N/A N/A N/A key append kwarg_mark N/A N/A N/A key extend sorted_items N/A typed N/A N/A N/A N/A key extend N/A N/A type v N/A v args N/A kwargs N/A N/A N/A N/A key extend N/A N/A type v N/A N/A k v sorted_items N/A N/A N/A N/A N/A len key 1 N/A N/A type N/A key N/A 0 fasttypes N/A N/A N/A key N/A 0 N/A N/A _HashedKey key N/A CachedFunction N/A object N/A __init__ N/A N/A self func cache typed N/A False N/A N/A N/A self func func N/A N/A self cache cache N/A N/A self typed typed N/A __call__ N/A N/A self N/A args kwargs N/A N/A key N/A _make_cache_key args kwargs typed N/A self typed N/A N/A N/A ret N/A N/A self cache N/A key N/A N/A N/A KeyError N/A N/A ret N/A N/A self cache N/A key N/A N/A self func args kwargs N/A ret N/A __repr__ N/A N/A self N/A N/A N/A cn N/A N/A self __class__ __name__ N/A N/A self typed N/A N/A N/A %s(func=%r, typed=%r) N/A cn N/A self func N/A self typed N/A N/A %s(func=%r) N/A cn N/A self func N/A N/A cached N/A N/A cache typed N/A False N/A N/A Cache any function with the cache instance of your choosing. Note
    that the function wrapped should take only `hashable`_ arguments.

    Args:
        cache (Mapping): Any :class:`dict`-like object suitable for
            use as a cache. Instances of the :class:`LRU` and
            :class:`LRI` are good choices.
        typed (bool): Whether to factor argument types into the cache
            check. Default ``False``, setting to ``True`` causes the
            cache keys for ``3`` and ``3.0`` to be considered unequal.

    >>> my_cache = LRU()
    >>> @cached(my_cache)
    ... def cached_lower(x):
    ...     return x.lower()
    ...
    >>> cached_lower("CaChInG's FuN AgAiN!")
    "caching's fun again!"
    >>> len(my_cache)
    1

    .. _hashable: https://docs.python.org/2/glossary.html#term-hashable
     cached_func_decorator N/A N/A func N/A N/A N/A N/A CachedFunction func cache typed typed N/A N/A cached_func_decorator N/A ThresholdCounter N/A object N/A N/A A **bounded** dict-like Mapping from keys to counts. The
    ThresholdCounter automatically compacts after every (1 /
    *threshold*) additions, maintaining exact counts for any keys
    whose count represents at least a *threshold* ratio of the total
    data. In other words, if a particular key is not present in the
    ThresholdCounter, its count represents less than *threshold* of
    the total data.

    >>> tc = ThresholdCounter(threshold=0.1)
    >>> tc.add(1)
    >>> tc.items()
    [(1, 1)]
    >>> tc.update([2] * 10)
    >>> tc.get(1)
    0
    >>> tc.add(5)
    >>> 5 in tc
    True
    >>> len(list(tc.elements()))
    11

    As you can see above, the API is kept similar to
    :class:`collections.Counter`. The most notable feature omissions
    being that counted items cannot be set directly, uncounted, or
    removed, as this would disrupt the math.

    Use the ThresholdCounter when you need best-effort long-lived
    counts for dynamically-keyed data. Without a bounded datastructure
    such as this one, the dynamic keys often represent a memory leak
    and can impact application reliability. The ThresholdCounter's
    item replacement strategy is fully deterministic and can be
    thought of as *Amortized Least Relevant*. The absolute upper bound
    of keys it will store is *(2/threshold)*, but realistically
    *(1/threshold)* is expected for uniformly random datastreams, and
    one or two orders of magnitude better for real-world data.

    This algorithm is an implementation of the Lossy Counting
    algorithm described in "Approximate Frequency Counts over Data
    Streams" by Manku & Motwani. Hat tip to Kurt Rose for discovery
    and initial implementation.

     __init__ N/A N/A self threshold N/A 0.001 N/A N/A N/A N/A 0 threshold 1 N/A N/A N/A ValueError N/A expected threshold between 0 and 1, not: %r threshold N/A N/A self total 0 N/A N/A self _count_map N/A N/A N/A self _threshold threshold N/A N/A self _thresh_count N/A int N/A 1 threshold N/A N/A self _cur_bucket 1 N/A threshold N/A N/A self N/A N/A N/A N/A self _threshold N/A property add N/A N/A self key N/A N/A N/A Increment the count of *key* by 1, automatically adding it if it
        does not exist.

        Cache compaction is triggered every *1/threshold* additions.
         N/A N/A self total 1 N/A N/A N/A N/A N/A N/A self _count_map N/A key N/A 0 1 N/A N/A N/A KeyError N/A N/A N/A N/A self _count_map N/A key N/A 1 N/A N/A self _cur_bucket 1 N/A N/A N/A N/A self total N/A self _thresh_count 0 N/A N/A N/A self _count_map N/A dict N/A N/A k v N/A N/A k v N/A N/A N/A self _count_map items N/A N/A sum v N/A self _cur_bucket N/A N/A self _cur_bucket 1 N/A N/A elements N/A N/A self N/A N/A N/A Return an iterator of all the common elements tracked by the
        counter. Yields each key as many times as it has been seen.
         N/A repeaters N/A N/A itertools starmap N/A itertools repeat N/A N/A self iteritems N/A N/A N/A N/A itertools chain from_iterable repeaters N/A most_common N/A N/A self n N/A None N/A N/A Get the top *n* keys and counts as tuples. If *n* is omitted,
        returns all the pairs.
         N/A N/A n 0 N/A N/A N/A N/A ret N/A sorted N/A N/A self iteritems key N/A N/A N/A x N/A N/A N/A x N/A 1 N/A 0 reverse True N/A N/A N/A n None N/A n N/A len ret N/A N/A ret N/A N/A ret N/A n N/A get_common_count N/A N/A self N/A N/A N/A Get the sum of counts for keys exceeding the configured data
        threshold.
         N/A N/A sum N/A count N/A N/A count _ N/A N/A N/A self _count_map itervalues N/A get_uncommon_count N/A N/A self N/A N/A N/A Get the sum of counts for keys that were culled because the
        associated counts represented less than the configured
        threshold. The long-tail counts.
         N/A N/A N/A self total N/A N/A self get_common_count N/A get_commonality N/A N/A self N/A N/A N/A Get a float representation of the effective count accuracy. The
        higher the number, the less uniform the keys being added, and
        the higher accuracy and efficiency of the ThresholdCounter.

        If a stronger measure of data cardinality is required,
        consider using hyperloglog.
         N/A N/A N/A float N/A N/A self get_common_count N/A self total N/A __getitem__ N/A N/A self key N/A N/A N/A N/A N/A N/A self _count_map N/A key N/A 0 N/A __len__ N/A N/A self N/A N/A N/A N/A len N/A self _count_map N/A __contains__ N/A N/A self key N/A N/A N/A N/A key N/A self _count_map N/A iterkeys N/A N/A self N/A N/A N/A N/A iter N/A self _count_map N/A keys N/A N/A self N/A N/A N/A N/A list N/A N/A self iterkeys N/A itervalues N/A N/A self N/A N/A N/A count_map N/A self _count_map N/A k count_map N/A N/A N/A N/A N/A count_map N/A k N/A 0 N/A values N/A N/A self N/A N/A N/A N/A list N/A N/A self itervalues N/A iteritems N/A N/A self N/A N/A N/A count_map N/A self _count_map N/A k count_map N/A N/A N/A N/A k N/A N/A count_map N/A k N/A 0 N/A items N/A N/A self N/A N/A N/A N/A list N/A N/A self iteritems N/A get N/A N/A self key default N/A 0 N/A N/A Get count for *key*, defaulting to 0. N/A N/A N/A N/A self N/A key N/A N/A N/A KeyError N/A N/A default N/A update N/A N/A self iterable N/A kwargs N/A N/A Like dict.update() but add counts instead of replacing them, used
        to add multiple items in one call.

        Source can be an iterable of keys to add, or a mapping of keys
        to integer counts.
         N/A N/A iterable None N/A N/A N/A callable N/A getattr iterable iteritems None N/A N/A N/A key count N/A N/A iterable iteritems N/A N/A i N/A xrange count N/A N/A N/A N/A self add key N/A N/A key iterable N/A N/A N/A N/A self add key N/A kwargs N/A N/A N/A N/A self update kwargs N/A N/A