diff -Nru python-cachetools-3.1.1/cachetools/abc.py python-cachetools-4.0.0/cachetools/abc.py --- python-cachetools-3.1.1/cachetools/abc.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/cachetools/abc.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,11 +1,5 @@ -from __future__ import absolute_import - from abc import abstractmethod - -try: - from collections.abc import MutableMapping -except ImportError: - from collections import MutableMapping +from collections.abc import MutableMapping class DefaultMapping(MutableMapping): diff -Nru python-cachetools-3.1.1/cachetools/cache.py python-cachetools-4.0.0/cachetools/cache.py --- python-cachetools-3.1.1/cachetools/cache.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/cachetools/cache.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from .abc import DefaultMapping diff -Nru python-cachetools-3.1.1/cachetools/decorators.py python-cachetools-4.0.0/cachetools/decorators.py --- python-cachetools-3.1.1/cachetools/decorators.py 1970-01-01 00:00:00.000000000 +0000 +++ python-cachetools-4.0.0/cachetools/decorators.py 2019-12-15 19:53:23.000000000 +0000 @@ -0,0 +1,88 @@ +import functools + +from .keys import hashkey + + +def cached(cache, key=hashkey, lock=None): + """Decorator to wrap a function with a memoizing callable that saves + results in a cache. + + """ + def decorator(func): + if cache is None: + def wrapper(*args, **kwargs): + return func(*args, **kwargs) + elif lock is None: + def wrapper(*args, **kwargs): + k = key(*args, **kwargs) + try: + return cache[k] + except KeyError: + pass # key not found + v = func(*args, **kwargs) + try: + cache[k] = v + except ValueError: + pass # value too large + return v + else: + def wrapper(*args, **kwargs): + k = key(*args, **kwargs) + try: + with lock: + return cache[k] + except KeyError: + pass # key not found + v = func(*args, **kwargs) + try: + with lock: + cache[k] = v + except ValueError: + pass # value too large + return v + return functools.update_wrapper(wrapper, func) + return decorator + + +def cachedmethod(cache, key=hashkey, lock=None): + """Decorator to wrap a class or instance method with a memoizing + callable that saves results in a cache. + + """ + def decorator(method): + if lock is None: + def wrapper(self, *args, **kwargs): + c = cache(self) + if c is None: + return method(self, *args, **kwargs) + k = key(*args, **kwargs) + try: + return c[k] + except KeyError: + pass # key not found + v = method(self, *args, **kwargs) + try: + c[k] = v + except ValueError: + pass # value too large + return v + else: + def wrapper(self, *args, **kwargs): + c = cache(self) + if c is None: + return method(self, *args, **kwargs) + k = key(*args, **kwargs) + try: + with lock(self): + return c[k] + except KeyError: + pass # key not found + v = method(self, *args, **kwargs) + try: + with lock(self): + c[k] = v + except ValueError: + pass # value too large + return v + return functools.update_wrapper(wrapper, method) + return decorator diff -Nru python-cachetools-3.1.1/cachetools/func.py python-cachetools-4.0.0/cachetools/func.py --- python-cachetools-3.1.1/cachetools/func.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/cachetools/func.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,15 +1,9 @@ """`functools.lru_cache` compatible memoizing function decorators.""" -from __future__ import absolute_import - import collections import functools import random - -try: - from time import monotonic as default_timer -except ImportError: - from time import time as default_timer +import time try: from threading import RLock @@ -85,8 +79,6 @@ pass # value too large return v functools.update_wrapper(wrapper, func) - if not hasattr(wrapper, '__wrapped__'): - wrapper.__wrapped__ = func # Python 2.7 wrapper.cache_info = cache_info wrapper.cache_clear = cache_clear return wrapper @@ -129,7 +121,7 @@ return _cache(RRCache(maxsize, choice), typed) -def ttl_cache(maxsize=128, ttl=600, timer=default_timer, typed=False): +def ttl_cache(maxsize=128, ttl=600, timer=time.monotonic, typed=False): """Decorator to wrap a function with a memoizing callable that saves up to `maxsize` results based on a Least Recently Used (LRU) algorithm with a per-item time-to-live (TTL) value. diff -Nru python-cachetools-3.1.1/cachetools/__init__.py python-cachetools-4.0.0/cachetools/__init__.py --- python-cachetools-3.1.1/cachetools/__init__.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/cachetools/__init__.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,112 +1,20 @@ """Extensible memoizing collections and decorators.""" -from __future__ import absolute_import - -import functools - -from . import keys from .cache import Cache +from .decorators import cached, cachedmethod from .lfu import LFUCache from .lru import LRUCache from .rr import RRCache from .ttl import TTLCache __all__ = ( - 'Cache', 'LFUCache', 'LRUCache', 'RRCache', 'TTLCache', - 'cached', 'cachedmethod' + 'Cache', + 'LFUCache', + 'LRUCache', + 'RRCache', + 'TTLCache', + 'cached', + 'cachedmethod' ) -__version__ = '3.1.1' - -if hasattr(functools.update_wrapper(lambda f: f(), lambda: 42), '__wrapped__'): - _update_wrapper = functools.update_wrapper -else: - def _update_wrapper(wrapper, wrapped): - functools.update_wrapper(wrapper, wrapped) - wrapper.__wrapped__ = wrapped - return wrapper - - -def cached(cache, key=keys.hashkey, lock=None): - """Decorator to wrap a function with a memoizing callable that saves - results in a cache. - - """ - def decorator(func): - if cache is None: - def wrapper(*args, **kwargs): - return func(*args, **kwargs) - elif lock is None: - def wrapper(*args, **kwargs): - k = key(*args, **kwargs) - try: - return cache[k] - except KeyError: - pass # key not found - v = func(*args, **kwargs) - try: - cache[k] = v - except ValueError: - pass # value too large - return v - else: - def wrapper(*args, **kwargs): - k = key(*args, **kwargs) - try: - with lock: - return cache[k] - except KeyError: - pass # key not found - v = func(*args, **kwargs) - try: - with lock: - cache[k] = v - except ValueError: - pass # value too large - return v - return _update_wrapper(wrapper, func) - return decorator - - -def cachedmethod(cache, key=keys.hashkey, lock=None): - """Decorator to wrap a class or instance method with a memoizing - callable that saves results in a cache. - - """ - def decorator(method): - if lock is None: - def wrapper(self, *args, **kwargs): - c = cache(self) - if c is None: - return method(self, *args, **kwargs) - k = key(*args, **kwargs) - try: - return c[k] - except KeyError: - pass # key not found - v = method(self, *args, **kwargs) - try: - c[k] = v - except ValueError: - pass # value too large - return v - else: - def wrapper(self, *args, **kwargs): - c = cache(self) - if c is None: - return method(self, *args, **kwargs) - k = key(*args, **kwargs) - try: - with lock(self): - return c[k] - except KeyError: - pass # key not found - v = method(self, *args, **kwargs) - try: - with lock(self): - c[k] = v - except ValueError: - pass # value too large - return v - return _update_wrapper(wrapper, method) - return decorator +__version__ = '4.0.0' diff -Nru python-cachetools-3.1.1/cachetools/keys.py python-cachetools-4.0.0/cachetools/keys.py --- python-cachetools-3.1.1/cachetools/keys.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/cachetools/keys.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,7 +1,5 @@ """Key functions for memoizing decorators.""" -from __future__ import absolute_import - __all__ = ('hashkey', 'typedkey') diff -Nru python-cachetools-3.1.1/cachetools/lfu.py python-cachetools-4.0.0/cachetools/lfu.py --- python-cachetools-3.1.1/cachetools/lfu.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/cachetools/lfu.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import collections from .cache import Cache diff -Nru python-cachetools-3.1.1/cachetools/lru.py python-cachetools-4.0.0/cachetools/lru.py --- python-cachetools-3.1.1/cachetools/lru.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/cachetools/lru.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import collections from .cache import Cache @@ -34,15 +32,8 @@ else: return (key, self.pop(key)) - if hasattr(collections.OrderedDict, 'move_to_end'): - def __update(self, key): - try: - self.__order.move_to_end(key) - except KeyError: - self.__order[key] = None - else: - def __update(self, key): - try: - self.__order[key] = self.__order.pop(key) - except KeyError: - self.__order[key] = None + def __update(self, key): + try: + self.__order.move_to_end(key) + except KeyError: + self.__order[key] = None diff -Nru python-cachetools-3.1.1/cachetools/rr.py python-cachetools-4.0.0/cachetools/rr.py --- python-cachetools-3.1.1/cachetools/rr.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/cachetools/rr.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import random from .cache import Cache diff -Nru python-cachetools-3.1.1/cachetools/ttl.py python-cachetools-4.0.0/cachetools/ttl.py --- python-cachetools-3.1.1/cachetools/ttl.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/cachetools/ttl.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,11 +1,5 @@ -from __future__ import absolute_import - import collections - -try: - from time import monotonic as default_timer -except ImportError: - from time import time as default_timer +import time from .cache import Cache @@ -61,7 +55,7 @@ class TTLCache(Cache): """LRU Cache implementation with per-item time-to-live (TTL) value.""" - def __init__(self, maxsize, ttl, timer=default_timer, getsizeof=None): + def __init__(self, maxsize, ttl, timer=time.monotonic, getsizeof=None): Cache.__init__(self, maxsize, getsizeof) self.__root = root = _Link() root.prev = root.next = root @@ -208,13 +202,7 @@ else: return (key, self.pop(key)) - if hasattr(collections.OrderedDict, 'move_to_end'): - def __getlink(self, key): - value = self.__links[key] - self.__links.move_to_end(key) - return value - else: - def __getlink(self, key): - value = self.__links.pop(key) - self.__links[key] = value - return value + def __getlink(self, key): + value = self.__links[key] + self.__links.move_to_end(key) + return value diff -Nru python-cachetools-3.1.1/CHANGELOG.rst python-cachetools-4.0.0/CHANGELOG.rst --- python-cachetools-3.1.1/CHANGELOG.rst 1970-01-01 00:00:00.000000000 +0000 +++ python-cachetools-4.0.0/CHANGELOG.rst 2019-12-15 19:53:23.000000000 +0000 @@ -0,0 +1,299 @@ +v4.0.0 (2019-12-15) +=================== + +- Require Python 3.5 or later. + + +v3.1.1 (2019-05-23) +=================== + +- Document how to use shared caches with ``@cachedmethod``. + +- Fix pickling/unpickling of cache keys + + +v3.1.0 (2019-01-29) +=================== + +- Fix Python 3.8 compatibility issue. + +- Use ``time.monotonic`` as default timer if available. + +- Improve documentation regarding thread safety. + + +v3.0.0 (2018-11-04) +=================== + +- Officially support Python 3.7. + +- Drop Python 3.3 support (breaking change). + +- Remove ``missing`` cache constructor parameter (breaking change). + +- Remove ``self`` from ``@cachedmethod`` key arguments (breaking + change). + +- Add support for ``maxsize=None`` in ``cachetools.func`` decorators. + + +v2.1.0 (2018-05-12) +=================== + +- Deprecate ``missing`` cache constructor parameter. + +- Handle overridden ``getsizeof()`` method in subclasses. + +- Fix Python 2.7 ``RRCache`` pickling issues. + +- Various documentation improvements. + + +v2.0.1 (2017-08-11) +=================== + +- Officially support Python 3.6. + +- Move documentation to RTD. + +- Documentation: Update import paths for key functions (courtesy of + slavkoja). + + +v2.0.0 (2016-10-03) +=================== + +- Drop Python 3.2 support (breaking change). + +- Drop support for deprecated features (breaking change). + +- Move key functions to separate package (breaking change). + +- Accept non-integer ``maxsize`` in ``Cache.__repr__()``. + + +v1.1.6 (2016-04-01) +=================== + +- Reimplement ``LRUCache`` and ``TTLCache`` using + ``collections.OrderedDict``. Note that this will break pickle + compatibility with previous versions. + +- Fix ``TTLCache`` not calling ``__missing__()`` of derived classes. + +- Handle ``ValueError`` in ``Cache.__missing__()`` for consistency + with caching decorators. + +- Improve how ``TTLCache`` handles expired items. + +- Use ``Counter.most_common()`` for ``LFUCache.popitem()``. + + +v1.1.5 (2015-10-25) +=================== + +- Refactor ``Cache`` base class. Note that this will break pickle + compatibility with previous versions. + +- Clean up ``LRUCache`` and ``TTLCache`` implementations. + + +v1.1.4 (2015-10-24) +=================== + +- Refactor ``LRUCache`` and ``TTLCache`` implementations. Note that + this will break pickle compatibility with previous versions. + +- Document pending removal of deprecated features. + +- Minor documentation improvements. + + +v1.1.3 (2015-09-15) +=================== + +- Fix pickle tests. + + +v1.1.2 (2015-09-15) +=================== + +- Fix pickling of large ``LRUCache`` and ``TTLCache`` instances. + + +v1.1.1 (2015-09-07) +=================== + +- Improve key functions. + +- Improve documentation. + +- Improve unit test coverage. + + +v1.1.0 (2015-08-28) +=================== + +- Add ``@cached`` function decorator. + +- Add ``hashkey`` and ``typedkey`` fuctions. + +- Add `key` and `lock` arguments to ``@cachedmethod``. + +- Set ``__wrapped__`` attributes for Python versions < 3.2. + +- Move ``functools`` compatible decorators to ``cachetools.func``. + +- Deprecate ``@cachedmethod`` `typed` argument. + +- Deprecate `cache` attribute for ``@cachedmethod`` wrappers. + +- Deprecate `getsizeof` and `lock` arguments for `cachetools.func` + decorator. + + +v1.0.3 (2015-06-26) +=================== + +- Clear cache statistics when calling ``clear_cache()``. + + +v1.0.2 (2015-06-18) +=================== + +- Allow simple cache instances to be pickled. + +- Refactor ``Cache.getsizeof`` and ``Cache.missing`` default + implementation. + + +v1.0.1 (2015-06-06) +=================== + +- Code cleanup for improved PEP 8 conformance. + +- Add documentation and unit tests for using ``@cachedmethod`` with + generic mutable mappings. + +- Improve documentation. + + +v1.0.0 (2014-12-19) +=================== + +- Provide ``RRCache.choice`` property. + +- Improve documentation. + + +v0.8.2 (2014-12-15) +=================== + +- Use a ``NestedTimer`` for ``TTLCache``. + + +v0.8.1 (2014-12-07) +=================== + +- Deprecate ``Cache.getsize()``. + + +v0.8.0 (2014-12-03) +=================== + +- Ignore ``ValueError`` raised on cache insertion in decorators. + +- Add ``Cache.getsize()``. + +- Add ``Cache.__missing__()``. + +- Feature freeze for `v1.0`. + + +v0.7.1 (2014-11-22) +=================== + +- Fix `MANIFEST.in`. + + +v0.7.0 (2014-11-12) +=================== + +- Deprecate ``TTLCache.ExpiredError``. + +- Add `choice` argument to ``RRCache`` constructor. + +- Refactor ``LFUCache``, ``LRUCache`` and ``TTLCache``. + +- Use custom ``NullContext`` implementation for unsynchronized + function decorators. + + +v0.6.0 (2014-10-13) +=================== + +- Raise ``TTLCache.ExpiredError`` for expired ``TTLCache`` items. + +- Support unsynchronized function decorators. + +- Allow ``@cachedmethod.cache()`` to return None + + +v0.5.1 (2014-09-25) +=================== + +- No formatting of ``KeyError`` arguments. + +- Update ``README.rst``. + + +v0.5.0 (2014-09-23) +=================== + +- Do not delete expired items in TTLCache.__getitem__(). + +- Add ``@ttl_cache`` function decorator. + +- Fix public ``getsizeof()`` usage. + + +v0.4.0 (2014-06-16) +=================== + +- Add ``TTLCache``. + +- Add ``Cache`` base class. + +- Remove ``@cachedmethod`` `lock` parameter. + + +v0.3.1 (2014-05-07) +=================== + +- Add proper locking for ``cache_clear()`` and ``cache_info()``. + +- Report `size` in ``cache_info()``. + + +v0.3.0 (2014-05-06) +=================== + +- Remove ``@cache`` decorator. + +- Add ``size``, ``getsizeof`` members. + +- Add ``@cachedmethod`` decorator. + + +v0.2.0 (2014-04-02) +=================== + +- Add ``@cache`` decorator. + +- Update documentation. + + +v0.1.0 (2014-03-27) +=================== + +- Initial release. diff -Nru python-cachetools-3.1.1/CHANGES.rst python-cachetools-4.0.0/CHANGES.rst --- python-cachetools-3.1.1/CHANGES.rst 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/CHANGES.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,293 +0,0 @@ -v3.1.1 (2019-05-23) -------------------- - -- Document how to use shared caches with ``@cachedmethod``. - -- Fix pickling/unpickling of cache keys - - -v3.1.0 (2019-01-29) -------------------- - -- Fix Python 3.8 compatibility issue. - -- Use ``time.monotonic`` as default timer if available. - -- Improve documentation regarding thread safety. - - -v3.0.0 (2018-11-04) -------------------- - -- Officially support Python 3.7. - -- Drop Python 3.3 support (breaking change). - -- Remove ``missing`` cache constructor parameter (breaking change). - -- Remove ``self`` from ``@cachedmethod`` key arguments (breaking - change). - -- Add support for ``maxsize=None`` in ``cachetools.func`` decorators. - - -v2.1.0 (2018-05-12) -------------------- - -- Deprecate ``missing`` cache constructor parameter. - -- Handle overridden ``getsizeof()`` method in subclasses. - -- Fix Python 2.7 ``RRCache`` pickling issues. - -- Various documentation improvements. - - -v2.0.1 (2017-08-11) -------------------- - -- Officially support Python 3.6. - -- Move documentation to RTD. - -- Documentation: Update import paths for key functions (courtesy of - slavkoja). - - -v2.0.0 (2016-10-03) -------------------- - -- Drop Python 3.2 support (breaking change). - -- Drop support for deprecated features (breaking change). - -- Move key functions to separate package (breaking change). - -- Accept non-integer ``maxsize`` in ``Cache.__repr__()``. - - -v1.1.6 (2016-04-01) -------------------- - -- Reimplement ``LRUCache`` and ``TTLCache`` using - ``collections.OrderedDict``. Note that this will break pickle - compatibility with previous versions. - -- Fix ``TTLCache`` not calling ``__missing__()`` of derived classes. - -- Handle ``ValueError`` in ``Cache.__missing__()`` for consistency - with caching decorators. - -- Improve how ``TTLCache`` handles expired items. - -- Use ``Counter.most_common()`` for ``LFUCache.popitem()``. - - -v1.1.5 (2015-10-25) -------------------- - -- Refactor ``Cache`` base class. Note that this will break pickle - compatibility with previous versions. - -- Clean up ``LRUCache`` and ``TTLCache`` implementations. - - -v1.1.4 (2015-10-24) -------------------- - -- Refactor ``LRUCache`` and ``TTLCache`` implementations. Note that - this will break pickle compatibility with previous versions. - -- Document pending removal of deprecated features. - -- Minor documentation improvements. - - -v1.1.3 (2015-09-15) -------------------- - -- Fix pickle tests. - - -v1.1.2 (2015-09-15) -------------------- - -- Fix pickling of large ``LRUCache`` and ``TTLCache`` instances. - - -v1.1.1 (2015-09-07) -------------------- - -- Improve key functions. - -- Improve documentation. - -- Improve unit test coverage. - - -v1.1.0 (2015-08-28) -------------------- - -- Add ``@cached`` function decorator. - -- Add ``hashkey`` and ``typedkey`` fuctions. - -- Add `key` and `lock` arguments to ``@cachedmethod``. - -- Set ``__wrapped__`` attributes for Python versions < 3.2. - -- Move ``functools`` compatible decorators to ``cachetools.func``. - -- Deprecate ``@cachedmethod`` `typed` argument. - -- Deprecate `cache` attribute for ``@cachedmethod`` wrappers. - -- Deprecate `getsizeof` and `lock` arguments for `cachetools.func` - decorator. - - -v1.0.3 (2015-06-26) -------------------- - -- Clear cache statistics when calling ``clear_cache()``. - - -v1.0.2 (2015-06-18) -------------------- - -- Allow simple cache instances to be pickled. - -- Refactor ``Cache.getsizeof`` and ``Cache.missing`` default - implementation. - - -v1.0.1 (2015-06-06) -------------------- - -- Code cleanup for improved PEP 8 conformance. - -- Add documentation and unit tests for using ``@cachedmethod`` with - generic mutable mappings. - -- Improve documentation. - - -v1.0.0 (2014-12-19) -------------------- - -- Provide ``RRCache.choice`` property. - -- Improve documentation. - - -v0.8.2 (2014-12-15) -------------------- - -- Use a ``NestedTimer`` for ``TTLCache``. - - -v0.8.1 (2014-12-07) -------------------- - -- Deprecate ``Cache.getsize()``. - - -v0.8.0 (2014-12-03) -------------------- - -- Ignore ``ValueError`` raised on cache insertion in decorators. - -- Add ``Cache.getsize()``. - -- Add ``Cache.__missing__()``. - -- Feature freeze for `v1.0`. - - -v0.7.1 (2014-11-22) -------------------- - -- Fix `MANIFEST.in`. - - -v0.7.0 (2014-11-12) -------------------- - -- Deprecate ``TTLCache.ExpiredError``. - -- Add `choice` argument to ``RRCache`` constructor. - -- Refactor ``LFUCache``, ``LRUCache`` and ``TTLCache``. - -- Use custom ``NullContext`` implementation for unsynchronized - function decorators. - - -v0.6.0 (2014-10-13) -------------------- - -- Raise ``TTLCache.ExpiredError`` for expired ``TTLCache`` items. - -- Support unsynchronized function decorators. - -- Allow ``@cachedmethod.cache()`` to return None - - -v0.5.1 (2014-09-25) -------------------- - -- No formatting of ``KeyError`` arguments. - -- Update ``README.rst``. - - -v0.5.0 (2014-09-23) -------------------- - -- Do not delete expired items in TTLCache.__getitem__(). - -- Add ``@ttl_cache`` function decorator. - -- Fix public ``getsizeof()`` usage. - - -v0.4.0 (2014-06-16) -------------------- - -- Add ``TTLCache``. - -- Add ``Cache`` base class. - -- Remove ``@cachedmethod`` `lock` parameter. - - -v0.3.1 (2014-05-07) -------------------- - -- Add proper locking for ``cache_clear()`` and ``cache_info()``. - -- Report `size` in ``cache_info()``. - - -v0.3.0 (2014-05-06) -------------------- - -- Remove ``@cache`` decorator. - -- Add ``size``, ``getsizeof`` members. - -- Add ``@cachedmethod`` decorator. - - -v0.2.0 (2014-04-02) -------------------- - -- Add ``@cache`` decorator. - -- Update documentation. - - -v0.1.0 (2014-03-27) -------------------- - -- Initial release. diff -Nru python-cachetools-3.1.1/debian/changelog python-cachetools-4.0.0/debian/changelog --- python-cachetools-3.1.1/debian/changelog 2019-12-26 21:54:38.000000000 +0000 +++ python-cachetools-4.0.0/debian/changelog 2020-01-08 07:14:02.000000000 +0000 @@ -1,3 +1,10 @@ +python-cachetools (4.0.0-1) unstable; urgency=medium + + * New upstream version 4.0.0 + * Create d/clean to remove .egg-info + + -- Christian Kastner Wed, 08 Jan 2020 08:14:02 +0100 + python-cachetools (3.1.1-3) unstable; urgency=medium * Team upload. diff -Nru python-cachetools-3.1.1/debian/clean python-cachetools-4.0.0/debian/clean --- python-cachetools-3.1.1/debian/clean 1970-01-01 00:00:00.000000000 +0000 +++ python-cachetools-4.0.0/debian/clean 2020-01-08 07:14:02.000000000 +0000 @@ -0,0 +1 @@ +cachetools.egg-info/ diff -Nru python-cachetools-3.1.1/docs/conf.py python-cachetools-4.0.0/docs/conf.py --- python-cachetools-3.1.1/docs/conf.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/docs/conf.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,13 +1,16 @@ -def get_version(filename): - from re import findall - with open(filename) as f: - metadata = dict(findall(r"__([a-z]+)__ = '([^']+)'", f.read())) - return metadata['version'] +def get_version(): + import configparser + import pathlib + + cp = configparser.ConfigParser() + # Python 3.5 ConfigParser does not accept Path as filename + cp.read(str(pathlib.Path(__file__).parent.parent / "setup.cfg")) + return cp["metadata"]["version"] project = 'cachetools' copyright = '2014-2019 Thomas Kemmer' -version = get_version(b'../cachetools/__init__.py') +version = get_version() release = version extensions = [ diff -Nru python-cachetools-3.1.1/docs/index.rst python-cachetools-4.0.0/docs/index.rst --- python-cachetools-3.1.1/docs/index.rst 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/docs/index.rst 2019-12-15 19:53:23.000000000 +0000 @@ -1,10 +1,11 @@ +********************************************************************* :mod:`cachetools` --- Extensible memoizing collections and decorators -======================================================================= +********************************************************************* .. module:: cachetools This module provides various memoizing collections and decorators, -including variants of the Python 3 Standard Library `@lru_cache`_ +including variants of the Python Standard Library's `@lru_cache`_ function decorator. For the purpose of this module, a *cache* is a mutable_ mapping_ of a @@ -27,12 +28,12 @@ import operator from cachetools import cached, cachedmethod, LRUCache - import mock + from unittest import mock urllib = mock.MagicMock() Cache implementations ------------------------------------------------------------------------- +===================== This module provides several classes implementing caches using different cache algorithms. All these classes derive from class @@ -101,10 +102,8 @@ will be discarded first to make space when necessary. By default, the time-to-live is specified in seconds and - :func:`time.monotonic` is used to retrieve the current time. If - :func:`time.monotonic` is not available, e.g. when running Python - 2.7, :func:`time.time` will be used. A custom `timer` function can - be supplied if needed. + :func:`time.monotonic` is used to retrieve the current time. A + custom `timer` function can be supplied if needed. .. method:: expire(self, time=None) @@ -119,7 +118,7 @@ Extending cache classes -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +----------------------- Sometimes it may be desirable to notice when and what cache items are evicted, i.e. removed from a cache to make room for new items. Since @@ -174,7 +173,7 @@ Memoizing decorators ------------------------------------------------------------------------- +==================== The :mod:`cachetools` module provides decorators for memoizing function and method calls. This can save time when a function is @@ -363,8 +362,9 @@ RFC #1: ... +***************************************************************** :mod:`cachetools.keys` --- Key functions for memoizing decorators -============================================================================ +***************************************************************** .. module:: cachetools.keys @@ -407,8 +407,9 @@ @cached(LRUCache(maxsize=128), key=envkey) +**************************************************************************** :mod:`cachetools.func` --- :func:`functools.lru_cache` compatible decorators -============================================================================ +**************************************************************************** .. module:: cachetools.func diff -Nru python-cachetools-3.1.1/MANIFEST.in python-cachetools-4.0.0/MANIFEST.in --- python-cachetools-3.1.1/MANIFEST.in 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/MANIFEST.in 2019-12-15 19:53:23.000000000 +0000 @@ -1,4 +1,4 @@ -include CHANGES.rst +include CHANGELOG.rst include LICENSE include MANIFEST.in include README.rst diff -Nru python-cachetools-3.1.1/README.rst python-cachetools-4.0.0/README.rst --- python-cachetools-3.1.1/README.rst 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/README.rst 2019-12-15 19:53:23.000000000 +0000 @@ -1,8 +1,28 @@ cachetools ======================================================================== +.. image:: http://img.shields.io/pypi/v/cachetools + :target: https://pypi.org/project/cachetools/ + :alt: Latest PyPI version + +.. image:: https://img.shields.io/readthedocs/cachetools + :target: http://cachetools.readthedocs.io/ + :alt: Documentation build status + +.. image:: http://img.shields.io/travis/tkem/cachetools + :target: https://travis-ci.org/tkem/cachetools/ + :alt: Travis CI build status + +.. image:: http://img.shields.io/coveralls/tkem/cachetools + :target: https://coveralls.io/r/tkem/cachetools + :alt: Test coverage + +.. image:: https://img.shields.io/github/license/tkem/cachetools + :target: http://raw.github.com/tkem/cachetools/master/LICENSE + :alt: License + This module provides various memoizing collections and decorators, -including variants of the Python 3 Standard Library `@lru_cache`_ +including variants of the Python Standard Library's `@lru_cache`_ function decorator. .. code-block:: python @@ -40,39 +60,22 @@ implemented, and decorators for easily memoizing function and method calls are provided, too. -For more information, please refer to the online documentation_. - Installation ------------------------------------------------------------------------ -Install cachetools using pip:: +cachetools is available from PyPI_ and can be installed by running:: - pip install cachetools + pip install cachetools Project Resources ------------------------------------------------------------------------ -.. image:: http://img.shields.io/pypi/v/cachetools.svg?style=flat - :target: https://pypi.python.org/pypi/cachetools/ - :alt: Latest PyPI version - -.. image:: http://img.shields.io/travis/tkem/cachetools/master.svg?style=flat - :target: https://travis-ci.org/tkem/cachetools/ - :alt: Travis CI build status - -.. image:: http://img.shields.io/coveralls/tkem/cachetools/master.svg?style=flat - :target: https://coveralls.io/r/tkem/cachetools - :alt: Test coverage - -.. image:: https://readthedocs.org/projects/cachetools/badge/?version=latest&style=flat - :target: http://cachetools.readthedocs.io/en/latest/ - :alt: Documentation Status - -- `Issue Tracker`_ -- `Source Code`_ -- `Change Log`_ +- `Documentation`_ +- `Issue tracker`_ +- `Source code`_ +- `Change log`_ License @@ -88,8 +91,9 @@ .. _mapping: http://docs.python.org/dev/glossary.html#term-mapping .. _cache algorithm: http://en.wikipedia.org/wiki/Cache_algorithms -.. _Documentation: http://cachetools.readthedocs.io/en/latest/ -.. _Issue Tracker: https://github.com/tkem/cachetools/issues/ -.. _Source Code: https://github.com/tkem/cachetools/ -.. _Change Log: https://github.com/tkem/cachetools/blob/master/CHANGES.rst +.. _PyPI: https://pypi.org/project/cachetools/ +.. _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: http://raw.github.com/tkem/cachetools/master/LICENSE diff -Nru python-cachetools-3.1.1/setup.cfg python-cachetools-4.0.0/setup.cfg --- python-cachetools-3.1.1/setup.cfg 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/setup.cfg 2019-12-15 19:53:23.000000000 +0000 @@ -1,13 +1,40 @@ -[flake8] -exclude = .git,.tox +[metadata] +name = cachetools +version = 4.0.0 +url = https://github.com/tkem/cachetools/ +author = Thomas Kemmer +author_email = tkemmer@computer.org +license = MIT +license_file = LICENSE +description = Extensible memoizing collections and decorators +long_description = file: README.rst +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Other Environment + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Topic :: Software Development :: Libraries :: Python Modules + +[options] +packages = find: +python_requires = ~= 3.5 -[wheel] -universal = 1 +[options.packages.find] +exclude = + tests + tests.* + +[flake8] +exclude = .git, .tox [build_sphinx] source-dir = docs/ build-dir = docs/_build all_files = 1 - -[upload_sphinx] -upload-dir = docs/_build/html diff -Nru python-cachetools-3.1.1/setup.py python-cachetools-4.0.0/setup.py --- python-cachetools-3.1.1/setup.py 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/setup.py 2019-12-15 19:53:23.000000000 +0000 @@ -1,40 +1,3 @@ -from setuptools import find_packages, setup +from setuptools import setup - -def get_version(filename): - from re import findall - with open(filename) as f: - metadata = dict(findall("__([a-z]+)__ = '([^']+)'", f.read())) - return metadata['version'] - - -setup( - name='cachetools', - version=get_version('cachetools/__init__.py'), - url='https://github.com/tkem/cachetools', - license='MIT', - author='Thomas Kemmer', - author_email='tkemmer@computer.org', - description='Extensible memoizing collections and decorators', - long_description=open('README.rst').read(), - keywords='cache caching memoize memoizing memoization LRU LFU TTL', - packages=find_packages(exclude=['tests', 'tests.*']), - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Other Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Software Development :: Libraries :: Python Modules' - ] -) +setup() diff -Nru python-cachetools-3.1.1/tox.ini python-cachetools-4.0.0/tox.ini --- python-cachetools-3.1.1/tox.ini 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/tox.ini 2019-12-15 19:53:23.000000000 +0000 @@ -24,7 +24,6 @@ [testenv:doctest] deps = - mock sphinx commands = sphinx-build -W -b doctest -d {envtmpdir}/doctrees docs {envtmpdir}/doctest diff -Nru python-cachetools-3.1.1/.travis.yml python-cachetools-4.0.0/.travis.yml --- python-cachetools-3.1.1/.travis.yml 2019-05-23 19:49:13.000000000 +0000 +++ python-cachetools-4.0.0/.travis.yml 2019-12-15 19:53:23.000000000 +0000 @@ -1,17 +1,11 @@ -sudo: true - -dist: xenial - language: python python: -- 2.7 -- 3.4 - 3.5 - 3.6 - 3.7 -- 3.8-dev -- pypy3.5 +- 3.8 +- pypy3 install: - pip install coveralls tox