error-message
success-message
saving-message
warning-message
JavaScript must be enabled.
There was an error retrieving this content.
The content could not be found.
Extensible memoizing collections and decorators
.. image:: https://img.shields.io/pypi/v/cachetools :target: https://pypi.org/project/cachetools/ :alt: Latest PyPI version
.. image:: https://img.shields.io/readthedocs/cachetools :target: https://cachetools.readthedocs.io/ :alt: Documentation build status
.. image:: https://img.shields.io/github/workflow/status/tkem/cachetools/CI :target: https://github.com/tkem/cachetools/actions/workflows/ci.yml :alt: CI build status
.. image:: https://img.shields.io/codecov/c/github/tkem/cachetools/master.svg :target: https://codecov.io/gh/tkem/cachetools :alt: Test coverage
.. image:: https://img.shields.io/github/license/tkem/cachetools :target: https://raw.github.com/tkem/cachetools/master/LICENSE :alt: License
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black :alt: Code style: black
This module provides various memoizing collections and decorators,
including variants of the Python Standard Library's @lru_cache
_
function decorator.
.. code-block:: python
from cachetools import cached, LRUCache, TTLCache
# speed up calculating Fibonacci numbers with dynamic programming @cached(cache={}) def fib(n): return n if n < 2 else fib(n - 1) + fib(n - 2)
# cache least recently used Python Enhancement Proposals @cached(cache=LRUCache(maxsize=32)) def get_pep(num): url = 'http://www.python.org/dev/peps/pep-%04d/' % num with urllib.request.urlopen(url) as s: return s.read()
# cache weather data for no longer than ten minutes @cached(cache=TTLCache(maxsize=1024, ttl=600)) def getweather(place): return owm.weatheratplace(place).getweather()
For the purpose of this module, a cache is a mutable_ mapping_ of a
fixed maximum size. When the cache is full, i.e. by adding another
item the cache would exceed its maximum size, the cache must choose
which item(s) to discard based on a suitable cache algorithm
_. In
general, a cache's size is the total size of its items, and an item's
size is a property or function of its value, e.g. the result of
sys.getsizeof(value)
. For the trivial but common case that each
item counts as 1
, a cache's size is equal to the number of its
items, or len(cache)
.
Multiple cache classes based on different caching algorithms are implemented, and decorators for easily memoizing function and method calls are provided, too.
cachetools is available from PyPI_ and can be installed by running::
pip install cachetools
Typing stubs for this package are provided by typeshed_ and can be installed by running::
pip install types-cachetools
Documentation
_Issue tracker
_Source code
_Change log
_Copyright (c) 2014-2021 Thomas Kemmer.
Licensed under the MIT License
_.
.. @lrucache: https://docs.python.org/3/library/functools.html#functools.lrucache .. _mutable: https://docs.python.org/dev/glossary.html#term-mutable .. _mapping: https://docs.python.org/dev/glossary.html#term-mapping .. _cache algorithm: https://en.wikipedia.org/wiki/Cachealgorithms
.. _PyPI: https://pypi.org/project/cachetools/ .. _typeshed: https://github.com/python/typeshed/ .. _Documentation: https://cachetools.readthedocs.io/ .. _Issue tracker: https://github.com/tkem/cachetools/issues/ .. _Source code: https://github.com/tkem/cachetools/ .. _Change log: https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst .. _MIT License: https://raw.github.com/tkem/cachetools/master/LICENSE
This section shows a list of objects the current object is dependent upon in order to be used.
For dependencies that are only relevant as part of the build or runtime of the object, it is best to describe those local to those sections.
This section tracks information useful to describing how to build this object.
cachetools-4.2.4-py3-none-any.whl
application/zip
Python Source for cachetools 4.2.4
https://files.pythonhosted.org/packages/ea/c1/4740af52db75e6dbdd57fc7e9478439815bbac549c1c05881be27d19a17d/cachetools-4.2.4-py3-none-any.whl
Qmbmw2hiyP5A22aMzRSvpSAZXK43VB4A2Gj98kWqcbB9wW
QmYq3AZ3B2SDiRejeoJeBatvoYh2WWHn3JYnwKvoD3TRte
QmYCssyAicjW4rAsxre7TtXiixRPWh5xFjW6cjVe33hKiY
downloadargparse-1.4.0.tar.gz
application/gzip
Python Source for argparse 1.4.0
https://files.pythonhosted.org/packages/18/dd/e617cfc3f6210ae183374cd9f6a26b20514bbb5a792af97949c5aacddf0f/argparse-1.4.0.tar.gz
QmVMjtpCHUfoKdHkNdqDCry1Ck6P8Tk9bJaHmrH7a35oXr
QmYhLtiLR6hamZiy5TL3vf5d6fA1z2eq4iGn4EmeJywkFs
QmUyto3kPC3XY43kf9bh6VoSJnEVvUCX32XX5EPXZCFCNw
download/bin/bash
{{ paths.mount }}/build.sh
cachetools-4.2.4-py3-none-any.whl
3
cachetools
argparse-1.4.0.tar.gz
linux
x86-64
Objects have a set of files that comprise that object, as seen in the Files tab. When an object is built, they have a set of files that are the result of that build. In each case, these sets of files are the ones that are accessible within a virtual machine when running the object.
This section describes how those files are accessible and visible to that machine. When a virtual machine is created, the data is always accessible read-only within a particular mounted directory. However, applications may expect to be located at particular directories. This section allows one to place files in different directories when the virtual machine is launched.
There are two types of access. One is a link where the file is not copied from its original location. Instead, it creates what is called a symbolic link which is a "shortcut" that acts like a normal file but allows the actual data to be in a different directory. The other type is a traditional copy which copies the data explicitly to the provided destination. This takes more time, but the copy can be modified, unlike the read-only link type.
Action | Source | Destination | Summary | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Link | usr | /usr | N/A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
No files will be installed. |
JavaScript must be enabled.
There was an error retrieving this content.
The content could not be found.
JavaScript must be enabled.
There was an error retrieving this content.
The content could not be found.
JavaScript must be enabled.
There was an error retrieving this content.
The content could not be found.
Confirm message?