Hello community, here is the log from the commit of package python-diskcache for openSUSE:Factory checked in at 2020-11-17 21:26:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-diskcache (Old) and /work/SRC/openSUSE:Factory/.python-diskcache.new.24930 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-diskcache" Tue Nov 17 21:26:28 2020 rev:7 rq:849007 version:5.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-diskcache/python-diskcache.changes 2020-09-17 15:09:04.148950911 +0200 +++ /work/SRC/openSUSE:Factory/.python-diskcache.new.24930/python-diskcache.changes 2020-11-17 21:26:28.897449002 +0100 @@ -1,0 +2,7 @@ +Tue Nov 17 05:43:53 UTC 2020 - Steve Kowalik <steven.kowa...@suse.com> + +- Update to 5.1.0: + * Support transactions in FanoutCache (probably a bad idea) + * Prevent cache shard attribute access when unsafe + +------------------------------------------------------------------- Old: ---- v5.0.3.tar.gz New: ---- v5.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-diskcache.spec ++++++ --- /var/tmp/diff_new_pack.er3e9p/_old 2020-11-17 21:26:29.865449962 +0100 +++ /var/tmp/diff_new_pack.er3e9p/_new 2020-11-17 21:26:29.869449966 +0100 @@ -19,11 +19,10 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %global skip_python2 1 Name: python-diskcache -Version: 5.0.3 +Version: 5.1.0 Release: 0 Summary: Disk and file backed cache License: Apache-2.0 -Group: Development/Languages/Python URL: http://www.grantjenks.com/docs/diskcache/ Source: https://github.com/grantjenks/python-diskcache/archive/v%{version}.tar.gz BuildRequires: %{python_module Django} ++++++ v5.0.3.tar.gz -> v5.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-diskcache-5.0.3/diskcache/__init__.py new/python-diskcache-5.1.0/diskcache/__init__.py --- old/python-diskcache-5.0.3/diskcache/__init__.py 2020-09-09 06:46:12.000000000 +0200 +++ new/python-diskcache-5.1.0/diskcache/__init__.py 2020-11-09 04:56:40.000000000 +0100 @@ -46,8 +46,8 @@ pass __title__ = 'diskcache' -__version__ = '5.0.3' -__build__ = 0x050003 +__version__ = '5.1.0' +__build__ = 0x050100 __author__ = 'Grant Jenks' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2016-2020 Grant Jenks' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-diskcache-5.0.3/diskcache/fanout.py new/python-diskcache-5.1.0/diskcache/fanout.py --- old/python-diskcache-5.0.3/diskcache/fanout.py 2020-09-09 06:46:12.000000000 +0200 +++ new/python-diskcache-5.1.0/diskcache/fanout.py 2020-11-09 04:56:40.000000000 +0100 @@ -1,5 +1,6 @@ "Fanout cache automatically shards keys and values." +import contextlib as cl import functools import itertools as it import operator @@ -58,9 +59,46 @@ def __getattr__(self, name): + safe_names = {'timeout', 'disk'} + valid_name = name in DEFAULT_SETTINGS or name in safe_names + assert valid_name, 'cannot access {} in cache shard'.format(name) return getattr(self._shards[0], name) + @cl.contextmanager + def transact(self, retry=True): + """Context manager to perform a transaction by locking the cache. + + While the cache is locked, no other write operation is permitted. + Transactions should therefore be as short as possible. Read and write + operations performed in a transaction are atomic. Read operations may + occur concurrent to a transaction. + + Transactions may be nested and may not be shared between threads. + + Blocks until transactions are held on all cache shards by retrying as + necessary. + + >>> cache = FanoutCache() + >>> with cache.transact(): # Atomically increment two keys. + ... _ = cache.incr('total', 123.4) + ... _ = cache.incr('count', 1) + >>> with cache.transact(): # Atomically calculate average. + ... average = cache['total'] / cache['count'] + >>> average + 123.4 + + :return: context manager for use in `with` statement + + """ + assert retry, 'retry must be True in FanoutCache' + with cl.ExitStack() as stack: + for shard in self._shards: + shard_transaction = shard.transact(retry=True) + stack.enter_context(shard_transaction) + yield + + def set(self, key, value, expire=None, read=False, tag=None, retry=False): """Set `key` and `value` item in cache. _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org