Hello community,

here is the log from the commit of package python-pymemcache for 
openSUSE:Factory checked in at 2020-06-15 20:28:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pymemcache (Old)
 and      /work/SRC/openSUSE:Factory/.python-pymemcache.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pymemcache"

Mon Jun 15 20:28:57 2020 rev:9 rq:814553 version:3.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pymemcache/python-pymemcache.changes      
2020-05-12 22:33:13.511981204 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-pymemcache.new.3606/python-pymemcache.changes
    2020-06-15 20:29:04.926077409 +0200
@@ -1,0 +2,6 @@
+Sun Jun 14 09:30:56 UTC 2020 - Dirk Mueller <[email protected]>
+
+- update to 3.2.0:
+  * ``PooledClient`` and ``HashClient`` now support custom ``Client`` classes
+
+-------------------------------------------------------------------

Old:
----
  pymemcache-3.1.0.tar.gz

New:
----
  pymemcache-3.2.0.tar.gz

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

Other differences:
------------------
++++++ python-pymemcache.spec ++++++
--- /var/tmp/diff_new_pack.mWFxEA/_old  2020-06-15 20:29:06.050081303 +0200
+++ /var/tmp/diff_new_pack.mWFxEA/_new  2020-06-15 20:29:06.054081316 +0200
@@ -20,7 +20,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %bcond_without python2
 Name:           python-pymemcache
-Version:        3.1.0
+Version:        3.2.0
 Release:        0
 Summary:        A pure Python memcached client
 License:        Apache-2.0

++++++ pymemcache-3.1.0.tar.gz -> pymemcache-3.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/ChangeLog.rst 
new/pymemcache-3.2.0/ChangeLog.rst
--- old/pymemcache-3.1.0/ChangeLog.rst  2020-04-09 18:11:32.000000000 +0200
+++ new/pymemcache-3.2.0/ChangeLog.rst  2020-05-20 00:51:04.000000000 +0200
@@ -1,6 +1,14 @@
 Changelog
 =========
 
+New in version 3.2.0
+--------------------
+* ``PooledClient`` and ``HashClient`` now support custom ``Client`` classes
+
+New in version 3.1.1
+--------------------
+* Improve ``MockMemcacheClient`` to behave even more like ``Client``
+
 New in version 3.1.0
 --------------------
 * Add TLS support for TCP sockets.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/PKG-INFO 
new/pymemcache-3.2.0/PKG-INFO
--- old/pymemcache-3.1.0/PKG-INFO       2020-04-09 18:13:42.000000000 +0200
+++ new/pymemcache-3.2.0/PKG-INFO       2020-05-20 00:52:16.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: pymemcache
-Version: 3.1.0
+Version: 3.2.0
 Summary: "A comprehensive, fast, pure Python memcached client"
 Home-page: https://github.com/pinterest/pymemcache
 Author: Jon Parise
@@ -143,6 +143,14 @@
         Changelog
         =========
         
+        New in version 3.2.0
+        --------------------
+        * ``PooledClient`` and ``HashClient`` now support custom ``Client`` 
classes
+        
+        New in version 3.1.1
+        --------------------
+        * Improve ``MockMemcacheClient`` to behave even more like ``Client``
+        
         New in version 3.1.0
         --------------------
         * Add TLS support for TCP sockets.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/pymemcache/__init__.py 
new/pymemcache-3.2.0/pymemcache/__init__.py
--- old/pymemcache-3.1.0/pymemcache/__init__.py 2020-04-09 18:11:32.000000000 
+0200
+++ new/pymemcache-3.2.0/pymemcache/__init__.py 2020-05-20 00:51:04.000000000 
+0200
@@ -1,4 +1,4 @@
-__version__ = '3.1.0'
+__version__ = '3.2.0'
 
 from pymemcache.client.base import Client  # noqa
 from pymemcache.client.base import PooledClient  # noqa
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/pymemcache/client/base.py 
new/pymemcache-3.2.0/pymemcache/client/base.py
--- old/pymemcache-3.1.0/pymemcache/client/base.py      2020-04-07 
17:40:36.000000000 +0200
+++ new/pymemcache-3.2.0/pymemcache/client/base.py      2020-04-29 
01:54:59.000000000 +0200
@@ -1009,6 +1009,9 @@
     in the pool. Your serde object must therefore be thread-safe.
     """
 
+    #: :class:`Client` class used to create new clients
+    client_class = Client
+
     def __init__(self,
                  server,
                  serde=None,
@@ -1054,20 +1057,20 @@
                                 key_prefix=self.key_prefix)
 
     def _create_client(self):
-        client = Client(self.server,
-                        serde=self.serde,
-                        connect_timeout=self.connect_timeout,
-                        timeout=self.timeout,
-                        no_delay=self.no_delay,
-                        # We need to know when it fails *always* so that we
-                        # can remove/destroy it from the pool...
-                        ignore_exc=False,
-                        socket_module=self.socket_module,
-                        key_prefix=self.key_prefix,
-                        default_noreply=self.default_noreply,
-                        allow_unicode_keys=self.allow_unicode_keys,
-                        tls_context=self.tls_context)
-        return client
+        return self.client_class(
+            self.server,
+            serde=self.serde,
+            connect_timeout=self.connect_timeout,
+            timeout=self.timeout,
+            no_delay=self.no_delay,
+            # We need to know when it fails *always* so that we
+            # can remove/destroy it from the pool...
+            ignore_exc=False,
+            socket_module=self.socket_module,
+            key_prefix=self.key_prefix,
+            default_noreply=self.default_noreply,
+            allow_unicode_keys=self.allow_unicode_keys,
+            tls_context=self.tls_context)
 
     def close(self):
         self.client_pool.clear()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/pymemcache/client/hash.py 
new/pymemcache-3.2.0/pymemcache/client/hash.py
--- old/pymemcache-3.1.0/pymemcache/client/hash.py      2020-04-07 
17:40:36.000000000 +0200
+++ new/pymemcache-3.2.0/pymemcache/client/hash.py      2020-04-29 
01:54:59.000000000 +0200
@@ -14,6 +14,8 @@
     """
     A client for communicating with a cluster of memcached servers
     """
+    #: :class:`Client` class used to create new clients
+    client_class = Client
 
     def __init__(
         self,
@@ -112,7 +114,7 @@
                 **self.default_kwargs
             )
         else:
-            client = Client((server, port), **self.default_kwargs)
+            client = self.client_class((server, port), **self.default_kwargs)
 
         self.clients[key] = client
         self.hasher.add_node(key)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/pymemcache/serde.py 
new/pymemcache-3.2.0/pymemcache/serde.py
--- old/pymemcache-3.1.0/pymemcache/serde.py    2019-08-26 20:12:07.000000000 
+0200
+++ new/pymemcache-3.2.0/pymemcache/serde.py    2020-04-28 18:26:19.000000000 
+0200
@@ -110,7 +110,8 @@
 class PickleSerde(object):
     """
     An object which implements the serialization/deserialization protocol for
-    :py:class:`pymemcache.client.base.Client` and its descendants using 
pickle_.
+    :py:class:`pymemcache.client.base.Client` and its descendants using the
+    :mod:`pickle` module.
 
     Serialization and deserialization are implemented as methods of this class.
     To implement a custom serialization/deserialization method for pymemcache,
@@ -122,8 +123,6 @@
 
     For more details on the serialization protocol, see the class documentation
     for :py:class:`pymemcache.client.base.Client`
-
-    .. pickle: https://docs.python.org/3/library/pickle.html
     """
     def __init__(self, pickle_version=DEFAULT_PICKLE_VERSION):
         self._serialize_func = get_python_memcache_serializer(pickle_version)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/pymemcache/test/conftest.py 
new/pymemcache-3.2.0/pymemcache/test/conftest.py
--- old/pymemcache-3.1.0/pymemcache/test/conftest.py    2020-04-07 
17:40:36.000000000 +0200
+++ new/pymemcache-3.2.0/pymemcache/test/conftest.py    2020-05-06 
21:59:11.000000000 +0200
@@ -1,3 +1,4 @@
+import os.path
 import pytest
 import socket
 import ssl
@@ -69,7 +70,7 @@
 @pytest.fixture(scope='session')
 def tls_context():
     return ssl.create_default_context(
-        cafile="extras/tls/ca-root.crt"
+        cafile=os.path.join(os.path.dirname(__file__), "certs/ca-root.crt")
     )
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/pymemcache/test/test_client.py 
new/pymemcache-3.2.0/pymemcache/test/test_client.py
--- old/pymemcache-3.1.0/pymemcache/test/test_client.py 2020-03-20 
16:29:34.000000000 +0100
+++ new/pymemcache-3.2.0/pymemcache/test/test_client.py 2020-04-29 
01:54:59.000000000 +0200
@@ -1213,6 +1213,13 @@
                                     [b'__FAKE_RESPONSE__\r\n'])
         self._default_noreply_true('flush_all', (), [b'__FAKE_RESPONSE__\r\n'])
 
+    def test_custom_client(self):
+        class MyClient(Client):
+            pass
+        client = PooledClient(('host', 11211))
+        client.client_class = MyClient
+        assert isinstance(client.client_pool.get(), MyClient)
+
 
 class TestMockClient(ClientTestMixin, unittest.TestCase):
     def make_client(self, mock_socket_values, **kwargs):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/pymemcache/test/test_client_hash.py 
new/pymemcache-3.2.0/pymemcache/test/test_client_hash.py
--- old/pymemcache-3.1.0/pymemcache/test/test_client_hash.py    2020-04-07 
17:40:36.000000000 +0200
+++ new/pymemcache-3.2.0/pymemcache/test/test_client_hash.py    2020-04-29 
01:54:59.000000000 +0200
@@ -39,7 +39,8 @@
         return client
 
     def test_setup_client_without_pooling(self):
-        with mock.patch('pymemcache.client.hash.Client') as internal_client:
+        client_class = 'pymemcache.client.hash.HashClient.client_class'
+        with mock.patch(client_class) as internal_client:
             client = HashClient([], timeout=999, key_prefix='foo_bar_baz')
             client.add_server('127.0.0.1', '11211')
 
@@ -295,7 +296,7 @@
         for client in hash_client.clients.values():
             assert client.encoding == encoding
 
-    @mock.patch("pymemcache.client.hash.Client")
+    @mock.patch("pymemcache.client.hash.HashClient.client_class")
     def test_dead_server_comes_back(self, client_patch):
         client = HashClient([], dead_timeout=0, retry_attempts=0)
         client.add_server("127.0.0.1", 11211)
@@ -314,7 +315,7 @@
         assert client.get(b"key") == "Some value"
         assert ("127.0.0.1", 11211) not in client._dead_clients
 
-    @mock.patch("pymemcache.client.hash.Client")
+    @mock.patch("pymemcache.client.hash.HashClient.client_class")
     def test_failed_is_retried(self, client_patch):
         client = HashClient([], retry_attempts=1, retry_timeout=0)
         client.add_server("127.0.0.1", 11211)
@@ -333,4 +334,13 @@
 
         assert client_patch.call_count == 1
 
+    def test_custom_client(self):
+        class MyClient(Client):
+            pass
+
+        client = HashClient([])
+        client.client_class = MyClient
+        client.add_server('host', 11211)
+        assert isinstance(client.clients['host:11211'], MyClient)
+
     # TODO: Test failover logic
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/pymemcache/test/utils.py 
new/pymemcache-3.2.0/pymemcache/test/utils.py
--- old/pymemcache-3.1.0/pymemcache/test/utils.py       2020-03-20 
16:29:34.000000000 +0100
+++ new/pymemcache-3.2.0/pymemcache/test/utils.py       2020-04-28 
17:08:02.000000000 +0200
@@ -8,8 +8,9 @@
 import time
 
 import six
+import socket
 
-from pymemcache.exceptions import MemcacheIllegalInputError
+from pymemcache.exceptions import MemcacheClientError, 
MemcacheIllegalInputError
 from pymemcache.serde import LegacyWrappingSerde
 from pymemcache.client.base import check_key_helper
 
@@ -29,9 +30,11 @@
                  timeout=None,
                  no_delay=False,
                  ignore_exc=False,
+                 socket_module=None,
                  default_noreply=True,
                  allow_unicode_keys=False,
-                 encoding='ascii'):
+                 encoding='ascii',
+                 tls_context=None):
 
         self._contents = {}
 
@@ -44,7 +47,10 @@
         self.timeout = timeout
         self.no_delay = no_delay
         self.ignore_exc = ignore_exc
+        self.socket_module = socket
+        self.sock = None
         self.encoding = encoding
+        self.tls_context = tls_context
 
     def check_key(self, key):
         """Checks key and add key_prefix."""
@@ -77,7 +83,7 @@
 
     get_multi = get_many
 
-    def set(self, key, value, expire=0, noreply=True, flags=0):
+    def set(self, key, value, expire=0, noreply=True, flags=None):
         key = self.check_key(key)
         if (isinstance(value, six.string_types) and
                 not isinstance(value, six.binary_type)):
@@ -94,10 +100,13 @@
         self._contents[key] = expire, value, flags
         return True
 
-    def set_many(self, values, expire=None, noreply=True):
+    def set_many(self, values, expire=0, noreply=True, flags=None):
+        result = []
         for key, value in six.iteritems(values):
-            self.set(key, value, expire, noreply)
-        return []
+            ret = self.set(key, value, expire, noreply, flags=flags)
+            if not ret:
+                result.append(key)
+        return [] if noreply else result
 
     set_multi = set_many
 
@@ -110,20 +119,20 @@
 
     def decr(self, key, value, noreply=False):
         current = self.get(key)
-        if current is None:
-            return
-
-        self.set(key, current - value, noreply=noreply)
-        return current - value
+        present = current is not None
+        if present:
+            self.set(key, current - value, noreply=noreply)
+        return None if noreply or not present else current - value
 
-    def add(self, key, value, expire=None, noreply=True):
+    def add(self, key, value, expire=0, noreply=True, flags=None):
         current = self.get(key)
         present = current is not None
         if not present:
-            self.set(key, value, expire, noreply)
-        return not present
+            self.set(key, value, expire, noreply, flags=flags)
+        return noreply or not present
 
     def delete(self, key, noreply=True):
+        key = self.check_key(key)
         current = self._contents.pop(key, None)
         present = current is not None
         return noreply or present
@@ -133,7 +142,7 @@
             self.delete(key, noreply)
         return True
 
-    def prepend(self, key, value, expire=0, noreply=None, flags=None):
+    def prepend(self, key, value, expire=0, noreply=True, flags=None):
         current = self.get(key)
         if current is not None:
             if (isinstance(value, six.string_types) and
@@ -142,10 +151,10 @@
                     value = value.encode(self.encoding)
                 except (UnicodeEncodeError, UnicodeDecodeError):
                     raise MemcacheIllegalInputError
-            self.set(key, value + current)
+            self.set(key, value + current, expire, noreply, flags=flags)
         return True
 
-    def append(self, key, value, expire=0, noreply=None, flags=None):
+    def append(self, key, value, expire=0, noreply=True, flags=None):
         current = self.get(key)
         if current is not None:
             if (isinstance(value, six.string_types) and
@@ -154,12 +163,12 @@
                     value = value.encode(self.encoding)
                 except (UnicodeEncodeError, UnicodeDecodeError):
                     raise MemcacheIllegalInputError
-            self.set(key, current + value)
+            self.set(key, current + value, expire, noreply, flags=flags)
         return True
 
     delete_multi = delete_many
 
-    def stats(self):
+    def stats(self, *_args):
         # I make no claim that these values make any sense, but the format
         # of the output is the same as for pymemcache.client.Client.stats()
         return {
@@ -180,3 +189,37 @@
             "slab_reassign": False,
             "slab_automove": False,
         }
+
+    def replace(self, key, value, expire=0, noreply=True, flags=None):
+        current = self.get(key)
+        present = current is not None
+        if present:
+            self.set(key, value, expire, noreply, flags=flags)
+        return noreply or present
+
+    def cas(self, key, value, cas, expire=0, noreply=False, flags=None):
+        raise MemcacheClientError('CAS is not enabled for this instance')
+
+    def touch(self, key, expire=0, noreply=True):
+        current = self.get(key)
+        present = current is not None
+        if present:
+            self.set(key, current, expire, noreply=noreply)
+        return True if noreply or present else False
+
+    def cache_memlimit(self, memlimit):
+        return True
+
+    def version(self):
+        return 'MockMemcacheClient'
+
+    def flush_all(self, delay=0, noreply=True):
+        self.clear()
+
+        return noreply or self._contents == {}
+
+    def quit(self):
+        pass
+
+    def close(self):
+        pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymemcache-3.1.0/pymemcache.egg-info/PKG-INFO 
new/pymemcache-3.2.0/pymemcache.egg-info/PKG-INFO
--- old/pymemcache-3.1.0/pymemcache.egg-info/PKG-INFO   2020-04-09 
18:13:42.000000000 +0200
+++ new/pymemcache-3.2.0/pymemcache.egg-info/PKG-INFO   2020-05-20 
00:52:16.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: pymemcache
-Version: 3.1.0
+Version: 3.2.0
 Summary: "A comprehensive, fast, pure Python memcached client"
 Home-page: https://github.com/pinterest/pymemcache
 Author: Jon Parise
@@ -143,6 +143,14 @@
         Changelog
         =========
         
+        New in version 3.2.0
+        --------------------
+        * ``PooledClient`` and ``HashClient`` now support custom ``Client`` 
classes
+        
+        New in version 3.1.1
+        --------------------
+        * Improve ``MockMemcacheClient`` to behave even more like ``Client``
+        
         New in version 3.1.0
         --------------------
         * Add TLS support for TCP sockets.


Reply via email to