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

Piotr Ożarowski piotr at moszumanska.debian.org
Sat Jan 14 10:32:04 UTC 2017


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

piotr pushed a commit to branch master
in repository aioredis.

commit cf2e667143a252f95cd22e403e7f0c0f9982d43b
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Sat Jan 14 11:27:42 2017 +0100

    Import aioredis_0.3.0.orig.tar.gz
---
 CHANGES.txt                                |  39 ++
 CONTRIBUTORS.txt                           |  23 +
 MANIFEST.in                                |   3 +-
 PKG-INFO                                   |  85 ++-
 README.rst                                 |  44 +-
 aioredis.egg-info/PKG-INFO                 |  85 ++-
 aioredis.egg-info/SOURCES.txt              |  23 +-
 aioredis/__init__.py                       |  11 +-
 aioredis/abc.py                            | 162 +++++
 aioredis/commands/__init__.py              |  10 +-
 aioredis/commands/generic.py               |   2 +-
 aioredis/commands/geo.py                   | 188 ++++++
 aioredis/commands/hash.py                  |  10 +-
 aioredis/commands/pubsub.py                |  14 +-
 aioredis/commands/transaction.py           |  40 +-
 aioredis/connection.py                     |  43 +-
 aioredis/pubsub.py                         | 392 ++++++++++++
 aioredis/util.py                           | 161 +----
 docs/_build/man/aioredis.1                 | 979 +++++++++++++++++++++++++----
 docs/abc.rst                               |  20 +
 docs/api_reference.rst                     |  77 ++-
 docs/examples.rst                          |  69 +-
 docs/index.rst                             |   4 +-
 docs/mixins.rst                            |  11 +
 docs/mpsc.rst                              |  21 +
 docs/start.rst                             |  78 ++-
 examples/commands.py                       |  12 +-
 examples/connection.py                     |  11 +-
 examples/{python_3.5_iscan.py => iscan.py} |   0
 examples/pipeline.py                       |  34 +-
 examples/pool.py                           |  13 +-
 examples/{python_3.5_pool.py => pool2.py}  |   4 +-
 examples/pool_pubsub.py                    |  45 +-
 examples/pubsub.py                         |  24 +-
 examples/pubsub2.py                        |  37 +-
 examples/{ => py34}/commands.py            |   0
 examples/{ => py34}/connection.py          |   0
 examples/{ => py34}/pipeline.py            |   0
 examples/{ => py34}/pool.py                |   0
 examples/{ => py34}/pool_pubsub.py         |   0
 examples/{ => py34}/pubsub.py              |   0
 examples/{ => py34}/pubsub2.py             |   0
 examples/{ => py34}/scan.py                |   0
 examples/{ => py34}/transaction.py         |   1 +
 examples/{ => py34}/transaction2.py        |   0
 examples/scan.py                           |  11 +-
 examples/transaction.py                    |  15 +-
 examples/transaction2.py                   |  14 +-
 setup.cfg                                  |   2 +-
 tests/_testutil.old.py                     | 251 --------
 tests/conftest.py                          |  52 +-
 tests/connection_commands_test.py          |   3 +
 tests/connection_test.py                   |  54 +-
 tests/generic_commands_test.py             |   4 +-
 tests/geo_commands_test.py                 | 508 +++++++++++++++
 tests/multi_exec_test.py                   |   4 +-
 tests/pool_test.py                         |  11 +-
 tests/pubsub_commands_test.py              |  15 +-
 tests/pubsub_receiver_test.py              | 275 ++++++++
 tests/server_commands_test.py              |   4 +
 tests/string_commands_test.py              |  10 +-
 61 files changed, 3113 insertions(+), 895 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index da3585b..731cd22 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,45 @@
 Changes
 -------
 
+0.3.0 (2017-01-11)
+^^^^^^^^^^^^^^^^^^
+
+**NEW**:
+
+* Pub/Sub connection commands accept ``Channel`` instances
+  (see `#168 <https://github.com/aio-libs/aioredis/pull/168>`_);
+
+* Implement new Pub/Sub MPSC (multi-producers, single-consumer) Queue --
+  ``aioredis.pubsub.Receiver``
+  (see `#176 <https://github.com/aio-libs/aioredis/pull/176>`_);
+
+* Add ``aioredis.abc`` module providing abstract base classes
+  defining interface for basic lib components;
+  (see `#176 <https://github.com/aio-libs/aioredis/pull/176>`_);
+
+* Implement Geo commands support
+  (see `#177 <https://github.com/aio-libs/aioredis/pull/177>`_
+  and `#179 <https://github.com/aio-libs/aioredis/pull/179>`_);
+
+**FIX**:
+
+* Minor tests fixes;
+
+**MISC**:
+
+* Update examples and docs to use ``async``/``await`` syntax
+  also keeping ``yield from`` examples for history
+  (see `#173 <https://github.com/aio-libs/aioredis/pull/173>`_);
+
+* Reflow Travis CI configuration; add Python 3.6 section
+  (see `#170 <https://github.com/aio-libs/aioredis/pull/170>`_);
+
+* Add AppVeyor integration to run tests on Windows
+  (see `#180 <https://github.com/aio-libs/aioredis/pull/180>`_);
+
+* Update multiple development requirements;
+
+
 0.2.9 (2016-10-24)
 ^^^^^^^^^^^^^^^^^^
 
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
new file mode 100644
index 0000000..9f1adc9
--- /dev/null
+++ b/CONTRIBUTORS.txt
@@ -0,0 +1,23 @@
+Acknowledgements
+----------------
+
+Andrew Svetlov
+Paul Colomiets
+
+
+Contributors
+------------
+
+Nickolai Novik
+Alexander Shorin
+Aider Ibragimov
+SeungHyun Hwang
+Taku Fukada
+Volodymyr Hotsyk
+Jeff Moser
+Dima Kruk
+Leonid Shvechikov
+Samuel Colvin
+Ihor Gorobets
+Thanos Lefteris
+Ilya Goncharov
diff --git a/MANIFEST.in b/MANIFEST.in
index 9ac614a..ffd580c 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,8 +1,9 @@
 include LICENSE
 include CHANGES.txt
+include CONTRIBUTORS.txt
 include README.rst
 graft aioredis
-global-exclude *.pyc *.swp
+global-exclude *.pyc *.swp *.*~
 recursive-include examples *.py
 recursive-include tests *.py
 recursive-include docs *.rst
diff --git a/PKG-INFO b/PKG-INFO
index 8a7b751..06f0d89 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: aioredis
-Version: 0.2.9
+Version: 0.3.0
 Summary: asyncio (PEP 3156) Redis support
 Home-page: https://github.com/aio-libs/aioredis
 Author: Alexey Popravka
@@ -18,6 +18,9 @@ Description: aioredis
         .. image:: https://codecov.io/gh/aio-libs/aioredis/branch/master/graph/badge.svg
            :target: https://codecov.io/gh/aio-libs/aioredis
         
+        .. image:: https://ci.appveyor.com/api/projects/status/wngyx6s98o6hsxmt/branch/master?svg=true
+           :target: https://ci.appveyor.com/project/popravich/aioredis
+        
         Features
         --------
         
@@ -31,8 +34,8 @@ Description: aioredis
         SSL/TLS 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`_
+        Tested python versions              `3.3, 3.4, 3.5 <travis_>`_
+        Tested for Redis server             `2.6, 2.8, 3.0, 3.2 <travis_>`_
         Support for dev Redis server        through low-level API
         ================================  ==============================
         
@@ -53,14 +56,14 @@ Description: aioredis
         
             loop = asyncio.get_event_loop()
         
-            @asyncio.coroutine
-            def go():
-                conn = yield from aioredis.create_connection(
+            async def go():
+                conn = await aioredis.create_connection(
                     ('localhost', 6379), loop=loop)
-                yield from conn.execute('set', 'my-key', 'value')
-                val = yield from conn.execute('get', 'my-key')
+                await conn.execute('set', 'my-key', 'value')
+                val = await conn.execute('get', 'my-key')
                 print(val)
                 conn.close()
+                await conn.wait_closed()
             loop.run_until_complete(go())
             # will print 'value'
         
@@ -73,14 +76,14 @@ Description: aioredis
         
             loop = asyncio.get_event_loop()
         
-            @asyncio.coroutine
-            def go():
-                redis = yield from aioredis.create_redis(
+            async def go():
+                redis = await aioredis.create_redis(
                     ('localhost', 6379), loop=loop)
-                yield from redis.set('my-key', 'value')
-                val = yield from redis.get('my-key')
+                await redis.set('my-key', 'value')
+                val = await redis.get('my-key')
                 print(val)
                 redis.close()
+                await redis.wait_closed()
             loop.run_until_complete(go())
             # will print 'value'
         
@@ -93,16 +96,17 @@ Description: aioredis
         
             loop = asyncio.get_event_loop()
         
-            @asyncio.coroutine
-            def go():
-                pool = yield from aioredis.create_pool(
+            async def go():
+                pool = await aioredis.create_pool(
                     ('localhost', 6379),
                     minsize=5, maxsize=10,
                     loop=loop)
-                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')))
-                yield from pool.clear()    # closing all open connections
+                with await pool as redis:    # high-level redis API instance
+                    await redis.set('my-key', 'value')
+                    print(await redis.get('my-key'))
+                # graceful shutdown
+                pool.close()
+                await pool.wait_closed()
         
             loop.run_until_complete(go())
         
@@ -132,13 +136,50 @@ 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.3.0 (2017-01-11)
+        ^^^^^^^^^^^^^^^^^^
+        
+        **NEW**:
+        
+        * Pub/Sub connection commands accept ``Channel`` instances
+          (see `#168 <https://github.com/aio-libs/aioredis/pull/168>`_);
+        
+        * Implement new Pub/Sub MPSC (multi-producers, single-consumer) Queue --
+          ``aioredis.pubsub.Receiver``
+          (see `#176 <https://github.com/aio-libs/aioredis/pull/176>`_);
+        
+        * Add ``aioredis.abc`` module providing abstract base classes
+          defining interface for basic lib components;
+          (see `#176 <https://github.com/aio-libs/aioredis/pull/176>`_);
+        
+        * Implement Geo commands support
+          (see `#177 <https://github.com/aio-libs/aioredis/pull/177>`_
+          and `#179 <https://github.com/aio-libs/aioredis/pull/179>`_);
+        
+        **FIX**:
+        
+        * Minor tests fixes;
+        
+        **MISC**:
+        
+        * Update examples and docs to use ``async``/``await`` syntax
+          also keeping ``yield from`` examples for history
+          (see `#173 <https://github.com/aio-libs/aioredis/pull/173>`_);
+        
+        * Reflow Travis CI configuration; add Python 3.6 section
+          (see `#170 <https://github.com/aio-libs/aioredis/pull/170>`_);
+        
+        * Add AppVeyor integration to run tests on Windows
+          (see `#180 <https://github.com/aio-libs/aioredis/pull/180>`_);
+        
+        * Update multiple development requirements;
+        
+        
         0.2.9 (2016-10-24)
         ^^^^^^^^^^^^^^^^^^
         
diff --git a/README.rst b/README.rst
index 1e58d9d..98039ad 100644
--- a/README.rst
+++ b/README.rst
@@ -10,6 +10,9 @@ asyncio (PEP 3156) Redis client library.
 .. image:: https://codecov.io/gh/aio-libs/aioredis/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/aio-libs/aioredis
 
+.. image:: https://ci.appveyor.com/api/projects/status/wngyx6s98o6hsxmt/branch/master?svg=true
+   :target: https://ci.appveyor.com/project/popravich/aioredis
+
 Features
 --------
 
@@ -23,8 +26,8 @@ Pub/Sub support                     Yes
 SSL/TLS 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`_
+Tested python versions              `3.3, 3.4, 3.5 <travis_>`_
+Tested for Redis server             `2.6, 2.8, 3.0, 3.2 <travis_>`_
 Support for dev Redis server        through low-level API
 ================================  ==============================
 
@@ -45,14 +48,14 @@ Simple low-level interface:
 
     loop = asyncio.get_event_loop()
 
-    @asyncio.coroutine
-    def go():
-        conn = yield from aioredis.create_connection(
+    async def go():
+        conn = await aioredis.create_connection(
             ('localhost', 6379), loop=loop)
-        yield from conn.execute('set', 'my-key', 'value')
-        val = yield from conn.execute('get', 'my-key')
+        await conn.execute('set', 'my-key', 'value')
+        val = await conn.execute('get', 'my-key')
         print(val)
         conn.close()
+        await conn.wait_closed()
     loop.run_until_complete(go())
     # will print 'value'
 
@@ -65,14 +68,14 @@ Simple high-level interface:
 
     loop = asyncio.get_event_loop()
 
-    @asyncio.coroutine
-    def go():
-        redis = yield from aioredis.create_redis(
+    async def go():
+        redis = await aioredis.create_redis(
             ('localhost', 6379), loop=loop)
-        yield from redis.set('my-key', 'value')
-        val = yield from redis.get('my-key')
+        await redis.set('my-key', 'value')
+        val = await redis.get('my-key')
         print(val)
         redis.close()
+        await redis.wait_closed()
     loop.run_until_complete(go())
     # will print 'value'
 
@@ -85,16 +88,17 @@ Connections pool:
 
     loop = asyncio.get_event_loop()
 
-    @asyncio.coroutine
-    def go():
-        pool = yield from aioredis.create_pool(
+    async def go():
+        pool = await aioredis.create_pool(
             ('localhost', 6379),
             minsize=5, maxsize=10,
             loop=loop)
-        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')))
-        yield from pool.clear()    # closing all open connections
+        with await pool as redis:    # high-level redis API instance
+            await redis.set('my-key', 'value')
+            print(await redis.get('my-key'))
+        # graceful shutdown
+        pool.close()
+        await pool.wait_closed()
 
     loop.run_until_complete(go())
 
@@ -124,6 +128,4 @@ 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 8a7b751..06f0d89 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.9
+Version: 0.3.0
 Summary: asyncio (PEP 3156) Redis support
 Home-page: https://github.com/aio-libs/aioredis
 Author: Alexey Popravka
@@ -18,6 +18,9 @@ Description: aioredis
         .. image:: https://codecov.io/gh/aio-libs/aioredis/branch/master/graph/badge.svg
            :target: https://codecov.io/gh/aio-libs/aioredis
         
+        .. image:: https://ci.appveyor.com/api/projects/status/wngyx6s98o6hsxmt/branch/master?svg=true
+           :target: https://ci.appveyor.com/project/popravich/aioredis
+        
         Features
         --------
         
@@ -31,8 +34,8 @@ Description: aioredis
         SSL/TLS 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`_
+        Tested python versions              `3.3, 3.4, 3.5 <travis_>`_
+        Tested for Redis server             `2.6, 2.8, 3.0, 3.2 <travis_>`_
         Support for dev Redis server        through low-level API
         ================================  ==============================
         
@@ -53,14 +56,14 @@ Description: aioredis
         
             loop = asyncio.get_event_loop()
         
-            @asyncio.coroutine
-            def go():
-                conn = yield from aioredis.create_connection(
+            async def go():
+                conn = await aioredis.create_connection(
                     ('localhost', 6379), loop=loop)
-                yield from conn.execute('set', 'my-key', 'value')
-                val = yield from conn.execute('get', 'my-key')
+                await conn.execute('set', 'my-key', 'value')
+                val = await conn.execute('get', 'my-key')
                 print(val)
                 conn.close()
+                await conn.wait_closed()
             loop.run_until_complete(go())
             # will print 'value'
         
@@ -73,14 +76,14 @@ Description: aioredis
         
             loop = asyncio.get_event_loop()
         
-            @asyncio.coroutine
-            def go():
-                redis = yield from aioredis.create_redis(
+            async def go():
+                redis = await aioredis.create_redis(
                     ('localhost', 6379), loop=loop)
-                yield from redis.set('my-key', 'value')
-                val = yield from redis.get('my-key')
+                await redis.set('my-key', 'value')
+                val = await redis.get('my-key')
                 print(val)
                 redis.close()
+                await redis.wait_closed()
             loop.run_until_complete(go())
             # will print 'value'
         
@@ -93,16 +96,17 @@ Description: aioredis
         
             loop = asyncio.get_event_loop()
         
-            @asyncio.coroutine
-            def go():
-                pool = yield from aioredis.create_pool(
+            async def go():
+                pool = await aioredis.create_pool(
                     ('localhost', 6379),
                     minsize=5, maxsize=10,
                     loop=loop)
-                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')))
-                yield from pool.clear()    # closing all open connections
+                with await pool as redis:    # high-level redis API instance
+                    await redis.set('my-key', 'value')
+                    print(await redis.get('my-key'))
+                # graceful shutdown
+                pool.close()
+                await pool.wait_closed()
         
             loop.run_until_complete(go())
         
@@ -132,13 +136,50 @@ 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.3.0 (2017-01-11)
+        ^^^^^^^^^^^^^^^^^^
+        
+        **NEW**:
+        
+        * Pub/Sub connection commands accept ``Channel`` instances
+          (see `#168 <https://github.com/aio-libs/aioredis/pull/168>`_);
+        
+        * Implement new Pub/Sub MPSC (multi-producers, single-consumer) Queue --
+          ``aioredis.pubsub.Receiver``
+          (see `#176 <https://github.com/aio-libs/aioredis/pull/176>`_);
+        
+        * Add ``aioredis.abc`` module providing abstract base classes
+          defining interface for basic lib components;
+          (see `#176 <https://github.com/aio-libs/aioredis/pull/176>`_);
+        
+        * Implement Geo commands support
+          (see `#177 <https://github.com/aio-libs/aioredis/pull/177>`_
+          and `#179 <https://github.com/aio-libs/aioredis/pull/179>`_);
+        
+        **FIX**:
+        
+        * Minor tests fixes;
+        
+        **MISC**:
+        
+        * Update examples and docs to use ``async``/``await`` syntax
+          also keeping ``yield from`` examples for history
+          (see `#173 <https://github.com/aio-libs/aioredis/pull/173>`_);
+        
+        * Reflow Travis CI configuration; add Python 3.6 section
+          (see `#170 <https://github.com/aio-libs/aioredis/pull/170>`_);
+        
+        * Add AppVeyor integration to run tests on Windows
+          (see `#180 <https://github.com/aio-libs/aioredis/pull/180>`_);
+        
+        * Update multiple development requirements;
+        
+        
         0.2.9 (2016-10-24)
         ^^^^^^^^^^^^^^^^^^
         
diff --git a/aioredis.egg-info/SOURCES.txt b/aioredis.egg-info/SOURCES.txt
index 3638233..a48f199 100644
--- a/aioredis.egg-info/SOURCES.txt
+++ b/aioredis.egg-info/SOURCES.txt
@@ -1,14 +1,17 @@
 CHANGES.txt
+CONTRIBUTORS.txt
 LICENSE
 MANIFEST.in
 README.rst
 setup.cfg
 setup.py
 aioredis/__init__.py
+aioredis/abc.py
 aioredis/connection.py
 aioredis/errors.py
 aioredis/log.py
 aioredis/pool.py
+aioredis/pubsub.py
 aioredis/util.py
 aioredis.egg-info/PKG-INFO
 aioredis.egg-info/SOURCES.txt
@@ -18,6 +21,7 @@ aioredis.egg-info/top_level.txt
 aioredis/commands/__init__.py
 aioredis/commands/cluster.py
 aioredis/commands/generic.py
+aioredis/commands/geo.py
 aioredis/commands/hash.py
 aioredis/commands/hyperloglog.py
 aioredis/commands/list.py
@@ -28,40 +32,53 @@ aioredis/commands/set.py
 aioredis/commands/sorted_set.py
 aioredis/commands/string.py
 aioredis/commands/transaction.py
+docs/abc.rst
 docs/api_reference.rst
 docs/devel.rst
 docs/examples.rst
 docs/glossary.rst
 docs/index.rst
 docs/mixins.rst
+docs/mpsc.rst
 docs/releases.rst
 docs/start.rst
 docs/_build/man/aioredis.1
 examples/commands.py
 examples/connection.py
+examples/iscan.py
 examples/pipeline.py
 examples/pool.py
+examples/pool2.py
 examples/pool_pubsub.py
 examples/pubsub.py
 examples/pubsub2.py
-examples/python_3.5_iscan.py
-examples/python_3.5_pool.py
 examples/scan.py
 examples/transaction.py
 examples/transaction2.py
-tests/_testutil.old.py
+examples/py34/commands.py
+examples/py34/connection.py
+examples/py34/pipeline.py
+examples/py34/pool.py
+examples/py34/pool_pubsub.py
+examples/py34/pubsub.py
+examples/py34/pubsub2.py
+examples/py34/scan.py
+examples/py34/transaction.py
+examples/py34/transaction2.py
 tests/coerced_keys_dict_test.py
 tests/conftest.py
 tests/connection_commands_test.py
 tests/connection_test.py
 tests/encode_command_test.py
 tests/generic_commands_test.py
+tests/geo_commands_test.py
 tests/hash_commands_test.py
 tests/hyperloglog_commands_test.py
 tests/list_commands_test.py
 tests/multi_exec_test.py
 tests/pool_test.py
 tests/pubsub_commands_test.py
+tests/pubsub_receiver_test.py
 tests/py35_generic_commands_test.py
 tests/py35_hash_commands_test.py
 tests/py35_pool_test.py
diff --git a/aioredis/__init__.py b/aioredis/__init__.py
index 1581059..6f993a0 100644
--- a/aioredis/__init__.py
+++ b/aioredis/__init__.py
@@ -1,7 +1,11 @@
 from .connection import RedisConnection, create_connection
-from .commands import Redis, create_redis, create_reconnecting_redis
+from .commands import (
+    Redis, create_redis,
+    create_reconnecting_redis,
+    GeoPoint, GeoMember,
+    )
 from .pool import RedisPool, create_pool
-from .util import Channel
+from .pubsub import Channel
 from .errors import (
     ConnectionClosedError,
     MultiExecError,
@@ -15,7 +19,7 @@ from .errors import (
     )
 
 
-__version__ = '0.2.9'
+__version__ = '0.3.0'
 
 # make pyflakes happy
 (create_connection, RedisConnection,
@@ -25,4 +29,5 @@ __version__ = '0.2.9'
  PipelineError, MultiExecError, ConnectionClosedError,
  ChannelClosedError, WatchVariableError,
  PoolClosedError,
+ GeoPoint, GeoMember,
  )
diff --git a/aioredis/abc.py b/aioredis/abc.py
new file mode 100644
index 0000000..b7abcc5
--- /dev/null
+++ b/aioredis/abc.py
@@ -0,0 +1,162 @@
+"""The module provides connection and connections pool interfaces.
+
+These are intended to be used for implementing custom connection managers.
+"""
+import abc
+import asyncio
+try:
+    from abc import ABC
+except ImportError:
+    class ABC(metaclass=abc.ABCMeta):
+        pass
+
+
+__all__ = [
+    'AbcConnection',
+    'AbcPool',
+    'AbcChannel',
+]
+
+
+class AbcConnection(ABC):
+    """Abstract connection interface."""
+
+    @abc.abstractmethod
+    def execute(self, command, *args, **kwargs):
+        """Execute redis command."""
+
+    @abc.abstractmethod
+    def execute_pubsub(self, command, *args, **kwargs):
+        """Execute Redis (p)subscribe/(p)unsubscribe commands."""
+
+    @abc.abstractmethod
+    def close(self):
+        """Perform connection(s) close and resources cleanup."""
+
+    @asyncio.coroutine
+    @abc.abstractmethod
+    def wait_closed(self):
+        """
+        Coroutine waiting until all resources are closed/released/cleaned up.
+        """
+
+    @property
+    @abc.abstractmethod
+    def closed(self):
+        """Flag indicating if connection is closing or already closed."""
+
+    @property
+    @abc.abstractmethod
+    def db(self):
+        """Current selected DB index."""
+
+    @property
+    @abc.abstractmethod
+    def encoding(self):
+        """Current set connection codec."""
+
+    @property
+    @abc.abstractmethod
+    def in_pubsub(self):
+        """Returns number of subscribed channels.
+
+        Can be tested as bool indicating Pub/Sub mode state.
+        """
+
+    @property
+    @abc.abstractmethod
+    def pubsub_channels(self):
+        """Read-only channels dict."""
+
+    @property
+    @abc.abstractmethod
+    def pubsub_patterns(self):
+        """Read-only patterns dict."""
+
+    @property
+    @abc.abstractmethod
+    def address(self):
+        """Connection address."""
+
+
+class AbcPool(AbcConnection):
+    """Abstract connections pool interface.
+
+    Inherited from AbcConnection so both have common interface
+    for executing Redis commands.
+    """
+
+    @abc.abstractmethod
+    def get_connection(self):   # TODO: arguments
+        """
+        Gets free connection from pool in a sync way.
+
+        If no connection available — returns None.
+        """
+
+    @asyncio.coroutine
+    @abc.abstractmethod
+    def acquire(self):  # TODO: arguments
+        """Acquires connection from pool."""
+
+    @abc.abstractmethod
+    def release(self, conn):  # TODO: arguments
+        """Releases connection to pool.
+
+        :param AbcConnection conn: Owned connection to be released.
+        """
+
+    @property
+    @abc.abstractmethod
+    def address(self):
+        """Connection address or None."""
+
+
+class AbcChannel(ABC):
+    """Abstract Pub/Sub Channel interface."""
+
+    @property
+    @abc.abstractmethod
+    def name(self):
+        """Encoded channel name or pattern."""
+
+    @property
+    @abc.abstractmethod
+    def is_pattern(self):
+        """Boolean flag indicating if channel is pattern channel."""
+
+    @property
+    @abc.abstractmethod
+    def is_active(self):
+        """Flag indicating that channel has unreceived messages
+        and not marked as closed."""
+
+    @asyncio.coroutine
+    @abc.abstractmethod
+    def get(self):
+        """Wait and return new message.
+
+        Will raise ``ChannelClosedError`` if channel is not active.
+        """
+
+    # wait_message is not required; details of implementation
+    # @abc.abstractmethod
+    # def wait_message(self):
+    #     pass
+
+    @abc.abstractmethod
+    def put_nowait(self, data):
+        """Send data to channel.
+
+        Called by RedisConnection when new message received.
+        For pattern subscriptions data will be a tuple of
+        channel name and message itself.
+        """
+
+    @abc.abstractmethod
+    def close(self):
+        """Marks Channel as closed, no more messages will be sent to it.
+
+        Called by RedisConnection when channel is unsubscribed
+        or connection is closed.
+        """
diff --git a/aioredis/commands/__init__.py b/aioredis/commands/__init__.py
index abff333..b8cda1a 100644
--- a/aioredis/commands/__init__.py
+++ b/aioredis/commands/__init__.py
@@ -14,8 +14,13 @@ from .scripting import ScriptingCommandsMixin
 from .server import ServerCommandsMixin
 from .pubsub import PubSubCommandsMixin
 from .cluster import ClusterCommandsMixin
+from .geo import GeoCommandsMixin, GeoPoint, GeoMember
 
-__all__ = ['create_redis', 'Redis', 'Pipeline', 'MultiExec']
+__all__ = [
+    'create_redis', 'Redis',
+    'Pipeline', 'MultiExec',
+    'GeoPoint', 'GeoMember',
+]
 
 
 class AutoConnector(object):
@@ -52,7 +57,8 @@ class Redis(GenericCommandsMixin, StringCommandsMixin,
             HashCommandsMixin, TransactionsCommandsMixin,
             SortedSetCommandsMixin, ListCommandsMixin,
             ScriptingCommandsMixin, ServerCommandsMixin,
-            PubSubCommandsMixin, ClusterCommandsMixin):
+            PubSubCommandsMixin, ClusterCommandsMixin,
+            GeoCommandsMixin):
     """High-level Redis interface.
 
     Gathers in one place Redis commands implemented in mixins.
diff --git a/aioredis/commands/generic.py b/aioredis/commands/generic.py
index 9c2b24b..2fd9099 100644
--- a/aioredis/commands/generic.py
+++ b/aioredis/commands/generic.py
@@ -196,7 +196,7 @@ class GenericCommandsMixin:
         >>> match = 'something*'
         >>> cur = b'0'
         >>> while cur:
-        ...     cur, keys = yield from redis.scan(cur, match=match)
+        ...     cur, keys = await redis.scan(cur, match=match)
         ...     for key in keys:
         ...         print('Matched:', key)
 
diff --git a/aioredis/commands/geo.py b/aioredis/commands/geo.py
new file mode 100644
index 0000000..c9d463b
--- /dev/null
+++ b/aioredis/commands/geo.py
@@ -0,0 +1,188 @@
+from collections import namedtuple
+
+from aioredis.util import wait_convert, _NOTSET
+
+
+GeoPoint = namedtuple('GeoPoint', ('longitude', 'latitude'))
+GeoMember = namedtuple('GeoMember', ('member', 'dist', 'hash', 'coord'))
+
+
+class GeoCommandsMixin:
+    """Geo commands mixin.
+
+    For commands details see: http://redis.io/commands#geo
+    """
+
+    def geoadd(self, key, longitude, latitude, member, *args, **kwargs):
+        """Add one or more geospatial items in the geospatial index represented
+        using a sorted set.
+        """
+        return self._conn.execute(
+            b'GEOADD', key, longitude, latitude, member, *args, **kwargs
+        )
+
+    def geohash(self, key, member, *args, **kwargs):
+        """Returns members of a geospatial index as standard geohash strings.
+        """
+        return self._conn.execute(
+            b'GEOHASH', key, member, *args, **kwargs
+        )
+
+    def geopos(self, key, member, *args, **kwargs):
+        """Returns longitude and latitude of members of a geospatial index.
+
+        :rtype: list[GeoPoint or None]
+        """
+        fut = self._conn.execute(b'GEOPOS', key, member, *args, **kwargs)
+        return wait_convert(fut, make_geopos)
+
+    def geodist(self, key, member1, member2, unit='m'):
+        """Returns the distance between two members of a geospatial index.
+
+        :rtype: list[float or None]
+        """
+        fut = self._conn.execute(b'GEODIST', key, member1, member2, unit)
+        return wait_convert(fut, make_geodist)
+
+    def georadius(self, key, longitude, latitude, radius, unit='m', *,
+                  with_dist=False, with_hash=False, with_coord=False,
+                  count=None, sort=None, encoding=_NOTSET):
+        """Query a sorted set representing a geospatial index to fetch members
+        matching a given maximum distance from a point.
+
+        Return value follows Redis convention:
+
+        * if none of ``WITH*`` flags are set -- list of strings returned:
+
+            >>> await redis.georadius('Sicily', 15, 37, 200, 'km')
+            [b"Palermo", b"Catania"]
+
+        * if any flag (or all) is set -- list of named tuples returned:
+
+            >>> await redis.georadius('Sicily', 15, 37, 200, 'km',
+            ...                       with_dist=True)
+            [GeoMember(name=b"Palermo", dist=190.4424, hash=None, coord=None),
+             GeoMember(name=b"Catania", dist=56.4413, hash=None, coord=None)]
+
+        :raises TypeError: radius is not float or int
+        :raises TypeError: count is not int
+        :raises ValueError: if unit not equal ``m``, ``km``, ``mi`` or ``ft``
+        :raises ValueError: if sort not equal ``ASC`` or ``DESC``
+
+        :rtype: list[str] or list[GeoMember]
+        """
+        args = validate_georadius_options(
+            radius, unit, with_dist, with_hash, with_coord, count, sort
+        )
+
+        fut = self._conn.execute(
+            b'GEORADIUS', key, longitude, latitude, radius,
+            unit, *args, encoding=encoding
+        )
+        if with_dist or with_hash or with_coord:
+            return wait_convert(fut, make_geomember,
+                                with_dist=with_dist,
+                                with_hash=with_hash,
+                                with_coord=with_coord)
+        return fut
+
+    def georadiusbymember(self, key, member, radius, unit='m', *,
+                          with_dist=False, with_hash=False, with_coord=False,
+                          count=None, sort=None, encoding=_NOTSET):
+        """Query a sorted set representing a geospatial index to fetch members
+        matching a given maximum distance from a member.
+
+        Return value follows Redis convention:
+
+        * if none of ``WITH*`` flags are set -- list of strings returned:
+
+            >>> await redis.georadiusbymember('Sicily', 'Palermo', 200, 'km')
+            [b"Palermo", b"Catania"]
+
+        * if any flag (or all) is set -- list of named tuples returned:
... 5041 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