Hello community,

here is the log from the commit of package python-diskcache for 
openSUSE:Factory checked in at 2020-02-27 14:38:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-diskcache (Old)
 and      /work/SRC/openSUSE:Factory/.python-diskcache.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-diskcache"

Thu Feb 27 14:38:45 2020 rev:5 rq:779740 version:4.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-diskcache/python-diskcache.changes        
2019-11-15 00:33:38.583719069 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-diskcache.new.26092/python-diskcache.changes 
    2020-02-27 14:39:14.462267867 +0100
@@ -1,0 +2,8 @@
+Thu Feb 27 05:15:40 UTC 2020 - Steve Kowalik <[email protected]>
+
+- Update to 4.1.0:
+  * Move zero-expiration logic into memoize (rather than Cache.set)
+  * Provide JSONDisk with diskcache (#124)
+  * Add check for DEFAULT_TIMEOUT in DjangoCache.memoize
+
+-------------------------------------------------------------------

Old:
----
  v4.0.0.tar.gz

New:
----
  v4.1.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-diskcache.spec ++++++
--- /var/tmp/diff_new_pack.wMXXX1/_old  2020-02-27 14:39:17.002273108 +0100
+++ /var/tmp/diff_new_pack.wMXXX1/_new  2020-02-27 14:39:17.006273116 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-diskcache
 #
-# Copyright (c) 2019 SUSE LLC.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-diskcache
-Version:        4.0.0
+Version:        4.1.0
 Release:        0
 Summary:        Disk and file backed cache
 License:        Apache-2.0

++++++ v4.0.0.tar.gz -> v4.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-diskcache-4.0.0/.gitignore 
new/python-diskcache-4.1.0/.gitignore
--- old/python-diskcache-4.0.0/.gitignore       2019-07-03 05:04:38.000000000 
+0200
+++ new/python-diskcache-4.1.0/.gitignore       2019-10-14 01:59:15.000000000 
+0200
@@ -3,6 +3,7 @@
 
 # virutalenv directories
 /env*/
+/.venv*/
 
 # test files/directories
 /.cache/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-diskcache-4.0.0/README.rst 
new/python-diskcache-4.1.0/README.rst
--- old/python-diskcache-4.0.0/README.rst       2019-07-03 05:04:38.000000000 
+0200
+++ new/python-diskcache-4.1.0/README.rst       2019-10-14 01:59:15.000000000 
+0200
@@ -234,7 +234,7 @@
 
 **Timings**
 
-These are very rough measurements. See `DiskCache Cache Benchmarks`_ for more
+These are rough measurements. See `DiskCache Cache Benchmarks`_ for more
 rigorous data.
 
 ================ ============= ========= ========= ============ ============
@@ -279,8 +279,8 @@
 .....................
 
 * `ZODB`_ supports an isomorphic interface for database operations which means
-  there's very little impact on your code to make objects persistent and
-  there's no database mapper that partially hides the datbase.
+  there's little impact on your code to make objects persistent and there's no
+  database mapper that partially hides the datbase.
 * `CodernityDB`_ is an open source, pure-Python, multi-platform, schema-less,
   NoSQL database and includes an HTTP server version, and a Python client
   library that aims to be 100% compatible with the embedded version.
@@ -332,7 +332,7 @@
   PostgreSQL adapter for the Python programming language.
 * `Oracle DB`_ is a relational database management system (RDBMS) from the
   Oracle Corporation. Originally developed in 1977, Oracle DB is one of the
-  most trusted and widely-used enterprise relational database engines.
+  most trusted and widely used enterprise relational database engines.
 * `Microsoft SQL Server`_ is a relational database management system developed
   by Microsoft. As a database server, it stores and retrieves data as requested
   by other software applications.
@@ -398,7 +398,7 @@
 
 Unless required by applicable law or agreed to in writing, software distributed
 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
-CONDITIONS OF ANY KIND, either express or implied.  See the License for the
+CONDITIONS OF ANY KIND, either express or implied. See the License for the
 specific language governing permissions and limitations under the License.
 
 .. _`DiskCache`: http://www.grantjenks.com/docs/diskcache/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-diskcache-4.0.0/diskcache/__init__.py 
new/python-diskcache-4.1.0/diskcache/__init__.py
--- old/python-diskcache-4.0.0/diskcache/__init__.py    2019-07-03 
05:04:38.000000000 +0200
+++ new/python-diskcache-4.1.0/diskcache/__init__.py    2019-10-14 
01:59:15.000000000 +0200
@@ -6,7 +6,7 @@
 
 """
 
-from .core import Cache, Disk, EmptyDirWarning, UnknownFileWarning, Timeout
+from .core import Cache, Disk, EmptyDirWarning, JSONDisk, UnknownFileWarning, 
Timeout
 from .core import DEFAULT_SETTINGS, ENOVAL, EVICTION_POLICY, UNKNOWN
 from .fanout import FanoutCache
 from .persistent import Deque, Index
@@ -25,6 +25,7 @@
     'EmptyDirWarning',
     'FanoutCache',
     'Index',
+    'JSONDisk',
     'Lock',
     'RLock',
     'Timeout',
@@ -43,8 +44,8 @@
     pass
 
 __title__ = 'diskcache'
-__version__ = '4.0.0'
-__build__ = 0x040000
+__version__ = '4.1.0'
+__build__ = 0x040100
 __author__ = 'Grant Jenks'
 __license__ = 'Apache 2.0'
 __copyright__ = 'Copyright 2016-2018 Grant Jenks'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-diskcache-4.0.0/diskcache/core.py 
new/python-diskcache-4.1.0/diskcache/core.py
--- old/python-diskcache-4.0.0/diskcache/core.py        2019-07-03 
05:04:38.000000000 +0200
+++ new/python-diskcache-4.1.0/diskcache/core.py        2019-10-14 
01:59:15.000000000 +0200
@@ -7,6 +7,7 @@
 import errno
 import functools as ft
 import io
+import json
 import os
 import os.path as op
 import pickletools
@@ -361,6 +362,50 @@
                 raise
 
 
+class JSONDisk(Disk):
+    "Cache key and value using JSON serialization with zlib compression."
+    def __init__(self, directory, compress_level=1, **kwargs):
+        """Initialize JSON disk instance.
+
+        Keys and values are compressed using the zlib library. The
+        `compress_level` is an integer from 0 to 9 controlling the level of
+        compression; 1 is fastest and produces the least compression, 9 is
+        slowest and produces the most compression, and 0 is no compression.
+
+        :param str directory: directory path
+        :param int compress_level: zlib compression level (default 1)
+        :param kwargs: super class arguments
+
+        """
+        self.compress_level = compress_level
+        super(JSONDisk, self).__init__(directory, **kwargs)
+
+
+    def put(self, key):
+        json_bytes = json.dumps(key).encode('utf-8')
+        data = zlib.compress(json_bytes, self.compress_level)
+        return super(JSONDisk, self).put(data)
+
+
+    def get(self, key, raw):
+        data = super(JSONDisk, self).get(key, raw)
+        return json.loads(zlib.decompress(data).decode('utf-8'))
+
+
+    def store(self, value, read, key=UNKNOWN):
+        if not read:
+            json_bytes = json.dumps(value).encode('utf-8')
+            value = zlib.compress(json_bytes, self.compress_level)
+        return super(JSONDisk, self).store(value, read, key=key)
+
+
+    def fetch(self, mode, filename, value, read):
+        data = super(JSONDisk, self).fetch(mode, filename, value, read)
+        if not read:
+            data = json.loads(zlib.decompress(data).decode('utf-8'))
+        return data
+
+
 class Timeout(Exception):
     "Database timeout expired."
 
@@ -737,9 +782,6 @@
         When `read` is `True`, `value` should be a file-like object opened
         for reading in binary mode.
 
-        If `expire` is less than or equal to zero then immediately returns
-        `False`.
-
         Raises :exc:`Timeout` error when database timeout occurs and `retry` is
         `False` (default).
 
@@ -754,9 +796,6 @@
         :raises Timeout: if database timeout occurs
 
         """
-        if expire is not None and expire <= 0:
-            return False
-
         now = time.time()
         db_key, raw = self._disk.put(key)
         expire_time = None if expire is None else now + expire
@@ -1779,6 +1818,10 @@
         If name is set to None (default), the callable name will be determined
         automatically.
 
+        When expire is set to zero, function results will not be set in the
+        cache. Cache lookups still occur, however. Read
+        :doc:`case-study-landing-page-caching` for example usage.
+
         If typed is set to True, function arguments of different types will be
         cached separately. For example, f(3) and f(3.0) will be treated as
         distinct calls with distinct results.
@@ -1843,7 +1886,8 @@
 
                 if result is ENOVAL:
                     result = func(*args, **kwargs)
-                    self.set(key, result, expire=expire, tag=tag, retry=True)
+                    if expire is None or expire > 0:
+                        self.set(key, result, expire, tag=tag, retry=True)
 
                 return result
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-diskcache-4.0.0/diskcache/djangocache.py 
new/python-diskcache-4.1.0/diskcache/djangocache.py
--- old/python-diskcache-4.0.0/diskcache/djangocache.py 2019-07-03 
05:04:38.000000000 +0200
+++ new/python-diskcache-4.1.0/diskcache/djangocache.py 2019-10-14 
01:59:15.000000000 +0200
@@ -368,6 +368,10 @@
         If name is set to None (default), the callable name will be determined
         automatically.
 
+        When timeout is set to zero, function results will not be set in the
+        cache. Cache lookups still occur, however. Read
+        :doc:`case-study-landing-page-caching` for example usage.
+
         If typed is set to True, function arguments of different types will be
         cached separately. For example, f(3) and f(3.0) will be treated as
         distinct calls with distinct results.
@@ -407,9 +411,15 @@
 
                 if result is ENOVAL:
                     result = func(*args, **kwargs)
-                    self.set(
-                        key, result, timeout, version, tag=tag, retry=True,
+                    valid_timeout = (
+                        timeout is None
+                        or timeout == DEFAULT_TIMEOUT
+                        or timeout > 0
                     )
+                    if valid_timeout:
+                        self.set(
+                            key, result, timeout, version, tag=tag, retry=True,
+                        )
 
                 return result
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-diskcache-4.0.0/docs/api.rst 
new/python-diskcache-4.1.0/docs/api.rst
--- old/python-diskcache-4.0.0/docs/api.rst     2019-07-03 05:04:38.000000000 
+0200
+++ new/python-diskcache-4.1.0/docs/api.rst     2019-10-14 01:59:15.000000000 
+0200
@@ -116,6 +116,16 @@
    :special-members:
    :exclude-members: __weakref__
 
+JSONDisk
+--------
+
+Read the :ref:`Disk tutorial <tutorial-disk>` for details.
+
+.. autoclass:: diskcache.JSONDisk
+   :members:
+   :special-members:
+   :exclude-members: __weakref__
+
 Timeout
 -------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-diskcache-4.0.0/docs/cache-benchmarks.rst 
new/python-diskcache-4.1.0/docs/cache-benchmarks.rst
--- old/python-diskcache-4.0.0/docs/cache-benchmarks.rst        2019-07-03 
05:04:38.000000000 +0200
+++ new/python-diskcache-4.1.0/docs/cache-benchmarks.rst        2019-10-14 
01:59:15.000000000 +0200
@@ -116,7 +116,7 @@
     Total     98999                                                     2.669s
 ========= ========= ========= ========= ========= ========= ========= =========
 
-Memcached performance is low latency and very stable.
+Memcached performance is low latency and stable.
 
 ========= ========= ========= ========= ========= ========= ========= =========
 Timings for redis.StrictRedis
@@ -144,8 +144,8 @@
 
 .. image:: _static/core-p8-get.png
 
-Under heavy load, :doc:`DiskCache <index>` gets are very low latency. At the
-90th percentile, they are less than half the latency of Memcached.
+Under heavy load, :doc:`DiskCache <index>` gets are low latency. At the 90th
+percentile, they are less than half the latency of Memcached.
 
 Set
 ...
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-diskcache-4.0.0/docs/case-study-landing-page-caching.rst 
new/python-diskcache-4.1.0/docs/case-study-landing-page-caching.rst
--- old/python-diskcache-4.0.0/docs/case-study-landing-page-caching.rst 
2019-07-03 05:04:38.000000000 +0200
+++ new/python-diskcache-4.1.0/docs/case-study-landing-page-caching.rst 
2019-10-14 01:59:15.000000000 +0200
@@ -75,7 +75,7 @@
 as three layers of caching and locking wrap the function.
 
 Ideally, the system would anticipate the pending expiration of the cached item
-and would recompute the result in a separate thread of execution.  Coordinating
+and would recompute the result in a separate thread of execution. Coordinating
 recomputation would be a function of the number of workers, the expiration
 time, and the duration of computation. Fortunately, Vattani, et al. published
 the solution in "Optimal Probabilistic Cache Stampede Prevention" in 2015.
@@ -135,7 +135,7 @@
 page and cache the result. With no barrier in place, eleven workers cause a
 cache stampede. The eleven workers are composed of ten synchronous workers and
 one in a background thread. The best way to customize :math:`\beta` is through
-experimentation, otherwise the default is very reasonable.
+experimentation, otherwise the default is reasonable.
 
 :doc:`DiskCache <index>` provides data types and recipes for memoization and
 mitigation of cache stampedes. The decorators provided are composable for a
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-diskcache-4.0.0/docs/case-study-web-crawler.rst 
new/python-diskcache-4.1.0/docs/case-study-web-crawler.rst
--- old/python-diskcache-4.0.0/docs/case-study-web-crawler.rst  2019-07-03 
05:04:38.000000000 +0200
+++ new/python-diskcache-4.1.0/docs/case-study-web-crawler.rst  2019-10-14 
01:59:15.000000000 +0200
@@ -116,7 +116,7 @@
     >>> len(results)
     99
 
-As an added benefit, our code also now works in parallel. For free!
+As an added benefit, our code also now works in parallel.
 
     >>> results.clear()
     >>> from multiprocessing import Process
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-diskcache-4.0.0/docs/djangocache-benchmarks.rst 
new/python-diskcache-4.1.0/docs/djangocache-benchmarks.rst
--- old/python-diskcache-4.0.0/docs/djangocache-benchmarks.rst  2019-07-03 
05:04:38.000000000 +0200
+++ new/python-diskcache-4.1.0/docs/djangocache-benchmarks.rst  2019-10-14 
01:59:15.000000000 +0200
@@ -102,8 +102,8 @@
 
 .. image:: _static/djangocache-get.png
 
-Under heavy load, :class:`DjangoCache <diskcache.DjangoCache>` gets are very
-low latency. At the 99th percentile they are on par with the Memcached cache
+Under heavy load, :class:`DjangoCache <diskcache.DjangoCache>` gets are low
+latency. At the 99th percentile they are on par with the Memcached cache
 backend.
 
 Set
@@ -157,7 +157,7 @@
     Total    791992                                                    68.825s
 ========= ========= ========= ========= ========= ========= ========= =========
 
-Memcached performance is low latency and very stable.
+Memcached performance is low latency and stable.
 
 ========= ========= ========= ========= ========= ========= ========= =========
 Timings for redis
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-diskcache-4.0.0/docs/sf-python-2017-meetup-talk.rst 
new/python-diskcache-4.1.0/docs/sf-python-2017-meetup-talk.rst
--- old/python-diskcache-4.0.0/docs/sf-python-2017-meetup-talk.rst      
2019-07-03 05:04:38.000000000 +0200
+++ new/python-diskcache-4.1.0/docs/sf-python-2017-meetup-talk.rst      
2019-10-14 01:59:15.000000000 +0200
@@ -20,7 +20,7 @@
 Backends
 --------
 
-* Backends have very different designs and tradeoffs.
+* Backends have different designs and tradeoffs.
 
 
 Frameworks
@@ -165,7 +165,7 @@
 * Use a context manager for isolation level management.
 * Pragmas tune the behavior and performance of SQLite.
 
-  * Default is very robust and slow.
+  * Default is robust and slow.
   * Use write-ahead-log so writers don't block readers.
   * Memory-map pages for fast lookups.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-diskcache-4.0.0/docs/tutorial.rst 
new/python-diskcache-4.1.0/docs/tutorial.rst
--- old/python-diskcache-4.0.0/docs/tutorial.rst        2019-07-03 
05:04:38.000000000 +0200
+++ new/python-diskcache-4.1.0/docs/tutorial.rst        2019-10-14 
01:59:15.000000000 +0200
@@ -53,8 +53,8 @@
 :doc:`DiskCache <index>` is looking for a Debian package maintainer. If you can
 help, please open an issue in the `DiskCache Issue Tracker`_.
 
-:doc:`DiskCache <index>` is looking for a CentOS/RPM package maintainer.  If
-you can help, please open an issue in the `DiskCache Issue Tracker`_.
+:doc:`DiskCache <index>` is looking for a CentOS/RPM package maintainer. If you
+can help, please open an issue in the `DiskCache Issue Tracker`_.
 
 .. _`DiskCache Issue Tracker`: 
https://github.com/grantjenks/python-diskcache/issues/
 
@@ -778,11 +778,11 @@
   the access count field stored in the cache database. On every access, the
   field is incremented. Every access therefore requires writing the database
   which slows accesses.
-* ``"none"`` disables cache evictions. Caches will grow in size without
-  bound. Cache items will still be lazily removed if they expire. The
-  persistent data types, :class:`.Deque` and :class:`.Index`, use the
-  ``"none"`` eviction policy. For :ref:`lazy culling <tutorial-culling>` use
-  the :ref:`cull_limit <constants>` setting instead.
+* ``"none"`` disables cache evictions. Caches will grow without bound. Cache
+  items will still be lazily removed if they expire. The persistent data types,
+  :class:`.Deque` and :class:`.Index`, use the ``"none"`` eviction policy. For
+  :ref:`lazy culling <tutorial-culling>` use the :ref:`cull_limit <constants>`
+  setting instead.
 
 All clients accessing the cache are expected to use the same eviction
 policy. The policy can be set during initialization using a keyword argument.
@@ -813,7 +813,8 @@
 To customize serialization, you may pass in a :class:`Disk <diskcache.Disk>`
 subclass to initialize the cache. All clients accessing the cache are expected
 to use the same serialization. The default implementation uses Pickle and the
-example below uses compressed JSON.
+example below uses compressed JSON, available for convenience as
+:class:`JSONDisk <diskcache.JSONDisk>`.
 
 .. code-block:: python
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-diskcache-4.0.0/requirements.txt 
new/python-diskcache-4.1.0/requirements.txt
--- old/python-diskcache-4.0.0/requirements.txt 2019-07-03 05:04:38.000000000 
+0200
+++ new/python-diskcache-4.1.0/requirements.txt 2019-10-14 01:59:15.000000000 
+0200
@@ -12,6 +12,7 @@
 pytest-django
 pytest-env
 pytest-xdist
+rstcheck
 sphinx
 tox
 twine
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-diskcache-4.0.0/tests/test_core.py 
new/python-diskcache-4.1.0/tests/test_core.py
--- old/python-diskcache-4.0.0/tests/test_core.py       2019-07-03 
05:04:38.000000000 +0200
+++ new/python-diskcache-4.1.0/tests/test_core.py       2019-10-14 
01:59:15.000000000 +0200
@@ -7,7 +7,6 @@
 import functools as ft
 import hashlib
 import io
-import json
 import mock
 import os
 import os.path as op
@@ -22,7 +21,6 @@
 import time
 import unittest
 import warnings
-import zlib
 
 try:
     import cPickle as pickle
@@ -94,35 +92,8 @@
             pass
 
 
-class JSONDisk(diskcache.Disk):
-    def __init__(self, directory, compress_level=1, **kwargs):
-        self.compress_level = compress_level
-        super(JSONDisk, self).__init__(directory, **kwargs)
-
-    def put(self, key):
-        json_bytes = json.dumps(key).encode('utf-8')
-        data = zlib.compress(json_bytes, self.compress_level)
-        return super(JSONDisk, self).put(data)
-
-    def get(self, key, raw):
-        data = super(JSONDisk, self).get(key, raw)
-        return json.loads(zlib.decompress(data).decode('utf-8'))
-
-    def store(self, value, read, key=dc.UNKNOWN):
-        if not read:
-            json_bytes = json.dumps(value).encode('utf-8')
-            value = zlib.compress(json_bytes, self.compress_level)
-        return super(JSONDisk, self).store(value, read, key=key)
-
-    def fetch(self, mode, filename, value, read):
-        data = super(JSONDisk, self).fetch(mode, filename, value, read)
-        if not read:
-            data = json.loads(zlib.decompress(data).decode('utf-8'))
-        return data
-
-
 def test_custom_disk():
-    with dc.Cache(disk=JSONDisk, disk_compress_level=6) as cache:
+    with dc.Cache(disk=dc.JSONDisk, disk_compress_level=6) as cache:
         values = [None, True, 0, 1.23, {}, [None] * 10000]
 
         for value in values:


Reply via email to