[Python-modules-commits] [aioredis] 02/11: Import aioredis_0.2.7.orig.tar.gz

Piotr Ożarowski piotr at moszumanska.debian.org
Sat Jul 30 15:27:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

piotr pushed a commit to branch master
in repository aioredis.

commit 4abfbd98d33c0158342e660b1b3d31204819f4a6
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Sun Jun 5 23:14:43 2016 +0200

    Import aioredis_0.2.7.orig.tar.gz
---
 CHANGES.txt                      | 26 ++++++++++++++++++++++++++
 PKG-INFO                         | 30 ++++++++++++++++++++++++++++--
 README.rst                       |  2 +-
 aioredis.egg-info/PKG-INFO       | 30 ++++++++++++++++++++++++++++--
 aioredis.egg-info/SOURCES.txt    |  1 +
 aioredis/__init__.py             |  8 ++++++--
 aioredis/commands/hash.py        |  4 ++--
 aioredis/commands/server.py      |  6 +++++-
 aioredis/commands/transaction.py |  6 +++---
 aioredis/connection.py           | 20 ++++++++++++++------
 aioredis/errors.py               |  6 ++++++
 aioredis/pool.py                 |  2 +-
 aioredis/util.py                 | 18 +++++++++++++++---
 setup.cfg                        | 13 +++++++++++++
 14 files changed, 149 insertions(+), 23 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index ac45c9f..77f4b05 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,32 @@
 Changes
 -------
 
+0.2.7 (2016-05-27)
+^^^^^^^^^^^^^^^^^^
+
+* ``create_pool()`` minsize default value changed to 1;
+
+* Fixed cancellation of wait_closed
+  (see `#118 <https://github.com/aio-libs/aioredis/issues/118>`_);
+
+* Fixed ``time()`` covertion to float
+  (see `#126 <https://github.com/aio-libs/aioredis/issues/126>`_);
+
+* Fixed ``hmset()`` method to return bool instead of ``b'OK'``
+  (see `#126`_);
+
+* Fixed multi/exec + watch issue (changed watch variable was causing
+  ``tr.execute()`` to fail)
+  (see `#121 <https://github.com/aio-libs/aioredis/issues/121>`_);
+
+* Replace ``asyncio.Future`` uses with utility method
+  (get ready to Python 3.5.2 ``loop.create_future()``);
+
+* Tests switched from unittest to pytest (see `#126`_);
+
+* Documentation updates;
+
+
 0.2.6 (2016-03-30)
 ^^^^^^^^^^^^^^^^^^
 
diff --git a/PKG-INFO b/PKG-INFO
index ab189d1..469f8b2 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: aioredis
-Version: 0.2.6
+Version: 0.2.7
 Summary: asyncio (PEP 3156) Redis support
 Home-page: https://github.com/aio-libs/aioredis
 Author: Alexey Popravka
@@ -39,7 +39,7 @@ Description: aioredis
         Documentation
         -------------
         
-        http://aioredis.readthedocs.org/
+        http://aioredis.readthedocs.io/
         
         Usage examples
         --------------
@@ -139,6 +139,32 @@ Description: aioredis
         Changes
         -------
         
+        0.2.7 (2016-05-27)
+        ^^^^^^^^^^^^^^^^^^
+        
+        * ``create_pool()`` minsize default value changed to 1;
+        
+        * Fixed cancellation of wait_closed
+          (see `#118 <https://github.com/aio-libs/aioredis/issues/118>`_);
+        
+        * Fixed ``time()`` covertion to float
+          (see `#126 <https://github.com/aio-libs/aioredis/issues/126>`_);
+        
+        * Fixed ``hmset()`` method to return bool instead of ``b'OK'``
+          (see `#126`_);
+        
+        * Fixed multi/exec + watch issue (changed watch variable was causing
+          ``tr.execute()`` to fail)
+          (see `#121 <https://github.com/aio-libs/aioredis/issues/121>`_);
+        
+        * Replace ``asyncio.Future`` uses with utility method
+          (get ready to Python 3.5.2 ``loop.create_future()``);
+        
+        * Tests switched from unittest to pytest (see `#126`_);
+        
+        * Documentation updates;
+        
+        
         0.2.6 (2016-03-30)
         ^^^^^^^^^^^^^^^^^^
         
diff --git a/README.rst b/README.rst
index f77a5c0..0003bc9 100644
--- a/README.rst
+++ b/README.rst
@@ -31,7 +31,7 @@ Support for dev Redis server        through low-level API
 Documentation
 -------------
 
-http://aioredis.readthedocs.org/
+http://aioredis.readthedocs.io/
 
 Usage examples
 --------------
diff --git a/aioredis.egg-info/PKG-INFO b/aioredis.egg-info/PKG-INFO
index ab189d1..469f8b2 100644
--- a/aioredis.egg-info/PKG-INFO
+++ b/aioredis.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: aioredis
-Version: 0.2.6
+Version: 0.2.7
 Summary: asyncio (PEP 3156) Redis support
 Home-page: https://github.com/aio-libs/aioredis
 Author: Alexey Popravka
@@ -39,7 +39,7 @@ Description: aioredis
         Documentation
         -------------
         
-        http://aioredis.readthedocs.org/
+        http://aioredis.readthedocs.io/
         
         Usage examples
         --------------
@@ -139,6 +139,32 @@ Description: aioredis
         Changes
         -------
         
+        0.2.7 (2016-05-27)
+        ^^^^^^^^^^^^^^^^^^
+        
+        * ``create_pool()`` minsize default value changed to 1;
+        
+        * Fixed cancellation of wait_closed
+          (see `#118 <https://github.com/aio-libs/aioredis/issues/118>`_);
+        
+        * Fixed ``time()`` covertion to float
+          (see `#126 <https://github.com/aio-libs/aioredis/issues/126>`_);
+        
+        * Fixed ``hmset()`` method to return bool instead of ``b'OK'``
+          (see `#126`_);
+        
+        * Fixed multi/exec + watch issue (changed watch variable was causing
+          ``tr.execute()`` to fail)
+          (see `#121 <https://github.com/aio-libs/aioredis/issues/121>`_);
+        
+        * Replace ``asyncio.Future`` uses with utility method
+          (get ready to Python 3.5.2 ``loop.create_future()``);
+        
+        * Tests switched from unittest to pytest (see `#126`_);
+        
+        * Documentation updates;
+        
+        
         0.2.6 (2016-03-30)
         ^^^^^^^^^^^^^^^^^^
         
diff --git a/aioredis.egg-info/SOURCES.txt b/aioredis.egg-info/SOURCES.txt
index 0c0c405..6fbeeda 100644
--- a/aioredis.egg-info/SOURCES.txt
+++ b/aioredis.egg-info/SOURCES.txt
@@ -2,6 +2,7 @@ CHANGES.txt
 LICENSE
 MANIFEST.in
 README.rst
+setup.cfg
 setup.py
 aioredis/__init__.py
 aioredis/connection.py
diff --git a/aioredis/__init__.py b/aioredis/__init__.py
index be5fd0e..05d2e9c 100644
--- a/aioredis/__init__.py
+++ b/aioredis/__init__.py
@@ -9,14 +9,18 @@ from .errors import (
     ProtocolError,
     RedisError,
     ReplyError,
+    ChannelClosedError,
+    WatchVariableError,
     )
 
 
-__version__ = '0.2.6'
+__version__ = '0.2.7'
 
 # make pyflakes happy
 (create_connection, RedisConnection,
  create_redis, create_reconnecting_redis, Redis,
  create_pool, RedisPool, Channel,
  RedisError, ProtocolError, ReplyError,
- PipelineError, MultiExecError, ConnectionClosedError)
+ PipelineError, MultiExecError, ConnectionClosedError,
+ ChannelClosedError, WatchVariableError,
+ )
diff --git a/aioredis/commands/hash.py b/aioredis/commands/hash.py
index b002329..47f08a8 100644
--- a/aioredis/commands/hash.py
+++ b/aioredis/commands/hash.py
@@ -1,4 +1,4 @@
-from aioredis.util import wait_convert, wait_make_dict, _NOTSET, PY_35
+from aioredis.util import wait_ok, wait_convert, wait_make_dict, _NOTSET, PY_35
 
 if PY_35:
     from aioredis.util import _ScanIterPairs
@@ -55,7 +55,7 @@ class HashCommandsMixin:
         """Set multiple hash fields to multiple values."""
         if len(pairs) % 2 != 0:
             raise TypeError("length of pairs must be even number")
-        return self._conn.execute(b'HMSET', key, field, value, *pairs)
+        return wait_ok(self._conn.execute(b'HMSET', key, field, value, *pairs))
 
     def hset(self, key, field, value):
         """Set the string value of a hash field."""
diff --git a/aioredis/commands/server.py b/aioredis/commands/server.py
index 76e68f5..60af361 100644
--- a/aioredis/commands/server.py
+++ b/aioredis/commands/server.py
@@ -198,7 +198,7 @@ class ServerCommandsMixin:
     def time(self):
         """Return current server time."""
         fut = self._conn.execute(b'TIME')
-        return wait_convert(fut, lambda obj: float(b'.'.join(obj)))
+        return wait_convert(fut, to_time)
 
 
 def _split(s):
@@ -206,6 +206,10 @@ def _split(s):
     return k.replace('-', '_'), v
 
 
+def to_time(obj):
+    return float(obj[0] + b'.' + obj[1].zfill(6))
+
+
 def to_tuples(value):
     lines = iter(value.splitlines(False))
     line = next(lines)
diff --git a/aioredis/commands/transaction.py b/aioredis/commands/transaction.py
index f177401..c67bfd1 100644
--- a/aioredis/commands/transaction.py
+++ b/aioredis/commands/transaction.py
@@ -2,7 +2,7 @@ import asyncio
 import functools
 
 from ..errors import RedisError, PipelineError, MultiExecError
-from ..util import wait_ok, async_task
+from ..util import wait_ok, async_task, create_future
 
 
 class TransactionsCommandsMixin:
@@ -89,7 +89,7 @@ class _RedisBuffer:
         self._loop = loop
 
     def execute(self, cmd, *args, **kw):
-        fut = asyncio.Future(loop=self._loop)
+        fut = create_future(loop=self._loop)
         self._pipeline.append((fut, cmd, args, kw))
         return fut
 
@@ -135,7 +135,7 @@ class Pipeline:
                 try:
                     task = async_task(attr(*args, **kw), loop=self._loop)
                 except Exception as exc:
-                    task = asyncio.Future(loop=self._loop)
+                    task = create_future(loop=self._loop)
                     task.set_exception(exc)
                 self._results.append(task)
                 return task
diff --git a/aioredis/connection.py b/aioredis/connection.py
index d5abd29..cd30b63 100644
--- a/aioredis/connection.py
+++ b/aioredis/connection.py
@@ -14,13 +14,15 @@ from .util import (
     coerced_keys_dict,
     Channel,
     decode,
-    async_task
+    async_task,
+    create_future,
     )
 from .errors import (
     ConnectionClosedError,
     RedisError,
     ProtocolError,
-    ReplyError
+    ReplyError,
+    WatchVariableError,
     )
 from .log import logger
 
@@ -102,7 +104,7 @@ class RedisConnection:
         self._db = 0
         self._closing = False
         self._closed = False
-        self._close_waiter = asyncio.Future(loop=self._loop)
+        self._close_waiter = create_future(loop=self._loop)
         self._reader_task.add_done_callback(self._close_waiter.set_result)
         self._in_transaction = None
         self._transaction_error = None  # XXX: never used?
@@ -241,7 +243,7 @@ class RedisConnection:
             cb = None
         if encoding is _NOTSET:
             encoding = self._encoding
-        fut = asyncio.Future(loop=self._loop)
+        fut = create_future(loop=self._loop)
         self._writer.write(encode_command(command, *args))
         self._waiters.append((fut, encoding, cb))
         return fut
@@ -264,7 +266,7 @@ class RedisConnection:
         cmd = encode_command(command, *channels)
         res = []
         for ch in channels:
-            fut = asyncio.Future(loop=self._loop)
+            fut = create_future(loop=self._loop)
             res.append(fut)
             self._waiters.append((fut, None, self._update_pubsub))
         self._writer.write(cmd)
@@ -311,7 +313,7 @@ class RedisConnection:
 
     @asyncio.coroutine
     def wait_closed(self):
-        yield from self._close_waiter
+        yield from asyncio.shield(self._close_waiter, loop=self._loop)
 
     @property
     def db(self):
@@ -353,6 +355,12 @@ class RedisConnection:
         recall.popleft()  # ignore first (its _start_transaction)
         if discard:
             return obj
+        assert isinstance(obj, list) or (obj is None and not discard), (
+            "Unexpected MULTI/EXEC result", obj, recall)
+        # TODO: need to be able to re-try transaction
+        if obj is None:
+            err = WatchVariableError("WATCH variable has changed")
+            obj = [err] * len(recall)
         assert len(obj) == len(recall), (
             "Wrong number of result items in mutli-exec", obj, recall)
         res = []
diff --git a/aioredis/errors.py b/aioredis/errors.py
index ae2043e..41dfea1 100644
--- a/aioredis/errors.py
+++ b/aioredis/errors.py
@@ -4,6 +4,8 @@ __all__ = [
     'ReplyError',
     'PipelineError',
     'MultiExecError',
+    'WatchVariableError',
+    'ChannelClosedError',
     'ConnectionClosedError',
     ]
 
@@ -31,6 +33,10 @@ class MultiExecError(PipelineError):
     """Raised if command within MULTI/EXEC block caused error."""
 
 
+class WatchVariableError(MultiExecError):
+    """Raised if watched variable changed (EXEC returns None)."""
+
+
 class ChannelClosedError(RedisError):
     """Raised when Pub/Sub channel is unsubscribed and messages queue is empty.
     """
diff --git a/aioredis/pool.py b/aioredis/pool.py
index 59ec14f..7217f7b 100644
--- a/aioredis/pool.py
+++ b/aioredis/pool.py
@@ -12,7 +12,7 @@ PY_35 = sys.version_info >= (3, 5)
 
 @asyncio.coroutine
 def create_pool(address, *, db=0, password=None, ssl=None, encoding=None,
-                minsize=10, maxsize=10, commands_factory=Redis, loop=None):
+                minsize=1, maxsize=10, commands_factory=Redis, loop=None):
     """Creates Redis Pool.
 
     By default it creates pool of commands_factory instances, but it is
diff --git a/aioredis/util.py b/aioredis/util.py
index 0de1407..02fa5e7 100644
--- a/aioredis/util.py
+++ b/aioredis/util.py
@@ -2,6 +2,8 @@ import asyncio
 import json
 import sys
 
+from asyncio.base_events import BaseEventLoop
+
 from .errors import ChannelClosedError
 from .log import logger
 
@@ -101,7 +103,8 @@ class Channel:
     def get(self, *, encoding=None, decoder=None):
         """Coroutine that waits for and returns a message.
 
-        Raises (TBD) exception if channel is unsubscribed and has no messages.
+        Raises ChannelClosedError exception if channel is unsubscribed
+        and has no messages.
         """
         assert decoder is None or callable(decoder), decoder
         if not self.is_active:
@@ -159,7 +162,7 @@ class Channel:
         if not self._queue.empty():
             return True
         if self._waiter is None:
-            self._waiter = asyncio.Future(loop=self._loop)
+            self._waiter = create_future(loop=self._loop)
         yield from self._waiter
         return self.is_active
 
@@ -306,4 +309,13 @@ def _set_exception(fut, exception):
 if hasattr(asyncio, 'ensure_future'):
     async_task = asyncio.ensure_future
 else:
-    async_task = asyncio.async
+    async_task = asyncio.async  # Deprecated since 3.4.4
+
+
+# create_future is new in version 3.5.2
+if hasattr(BaseEventLoop, 'create_future'):
+    def create_future(loop):
+        return loop.create_future()
+else:
+    def create_future(loop):
+        return asyncio.Future(loop=loop)
diff --git a/setup.cfg b/setup.cfg
index 861a9f5..be9a407 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,3 +1,16 @@
+[pytest]
+minversion = 2.9.1
+addopts = -v --cov-report=term --cov-report=html
+restpaths = tests
+markers = 
+	run_loop: Mark coroutine to be run with asyncio loop.
+	redis_version(*version, reason): Mark test expecting minimum Redis version
+	skip(reason): Skip test
+
+[coverage:run]
+branch = true
+source = aioredis,tests
+
 [egg_info]
 tag_build = 
 tag_date = 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/aioredis.git



More information about the Python-modules-commits mailing list