[Python-modules-commits] [aioredis] 01/03: Import aioredis_0.2.4.orig.tar.gz

Piotr Ożarowski piotr at moszumanska.debian.org
Sat Oct 31 23:03:31 UTC 2015


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

piotr pushed a commit to tag debian/0.2.4-1
in repository aioredis.

commit f1e10b55f916395553095af8d7e3f08b07404419
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Sat Oct 31 23:46:41 2015 +0100

    Import aioredis_0.2.4.orig.tar.gz
---
 CHANGES.txt                     | 115 +++++++-------------------------
 PKG-INFO                        | 141 +++++++++++++---------------------------
 README.rst                      |  23 ++++++-
 aioredis.egg-info/PKG-INFO      | 141 +++++++++++++---------------------------
 aioredis/__init__.py            |   2 +-
 aioredis/commands/generic.py    |  18 ++++-
 aioredis/commands/hash.py       |  19 +++++-
 aioredis/commands/set.py        |  20 +++++-
 aioredis/commands/sorted_set.py |  19 +++++-
 aioredis/pool.py                |  70 ++++++++++++++++++--
 aioredis/util.py                |  42 ++++++++++++
 setup.cfg                       |   2 +-
 setup.py                        |   1 +
 13 files changed, 313 insertions(+), 300 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index b51f27b..7de3631 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,9 +1,20 @@
 Changes
 -------
 
-0.2.4 (xxxx-xx-xx)
+0.2.4 (2015-10-13)
 ^^^^^^^^^^^^^^^^^^
 
+* Python 3.5 ``async`` support:
+
+  - New scan commands API (``iscan``, ``izscan``, ``ihscan``);
+
+  - Pool made awaitable (allowing ``with await pool: ...`` constructs);
+
+* Fixed dropping closed connections from free pool
+  (see `#83 <https://github.com/aio-libs/aioredis/issues/83>`_);
+
+* Docs updated;
+
 
 0.2.3 (2015-08-14)
 ^^^^^^^^^^^^^^^^^^
@@ -11,12 +22,12 @@ Changes
 * Redis cluster support work in progress;
 
 * Fixed pool issue causing pool growth over max size & ``acquire`` call hangs
-  (see https://github.com/aio-libs/aioredis/issues/71);
+  (see `#71 <https://github.com/aio-libs/aioredis/issues/71>`_);
 
 * ``info`` server command result parsing implemented;
 
 * Fixed behavior of util functions
-  (see https://github.com/aio-libs/aioredis/issues/70);
+  (see `#70 <https://github.com/aio-libs/aioredis/issues/70>`_);
 
 * ``hstrlen`` command added;
 
@@ -30,13 +41,18 @@ Changes
 
 * Decoding data with ``encoding`` paramter now takes into account
   list (array) replies
-  (see https://github.com/aio-libs/aioredis/pull/68);
+  (see `#68 <https://github.com/aio-libs/aioredis/pull/68>`_);
 
 * ``encoding`` parameter added to following commands:
+
   - generic commands: keys, randomkey;
+
   - hash commands: hgetall, hkeys, hmget, hvals;
+
   - list commands: blpop, brpop, brpoplpush, lindex, lpop, lrange, rpop, rpoplpush;
+
   - set commands: smembers, spop, srandmember;
+
   - string commands: getrange, getset, mget;
 
 * Backward incompatibility:
@@ -52,7 +68,7 @@ Changes
 * Logging added (aioredis.log module);
 
 * Fixed issue with ``wait_message`` in pub/sub
-  (see https://github.com/aio-libs/aioredis/issues/66);
+  (see `#66 <https://github.com/aio-libs/aioredis/issues/66>`_);
 
 
 0.2.0 (2015-06-04)
@@ -61,93 +77,6 @@ Changes
 * Pub/Sub support added;
 
 * Fix in ``zrevrangebyscore`` command
-  (see https://github.com/aio-libs/aioredis/pull/62);
+  (see `#62 <https://github.com/aio-libs/aioredis/pull/62>`_);
 
 * Fixes/tests/docs;
-
-
-0.1.5 (2014-12-09)
-^^^^^^^^^^^^^^^^^^
-
-* AutoConnector added;
-
-* wait_closed method added for clean connections shutdown;
-
-* ``zscore`` command fixed;
-
-* Test fixes;
-
-
-0.1.4 (2014-09-22)
-^^^^^^^^^^^^^^^^^^
-
-* Dropped following Redis methods -- Redis.multi(), Redis.exec(), Redis.discard()
-
-* Redis.multi_exec hack'ish property removed
-
-* Redis.multi_exec() method added
-
-* High-level commands implemented:
-
-  * generic commands (tests);
-  * transactions commands (api stabilization).
-
-* Backward incompatibilities:
-
-  * Following sorted set commands' API changed:
-
-    zcount, zrangebyscore, zremrangebyscore, zrevrangebyscore;
-
-  * set string command' API changed;
-
-
-
-0.1.3 (2014-08-08)
-^^^^^^^^^^^^^^^^^^
-
-* RedisConnection.execute refactored to support commands pipelining
-  (see http://github.com/aio-libs/aioredis/issues/33);
-
-* Several fixes;
-
-* WIP on transactions and commands interface;
-
-* High-level commands implemented and tested:
-
-  * hash commands;
-  * hyperloglog commands;
-  * set commands;
-  * scripting commands;
-  * string commands;
-  * list commands;
-
-
-0.1.2 (2014-07-31)
-^^^^^^^^^^^^^^^^^^
-
-* create_connection, create_pool, create_redis functions updated:
-  db and password arguments made keyword-only
-  (see http://github.com/aio-libs/aioredis/issues/26);
-
-* Fixed transaction handling
-  (see http://github.com/aio-libs/aioredis/issues/32);
-
-* Response decoding
-  (see http://github.com/aio-libs/aioredis/issues/16);
-
-
-0.1.1 (2014-07-07)
-^^^^^^^^^^^^^^^^^^
-
-* Transactions support (in connection, high-level commands have some issues);
-* Docs & tests updated.
-
-
-0.1.0 (2014-06-24)
-^^^^^^^^^^^^^^^^^^
-
-* Initial release;
-* RedisConnection implemented;
-* RedisPool implemented;
-* Docs for RedisConnection & RedisPool;
-* WIP on high-level API.
diff --git a/PKG-INFO b/PKG-INFO
index 6302e36..7b5eb0e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: aioredis
-Version: 0.2.3
+Version: 0.2.4
 Summary: asyncio (PEP 3156) Redis support
 Home-page: https://github.com/aio-libs/aioredis
 Author: Alexey Popravka
@@ -9,7 +9,7 @@ License: MIT
 Description: aioredis
         ========
         
-        asyncio (PEP 3156) Redis support
+        asyncio (PEP 3156) Redis client library.
         
         .. image:: https://travis-ci.org/aio-libs/aioredis.svg?branch=master
            :target: https://travis-ci.org/aio-libs/aioredis
@@ -18,6 +18,22 @@ Description: aioredis
         .. image:: https://coveralls.io/repos/aio-libs/aioredis/badge.png?branch=master
            :target: https://coveralls.io/r/aio-libs/aioredis?branch=master
         
+        Features
+        --------
+        
+        ================================  ==============================
+        hiredis_ parser                     Yes
+        Pure-python parser                  TBD
+        Low-level & High-level APIs         Yes
+        Connections Pool                    Yes
+        Pipelining support                  Yes
+        Pub/Sub support                     Yes
+        Redis Cluster support               WIP
+        Trollius (python 2.7)               No
+        Tested python versions              `3.3, 3.4, 3.5`_
+        Tested for Redis server             `2.6, 2.8, 3.0`_
+        Support for dev Redis server        through low-level API
+        ================================  ==============================
         
         Documentation
         -------------
@@ -85,7 +101,7 @@ Description: aioredis
                 with (yield from pool) as redis:    # high-level redis API instance
                     yield from redis.set('my-key', 'value')
                     print((yield from redis.get('my-key')))
-                pool.clear()    # closing all open connections
+                yield from pool.clear()    # closing all open connections
         
             loop.run_until_complete(go())
         
@@ -111,13 +127,27 @@ Description: aioredis
         .. _Python: https://www.python.org
         .. _asyncio: https://pypi.python.org/pypi/asyncio
         .. _hiredis: https://pypi.python.org/pypi/hiredis
+        .. _3.3, 3.4, 3.5:
+        .. _2.6, 2.8, 3.0:
+        .. _travis: https://travis-ci.org/aio-libs/aioredis
         
         Changes
         -------
         
-        0.2.4 (xxxx-xx-xx)
+        0.2.4 (2015-10-13)
         ^^^^^^^^^^^^^^^^^^
         
+        * Python 3.5 ``async`` support:
+        
+          - New scan commands API (``iscan``, ``izscan``, ``ihscan``);
+        
+          - Pool made awaitable (allowing ``with await pool: ...`` constructs);
+        
+        * Fixed dropping closed connections from free pool
+          (see `#83 <https://github.com/aio-libs/aioredis/issues/83>`_);
+        
+        * Docs updated;
+        
         
         0.2.3 (2015-08-14)
         ^^^^^^^^^^^^^^^^^^
@@ -125,12 +155,12 @@ Description: aioredis
         * Redis cluster support work in progress;
         
         * Fixed pool issue causing pool growth over max size & ``acquire`` call hangs
-          (see https://github.com/aio-libs/aioredis/issues/71);
+          (see `#71 <https://github.com/aio-libs/aioredis/issues/71>`_);
         
         * ``info`` server command result parsing implemented;
         
         * Fixed behavior of util functions
-          (see https://github.com/aio-libs/aioredis/issues/70);
+          (see `#70 <https://github.com/aio-libs/aioredis/issues/70>`_);
         
         * ``hstrlen`` command added;
         
@@ -144,13 +174,18 @@ Description: aioredis
         
         * Decoding data with ``encoding`` paramter now takes into account
           list (array) replies
-          (see https://github.com/aio-libs/aioredis/pull/68);
+          (see `#68 <https://github.com/aio-libs/aioredis/pull/68>`_);
         
         * ``encoding`` parameter added to following commands:
+        
           - generic commands: keys, randomkey;
+        
           - hash commands: hgetall, hkeys, hmget, hvals;
+        
           - list commands: blpop, brpop, brpoplpush, lindex, lpop, lrange, rpop, rpoplpush;
+        
           - set commands: smembers, spop, srandmember;
+        
           - string commands: getrange, getset, mget;
         
         * Backward incompatibility:
@@ -166,7 +201,7 @@ Description: aioredis
         * Logging added (aioredis.log module);
         
         * Fixed issue with ``wait_message`` in pub/sub
-          (see https://github.com/aio-libs/aioredis/issues/66);
+          (see `#66 <https://github.com/aio-libs/aioredis/issues/66>`_);
         
         
         0.2.0 (2015-06-04)
@@ -175,96 +210,9 @@ Description: aioredis
         * Pub/Sub support added;
         
         * Fix in ``zrevrangebyscore`` command
-          (see https://github.com/aio-libs/aioredis/pull/62);
+          (see `#62 <https://github.com/aio-libs/aioredis/pull/62>`_);
         
         * Fixes/tests/docs;
-        
-        
-        0.1.5 (2014-12-09)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * AutoConnector added;
-        
-        * wait_closed method added for clean connections shutdown;
-        
-        * ``zscore`` command fixed;
-        
-        * Test fixes;
-        
-        
-        0.1.4 (2014-09-22)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * Dropped following Redis methods -- Redis.multi(), Redis.exec(), Redis.discard()
-        
-        * Redis.multi_exec hack'ish property removed
-        
-        * Redis.multi_exec() method added
-        
-        * High-level commands implemented:
-        
-          * generic commands (tests);
-          * transactions commands (api stabilization).
-        
-        * Backward incompatibilities:
-        
-          * Following sorted set commands' API changed:
-        
-            zcount, zrangebyscore, zremrangebyscore, zrevrangebyscore;
-        
-          * set string command' API changed;
-        
-        
-        
-        0.1.3 (2014-08-08)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * RedisConnection.execute refactored to support commands pipelining
-          (see http://github.com/aio-libs/aioredis/issues/33);
-        
-        * Several fixes;
-        
-        * WIP on transactions and commands interface;
-        
-        * High-level commands implemented and tested:
-        
-          * hash commands;
-          * hyperloglog commands;
-          * set commands;
-          * scripting commands;
-          * string commands;
-          * list commands;
-        
-        
-        0.1.2 (2014-07-31)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * create_connection, create_pool, create_redis functions updated:
-          db and password arguments made keyword-only
-          (see http://github.com/aio-libs/aioredis/issues/26);
-        
-        * Fixed transaction handling
-          (see http://github.com/aio-libs/aioredis/issues/32);
-        
-        * Response decoding
-          (see http://github.com/aio-libs/aioredis/issues/16);
-        
-        
-        0.1.1 (2014-07-07)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * Transactions support (in connection, high-level commands have some issues);
-        * Docs & tests updated.
-        
-        
-        0.1.0 (2014-06-24)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * Initial release;
-        * RedisConnection implemented;
-        * RedisPool implemented;
-        * Docs for RedisConnection & RedisPool;
-        * WIP on high-level API.
 Platform: POSIX
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Development Status :: 4 - Beta
@@ -272,6 +220,7 @@ Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Operating System :: POSIX
 Classifier: Environment :: Web Environment
 Classifier: Intended Audience :: Developers
diff --git a/README.rst b/README.rst
index 69cd27e..f448791 100644
--- a/README.rst
+++ b/README.rst
@@ -1,7 +1,7 @@
 aioredis
 ========
 
-asyncio (PEP 3156) Redis support
+asyncio (PEP 3156) Redis client library.
 
 .. image:: https://travis-ci.org/aio-libs/aioredis.svg?branch=master
    :target: https://travis-ci.org/aio-libs/aioredis
@@ -10,6 +10,22 @@ asyncio (PEP 3156) Redis support
 .. image:: https://coveralls.io/repos/aio-libs/aioredis/badge.png?branch=master
    :target: https://coveralls.io/r/aio-libs/aioredis?branch=master
 
+Features
+--------
+
+================================  ==============================
+hiredis_ parser                     Yes
+Pure-python parser                  TBD
+Low-level & High-level APIs         Yes
+Connections Pool                    Yes
+Pipelining support                  Yes
+Pub/Sub support                     Yes
+Redis Cluster support               WIP
+Trollius (python 2.7)               No
+Tested python versions              `3.3, 3.4, 3.5`_
+Tested for Redis server             `2.6, 2.8, 3.0`_
+Support for dev Redis server        through low-level API
+================================  ==============================
 
 Documentation
 -------------
@@ -77,7 +93,7 @@ Connections pool:
         with (yield from pool) as redis:    # high-level redis API instance
             yield from redis.set('my-key', 'value')
             print((yield from redis.get('my-key')))
-        pool.clear()    # closing all open connections
+        yield from pool.clear()    # closing all open connections
 
     loop.run_until_complete(go())
 
@@ -103,3 +119,6 @@ The aioredis is offered under MIT license.
 .. _Python: https://www.python.org
 .. _asyncio: https://pypi.python.org/pypi/asyncio
 .. _hiredis: https://pypi.python.org/pypi/hiredis
+.. _3.3, 3.4, 3.5:
+.. _2.6, 2.8, 3.0:
+.. _travis: https://travis-ci.org/aio-libs/aioredis
diff --git a/aioredis.egg-info/PKG-INFO b/aioredis.egg-info/PKG-INFO
index 6302e36..7b5eb0e 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.3
+Version: 0.2.4
 Summary: asyncio (PEP 3156) Redis support
 Home-page: https://github.com/aio-libs/aioredis
 Author: Alexey Popravka
@@ -9,7 +9,7 @@ License: MIT
 Description: aioredis
         ========
         
-        asyncio (PEP 3156) Redis support
+        asyncio (PEP 3156) Redis client library.
         
         .. image:: https://travis-ci.org/aio-libs/aioredis.svg?branch=master
            :target: https://travis-ci.org/aio-libs/aioredis
@@ -18,6 +18,22 @@ Description: aioredis
         .. image:: https://coveralls.io/repos/aio-libs/aioredis/badge.png?branch=master
            :target: https://coveralls.io/r/aio-libs/aioredis?branch=master
         
+        Features
+        --------
+        
+        ================================  ==============================
+        hiredis_ parser                     Yes
+        Pure-python parser                  TBD
+        Low-level & High-level APIs         Yes
+        Connections Pool                    Yes
+        Pipelining support                  Yes
+        Pub/Sub support                     Yes
+        Redis Cluster support               WIP
+        Trollius (python 2.7)               No
+        Tested python versions              `3.3, 3.4, 3.5`_
+        Tested for Redis server             `2.6, 2.8, 3.0`_
+        Support for dev Redis server        through low-level API
+        ================================  ==============================
         
         Documentation
         -------------
@@ -85,7 +101,7 @@ Description: aioredis
                 with (yield from pool) as redis:    # high-level redis API instance
                     yield from redis.set('my-key', 'value')
                     print((yield from redis.get('my-key')))
-                pool.clear()    # closing all open connections
+                yield from pool.clear()    # closing all open connections
         
             loop.run_until_complete(go())
         
@@ -111,13 +127,27 @@ Description: aioredis
         .. _Python: https://www.python.org
         .. _asyncio: https://pypi.python.org/pypi/asyncio
         .. _hiredis: https://pypi.python.org/pypi/hiredis
+        .. _3.3, 3.4, 3.5:
+        .. _2.6, 2.8, 3.0:
+        .. _travis: https://travis-ci.org/aio-libs/aioredis
         
         Changes
         -------
         
-        0.2.4 (xxxx-xx-xx)
+        0.2.4 (2015-10-13)
         ^^^^^^^^^^^^^^^^^^
         
+        * Python 3.5 ``async`` support:
+        
+          - New scan commands API (``iscan``, ``izscan``, ``ihscan``);
+        
+          - Pool made awaitable (allowing ``with await pool: ...`` constructs);
+        
+        * Fixed dropping closed connections from free pool
+          (see `#83 <https://github.com/aio-libs/aioredis/issues/83>`_);
+        
+        * Docs updated;
+        
         
         0.2.3 (2015-08-14)
         ^^^^^^^^^^^^^^^^^^
@@ -125,12 +155,12 @@ Description: aioredis
         * Redis cluster support work in progress;
         
         * Fixed pool issue causing pool growth over max size & ``acquire`` call hangs
-          (see https://github.com/aio-libs/aioredis/issues/71);
+          (see `#71 <https://github.com/aio-libs/aioredis/issues/71>`_);
         
         * ``info`` server command result parsing implemented;
         
         * Fixed behavior of util functions
-          (see https://github.com/aio-libs/aioredis/issues/70);
+          (see `#70 <https://github.com/aio-libs/aioredis/issues/70>`_);
         
         * ``hstrlen`` command added;
         
@@ -144,13 +174,18 @@ Description: aioredis
         
         * Decoding data with ``encoding`` paramter now takes into account
           list (array) replies
-          (see https://github.com/aio-libs/aioredis/pull/68);
+          (see `#68 <https://github.com/aio-libs/aioredis/pull/68>`_);
         
         * ``encoding`` parameter added to following commands:
+        
           - generic commands: keys, randomkey;
+        
           - hash commands: hgetall, hkeys, hmget, hvals;
+        
           - list commands: blpop, brpop, brpoplpush, lindex, lpop, lrange, rpop, rpoplpush;
+        
           - set commands: smembers, spop, srandmember;
+        
           - string commands: getrange, getset, mget;
         
         * Backward incompatibility:
@@ -166,7 +201,7 @@ Description: aioredis
         * Logging added (aioredis.log module);
         
         * Fixed issue with ``wait_message`` in pub/sub
-          (see https://github.com/aio-libs/aioredis/issues/66);
+          (see `#66 <https://github.com/aio-libs/aioredis/issues/66>`_);
         
         
         0.2.0 (2015-06-04)
@@ -175,96 +210,9 @@ Description: aioredis
         * Pub/Sub support added;
         
         * Fix in ``zrevrangebyscore`` command
-          (see https://github.com/aio-libs/aioredis/pull/62);
+          (see `#62 <https://github.com/aio-libs/aioredis/pull/62>`_);
         
         * Fixes/tests/docs;
-        
-        
-        0.1.5 (2014-12-09)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * AutoConnector added;
-        
-        * wait_closed method added for clean connections shutdown;
-        
-        * ``zscore`` command fixed;
-        
-        * Test fixes;
-        
-        
-        0.1.4 (2014-09-22)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * Dropped following Redis methods -- Redis.multi(), Redis.exec(), Redis.discard()
-        
-        * Redis.multi_exec hack'ish property removed
-        
-        * Redis.multi_exec() method added
-        
-        * High-level commands implemented:
-        
-          * generic commands (tests);
-          * transactions commands (api stabilization).
-        
-        * Backward incompatibilities:
-        
-          * Following sorted set commands' API changed:
-        
-            zcount, zrangebyscore, zremrangebyscore, zrevrangebyscore;
-        
-          * set string command' API changed;
-        
-        
-        
-        0.1.3 (2014-08-08)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * RedisConnection.execute refactored to support commands pipelining
-          (see http://github.com/aio-libs/aioredis/issues/33);
-        
-        * Several fixes;
-        
-        * WIP on transactions and commands interface;
-        
-        * High-level commands implemented and tested:
-        
-          * hash commands;
-          * hyperloglog commands;
-          * set commands;
-          * scripting commands;
-          * string commands;
-          * list commands;
-        
-        
-        0.1.2 (2014-07-31)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * create_connection, create_pool, create_redis functions updated:
-          db and password arguments made keyword-only
-          (see http://github.com/aio-libs/aioredis/issues/26);
-        
-        * Fixed transaction handling
-          (see http://github.com/aio-libs/aioredis/issues/32);
-        
-        * Response decoding
-          (see http://github.com/aio-libs/aioredis/issues/16);
-        
-        
-        0.1.1 (2014-07-07)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * Transactions support (in connection, high-level commands have some issues);
-        * Docs & tests updated.
-        
-        
-        0.1.0 (2014-06-24)
-        ^^^^^^^^^^^^^^^^^^
-        
-        * Initial release;
-        * RedisConnection implemented;
-        * RedisPool implemented;
-        * Docs for RedisConnection & RedisPool;
-        * WIP on high-level API.
 Platform: POSIX
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Development Status :: 4 - Beta
@@ -272,6 +220,7 @@ Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Operating System :: POSIX
 Classifier: Environment :: Web Environment
 Classifier: Intended Audience :: Developers
diff --git a/aioredis/__init__.py b/aioredis/__init__.py
index 1a6003e..c825638 100644
--- a/aioredis/__init__.py
+++ b/aioredis/__init__.py
@@ -11,7 +11,7 @@ from .errors import (
     )
 
 
-__version__ = '0.2.3'
+__version__ = '0.2.4'
 
 # make pyflakes happy
 (create_connection, RedisConnection,
diff --git a/aioredis/commands/generic.py b/aioredis/commands/generic.py
index 1c761ed..466f628 100644
--- a/aioredis/commands/generic.py
+++ b/aioredis/commands/generic.py
@@ -1,4 +1,7 @@
-from aioredis.util import wait_convert, wait_ok, _NOTSET
+from aioredis.util import wait_convert, wait_ok, _NOTSET, PY_35
+
+if PY_35:
+    from aioredis.util import _ScanIter
 
 
 class GenericCommandsMixin:
@@ -203,6 +206,19 @@ class GenericCommandsMixin:
         fut = self._conn.execute(b'SCAN', cursor, *args)
         return wait_convert(fut, lambda o: (int(o[0]), o[1]))
 
+    if PY_35:
+        def iscan(self, *, match=None, count=None):
+            """Incrementally iterate the keys space using async for.
+
+            Usage example:
+
+            >>> async for key in redis.iscan(match='something*'):
+            ...     print('Matched:', key)
+
+            """
+            return _ScanIter(lambda cur: self.scan(cur,
+                                                   match=match, count=count))
+
     def sort(self, key, *get_patterns,
              by=None, offset=None, count=None,
              asc=None, alpha=False, store=None):
diff --git a/aioredis/commands/hash.py b/aioredis/commands/hash.py
index 9f5dd09..b002329 100644
--- a/aioredis/commands/hash.py
+++ b/aioredis/commands/hash.py
@@ -1,4 +1,7 @@
-from aioredis.util import wait_convert, wait_make_dict, _NOTSET
+from aioredis.util import wait_convert, wait_make_dict, _NOTSET, PY_35
+
+if PY_35:
+    from aioredis.util import _ScanIterPairs
 
 
 class HashCommandsMixin:
@@ -74,6 +77,20 @@ class HashCommandsMixin:
         fut = self._conn.execute(b'HSCAN', *args)
         return wait_convert(fut, lambda obj: (int(obj[0]), obj[1]))
 
+    if PY_35:
+        def ihscan(self, key, *, match=None, count=None):
+            """Incrementally iterate sorted set items using async for.
+
+            Usage example:
+
+            >>> async for name, val in redis.ihscan(key, match='something*'):
+            ...     print('Matched:', name, '->', val)
+
+            """
+            return _ScanIterPairs(lambda cur: self.hscan(key, cur,
+                                                         match=match,
+                                                         count=count))
+
     def hstrlen(self, key, field):
         """Get the length of the value of a hash field."""
         return self._conn.execute(b'HSTRLEN', key, field)
diff --git a/aioredis/commands/set.py b/aioredis/commands/set.py
index 0d41c08..22fad0c 100644
--- a/aioredis/commands/set.py
+++ b/aioredis/commands/set.py
@@ -1,4 +1,8 @@
-from aioredis.util import wait_convert, _NOTSET
+from aioredis.util import wait_convert, _NOTSET, PY_35
+
+
+if PY_35:
+    from aioredis.util import _ScanIter
 
 
 class SetCommandsMixin:
@@ -72,3 +76,17 @@ class SetCommandsMixin:
         count is not None and tokens.extend([b'COUNT', count])
         fut = self._conn.execute(b'SSCAN', *tokens)
         return wait_convert(fut, lambda obj: (int(obj[0]), obj[1]))
+
+    if PY_35:
+        def isscan(self, key, *, match=None, count=None):
+            """Incrementally iterate set elements using async for.
+
+            Usage example:
+
+            >>> async for val in redis.isscan(key, match='something*'):
+            ...     print('Matched:', val)
+
+            """
+            return _ScanIter(lambda cur: self.sscan(key, cur,
+                                                    match=match,
+                                                    count=count))
diff --git a/aioredis/commands/sorted_set.py b/aioredis/commands/sorted_set.py
index 58b92cd..2b70692 100644
--- a/aioredis/commands/sorted_set.py
+++ b/aioredis/commands/sorted_set.py
@@ -1,4 +1,7 @@
-from aioredis.util import wait_convert
+from aioredis.util import wait_convert, PY_35
+
+if PY_35:
+    from aioredis.util import _ScanIterPairs
 
 
 class SortedSetCommandsMixin:
@@ -355,6 +358,20 @@ class SortedSetCommandsMixin:
 
         return wait_convert(fut, _converter)
 
+    if PY_35:
+        def izscan(self, key, *, match=None, count=None):
+            """Incrementally iterate sorted set items using async for.
+
+            Usage example:
+
+            >>> async for val, score in redis.izscan(key, match='something*'):
+            ...     print('Matched:', val, ':', score)
+
+            """
+            return _ScanIterPairs(lambda cur: self.zscan(key, cur,
+                                                         match=match,
+                                                         count=count))
+
 
 def _encode_min_max(flag, min, max):
     if flag is SortedSetCommandsMixin.ZSET_EXCLUDE_MIN:
diff --git a/aioredis/pool.py b/aioredis/pool.py
index fbc18ed..0ff360f 100644
--- a/aioredis/pool.py
+++ b/aioredis/pool.py
@@ -1,10 +1,14 @@
 import asyncio
 import collections
+import sys
 
 from .commands import create_redis, Redis
 from .log import logger
 
 
+PY_35 = sys.version_info >= (3, 5)
+
+
 @asyncio.coroutine
 def create_pool(address, *, db=0, password=None, encoding=None,
                 minsize=10, maxsize=10, commands_factory=Redis, loop=None):
@@ -146,8 +150,18 @@ class RedisPool:
         # FIXME: check event loop is not closed
         asyncio.async(self._wakeup(), loop=self._loop)
 
+    def _drop_closed(self):
+        for i in range(self.freesize):
+            conn = self._pool[0]
+            if conn.closed:
+                self._pool.popleft()
+            else:
+                self._pool.rotate(1)
+
     @asyncio.coroutine
     def _fill_free(self, *, override_min):
+        # drop closed connections first
+        self._drop_closed()
         while self.size < self.minsize:
             self._acquiring += 1
             try:
@@ -155,15 +169,20 @@ class RedisPool:
                 self._pool.append(conn)
             finally:
                 self._acquiring -= 1
+                # connection may be closed at yeild point
+                self._drop_closed()
         if self.freesize:
             return
-        if override_min and self.size < self.maxsize:
-            self._acquiring += 1
-            try:
-                conn = yield from self._create_new_connection()
-                self._pool.append(conn)
-            finally:
-                self._acquiring -= 1
+        if override_min:
+            while not self._pool and self.size < self.maxsize:
+                self._acquiring += 1
+                try:
+                    conn = yield from self._create_new_connection()
+                    self._pool.append(conn)
+                finally:
+                    self._acquiring -= 1
+                    # connection may be closed at yeild point
+                    self._drop_closed()
 
     def _create_new_connection(self):
         return create_redis(self._address,
@@ -192,6 +211,20 @@ class RedisPool:
         conn = yield from self.acquire()
         return _ConnectionContextManager(self, conn)
 
+    if PY_35:
+        def __await__(self):
+            # To make `with await pool` work
+            conn = yield from self.acquire()
+            return _ConnectionContextManager(self, conn)
+
+        def get(self):
+            '''Return async context manager for working with connection.
+
+            async with pool.get() as conn:
+                await conn.get(key)
+            '''
+            return _AsyncConnectionContextManager(self)
+
 
 class _ConnectionContextManager:
 
@@ -210,3 +243,26 @@ class _ConnectionContextManager:
         finally:
             self._pool = None
             self._conn = None
+
+
+if PY_35:
+    class _AsyncConnectionContextManager:
+
+        __slots__ = ('_pool', '_conn')
+
+        def __init__(self, pool):
+            self._pool = pool
+            self._conn = None
+
+        @asyncio.coroutine
+        def __aenter__(self):
+            self._conn = yield from self._pool.acquire()
+            return self._conn
+
+        @asyncio.coroutine
+        def __aexit__(self, exc_type, exc_value, tb):
+            try:
+                self._pool.release(self._conn)
+            finally:
+                self._pool = None
+                self._conn = None
diff --git a/aioredis/util.py b/aioredis/util.py
index dfb7b6e..a77a3ea 100644
--- a/aioredis/util.py
+++ b/aioredis/util.py
@@ -1,8 +1,11 @@
 import asyncio
 import json
+import sys
 
 from .errors import ChannelClosedError
 
+PY_35 = sys.version_info >= (3, 5)
+
 _NOTSET = object()
 
 # NOTE: never put here anything else;
@@ -193,3 +196,42 @@ class coerced_keys_dict(dict):
         if not isinstance(other, bytes):
             other = _converters[type(other)](other)
         return dict.__contains__(self, other)
+
+
+if PY_35:
+    class _BaseScanIter:
+        __slots__ = ('_scan', '_cur', '_ret')
+
+        def __init__(self, scan):
+            self._scan = scan
+            self._cur = b'0'
+            self._ret = []
+
+        @asyncio.coroutine
+        def __aiter__(self):
+            return self
+
+    class _ScanIter(_BaseScanIter):
+
+        @asyncio.coroutine
... 44 lines suppressed ...

-- 
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