commit python-cachetools for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-cachetools for openSUSE:Factory checked in at 2021-02-01 13:26:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cachetools (Old) and /work/SRC/openSUSE:Factory/.python-cachetools.new.28504 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-cachetools" Mon Feb 1 13:26:52 2021 rev:12 rq:867588 version:4.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cachetools/python-cachetools.changes 2020-12-30 17:12:35.288760517 +0100 +++ /work/SRC/openSUSE:Factory/.python-cachetools.new.28504/python-cachetools.changes 2021-02-01 13:28:35.826139829 +0100 @@ -1,0 +2,7 @@ +Thu Jan 28 22:51:01 UTC 2021 - Dirk M��ller <dmueller@suse.com> + +- update to 4.2.1: + - Handle ``__missing__()`` not storing cache items. + - Clean up ``__missing__()`` example. + +------------------------------------------------------------------- Old: ---- cachetools-4.2.0.tar.gz New: ---- cachetools-4.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cachetools.spec ++++++ --- /var/tmp/diff_new_pack.7MLknS/_old 2021-02-01 13:28:36.442140788 +0100 +++ /var/tmp/diff_new_pack.7MLknS/_new 2021-02-01 13:28:36.446140794 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-cachetools # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define skip_python2 1 %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-cachetools -Version: 4.2.0 +Version: 4.2.1 Release: 0 Summary: Extensible memoizing collections and decorators License: MIT ++++++ cachetools-4.2.0.tar.gz -> cachetools-4.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/CHANGELOG.rst new/cachetools-4.2.1/CHANGELOG.rst --- old/cachetools-4.2.0/CHANGELOG.rst 2020-12-10 21:24:59.000000000 +0100 +++ new/cachetools-4.2.1/CHANGELOG.rst 2021-01-24 21:35:01.000000000 +0100 @@ -1,3 +1,11 @@ +v4.2.1 (2021-01-24) +=================== + +- Handle ``__missing__()`` not storing cache items. + +- Clean up ``__missing__()`` example. + + v4.2.0 (2020-12-10) =================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/PKG-INFO new/cachetools-4.2.1/PKG-INFO --- old/cachetools-4.2.0/PKG-INFO 2020-12-10 21:27:30.148768000 +0100 +++ new/cachetools-4.2.1/PKG-INFO 2021-01-24 23:40:01.706941600 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: cachetools -Version: 4.2.0 +Version: 4.2.1 Summary: Extensible memoizing collections and decorators Home-page: https://github.com/tkem/cachetools/ Author: Thomas Kemmer @@ -93,7 +93,7 @@ License ------------------------------------------------------------------------ - Copyright (c) 2014-2020 Thomas Kemmer. + Copyright (c) 2014-2021 Thomas Kemmer. Licensed under the `MIT License`_. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/README.rst new/cachetools-4.2.1/README.rst --- old/cachetools-4.2.0/README.rst 2020-12-10 21:24:17.000000000 +0100 +++ new/cachetools-4.2.1/README.rst 2021-01-24 21:34:50.000000000 +0100 @@ -85,7 +85,7 @@ License ------------------------------------------------------------------------ -Copyright (c) 2014-2020 Thomas Kemmer. +Copyright (c) 2014-2021 Thomas Kemmer. Licensed under the `MIT License`_. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/cachetools/__init__.py new/cachetools-4.2.1/cachetools/__init__.py --- old/cachetools-4.2.0/cachetools/__init__.py 2020-12-10 21:24:42.000000000 +0100 +++ new/cachetools-4.2.1/cachetools/__init__.py 2021-01-24 21:34:50.000000000 +0100 @@ -21,4 +21,4 @@ 'cachedmethod' ) -__version__ = '4.2.0' +__version__ = '4.2.1' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/cachetools/lfu.py new/cachetools-4.2.1/cachetools/lfu.py --- old/cachetools-4.2.0/cachetools/lfu.py 2020-12-10 21:24:17.000000000 +0100 +++ new/cachetools-4.2.1/cachetools/lfu.py 2021-01-24 21:34:50.000000000 +0100 @@ -12,7 +12,8 @@ def __getitem__(self, key, cache_getitem=Cache.__getitem__): value = cache_getitem(self, key) - self.__counter[key] -= 1 + if key in self: # __missing__ may not store item + self.__counter[key] -= 1 return value def __setitem__(self, key, value, cache_setitem=Cache.__setitem__): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/cachetools/lru.py new/cachetools-4.2.1/cachetools/lru.py --- old/cachetools-4.2.0/cachetools/lru.py 2020-12-10 21:24:17.000000000 +0100 +++ new/cachetools-4.2.1/cachetools/lru.py 2021-01-24 21:34:50.000000000 +0100 @@ -12,7 +12,8 @@ def __getitem__(self, key, cache_getitem=Cache.__getitem__): value = cache_getitem(self, key) - self.__update(key) + if key in self: # __missing__ may not store item + self.__update(key) return value def __setitem__(self, key, value, cache_setitem=Cache.__setitem__): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/cachetools/mru.py new/cachetools-4.2.1/cachetools/mru.py --- old/cachetools-4.2.0/cachetools/mru.py 2020-12-10 21:24:17.000000000 +0100 +++ new/cachetools-4.2.1/cachetools/mru.py 2021-01-24 21:34:50.000000000 +0100 @@ -12,7 +12,8 @@ def __getitem__(self, key, cache_getitem=Cache.__getitem__): value = cache_getitem(self, key) - self.__update(key) + if key in self: # __missing__ may not store item + self.__update(key) return value def __setitem__(self, key, value, cache_setitem=Cache.__setitem__): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/cachetools.egg-info/PKG-INFO new/cachetools-4.2.1/cachetools.egg-info/PKG-INFO --- old/cachetools-4.2.0/cachetools.egg-info/PKG-INFO 2020-12-10 21:27:30.000000000 +0100 +++ new/cachetools-4.2.1/cachetools.egg-info/PKG-INFO 2021-01-24 23:40:01.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: cachetools -Version: 4.2.0 +Version: 4.2.1 Summary: Extensible memoizing collections and decorators Home-page: https://github.com/tkem/cachetools/ Author: Thomas Kemmer @@ -93,7 +93,7 @@ License ------------------------------------------------------------------------ - Copyright (c) 2014-2020 Thomas Kemmer. + Copyright (c) 2014-2021 Thomas Kemmer. Licensed under the `MIT License`_. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/docs/conf.py new/cachetools-4.2.1/docs/conf.py --- old/cachetools-4.2.0/docs/conf.py 2020-08-10 19:33:30.000000000 +0200 +++ new/cachetools-4.2.1/docs/conf.py 2021-01-24 21:34:50.000000000 +0100 @@ -9,7 +9,7 @@ project = 'cachetools' -copyright = '2014-2020 Thomas Kemmer' +copyright = '2014-2021 Thomas Kemmer' version = get_version() release = version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/docs/index.rst new/cachetools-4.2.1/docs/index.rst --- old/cachetools-4.2.0/docs/index.rst 2020-12-10 21:24:17.000000000 +0100 +++ new/cachetools-4.2.1/docs/index.rst 2021-01-24 21:34:50.000000000 +0100 @@ -171,13 +171,10 @@ ... def __missing__(self, key): ... """Retrieve text of a Python Enhancement Proposal""" ... url = 'http://www.python.org/dev/peps/pep-%04d/' % key - ... try: - ... with urllib.request.urlopen(url) as s: - ... pep = s.read() - ... self[key] = pep # store text in cache - ... return pep - ... except urllib.error.HTTPError: - ... return 'Not Found' # do not store in cache + ... with urllib.request.urlopen(url) as s: + ... pep = s.read() + ... self[key] = pep # store text in cache + ... return pep >>> peps = PepStore(maxsize=4) >>> for n in 8, 9, 290, 308, 320, 8, 218, 320, 279, 289, 320: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/setup.cfg new/cachetools-4.2.1/setup.cfg --- old/cachetools-4.2.0/setup.cfg 2020-12-10 21:27:30.152768600 +0100 +++ new/cachetools-4.2.1/setup.cfg 2021-01-24 23:40:01.706941600 +0100 @@ -1,6 +1,6 @@ [metadata] name = cachetools -version = 4.2.0 +version = 4.2.1 url = https://github.com/tkem/cachetools/ author = Thomas Kemmer author_email = tkemmer@computer.org diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cachetools-4.2.0/tests/__init__.py new/cachetools-4.2.1/tests/__init__.py --- old/cachetools-4.2.0/tests/__init__.py 2020-08-10 19:33:30.000000000 +0200 +++ new/cachetools-4.2.1/tests/__init__.py 2021-01-24 21:34:50.000000000 +0100 @@ -120,7 +120,14 @@ self.assertIsNone(exception.__cause__) self.assertTrue(exception.__suppress_context__) - def _test_missing(self, cache): + def test_missing(self): + class DefaultCache(self.Cache): + def __missing__(self, key): + self[key] = key + return key + + cache = DefaultCache(maxsize=2) + self.assertEqual(0, cache.currsize) self.assertEqual(2, cache.maxsize) self.assertEqual(0, len(cache)) @@ -172,30 +179,38 @@ self.assertTrue(1 in cache or 2 in cache) self.assertTrue(1 not in cache or 2 not in cache) - def _test_missing_getsizeof(self, cache): + def test_missing_getsizeof(self): + class DefaultCache(self.Cache): + def __missing__(self, key): + try: + self[key] = key + except ValueError: + pass # not stored + return key + + cache = DefaultCache(maxsize=2, getsizeof=lambda x: x) + self.assertEqual(0, cache.currsize) self.assertEqual(2, cache.maxsize) + self.assertEqual(1, cache[1]) + self.assertEqual(1, len(cache)) + self.assertEqual(1, cache.currsize) self.assertIn(1, cache) + self.assertEqual(2, cache[2]) + self.assertEqual(1, len(cache)) + self.assertEqual(2, cache.currsize) self.assertNotIn(1, cache) self.assertIn(2, cache) - self.assertEqual(3, cache[3]) - self.assertNotIn(1, cache) - self.assertIn(2, cache) - self.assertNotIn(3, cache) - def test_missing_subclass(self): - class Cache(self.Cache): - def __missing__(self, key): - try: - self[key] = key - except ValueError: - pass - return key - - self._test_missing(Cache(maxsize=2)) - self._test_missing_getsizeof(Cache(maxsize=2, getsizeof=lambda x: x)) + self.assertEqual(3, cache[3]) # not stored + self.assertEqual(1, len(cache)) + self.assertEqual(2, cache.currsize) + self.assertEqual(1, cache[1]) + self.assertEqual(1, len(cache)) + self.assertEqual(1, cache.currsize) + self.assertEqual((1, 1), cache.popitem()) def _test_getsizeof(self, cache): self.assertEqual(0, cache.currsize)
participants (1)
-
Source-Sync