[Python-modules-commits] [trollius-redis] 01/04: Importing trollius-redis-0.1.4.tar.gz
Sergio Durigan Junior
sergiodj-guest at moszumanska.debian.org
Fri Aug 5 21:28:31 UTC 2016
This is an automated email from the git hooks/post-receive script.
sergiodj-guest pushed a commit to branch master
in repository trollius-redis.
commit 37b8caa63f787ca818dc0a570cf081fc4d04d7d1
Author: Sergio Durigan Junior <sergiodj at sergiodj.net>
Date: Fri Aug 5 17:19:43 2016 -0400
Importing trollius-redis-0.1.4.tar.gz
---
PKG-INFO | 286 +++
README.rst | 267 +++
setup.cfg | 11 +
setup.py | 56 +
trollius_redis.egg-info/PKG-INFO | 286 +++
trollius_redis.egg-info/SOURCES.txt | 17 +
trollius_redis.egg-info/dependency_links.txt | 1 +
trollius_redis.egg-info/requires.txt | 4 +
trollius_redis.egg-info/top_level.txt | 1 +
trollius_redis/__init__.py | 7 +
trollius_redis/connection.py | 201 ++
trollius_redis/cursors.py | 122 ++
trollius_redis/encoders.py | 78 +
trollius_redis/exceptions.py | 60 +
trollius_redis/log.py | 4 +
trollius_redis/pool.py | 151 ++
trollius_redis/protocol.py | 2922 ++++++++++++++++++++++++++
trollius_redis/replies.py | 277 +++
18 files changed, 4751 insertions(+)
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..f39122c
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,286 @@
+Metadata-Version: 1.1
+Name: trollius_redis
+Version: 0.1.4
+Summary: PEP 3156 implementation of the redis protocol.
+Home-page: https://github.com/benjolitz/trollius-redis
+Author: Ben Jolitz
+Author-email: ben.jolitz+trollius_redis at gmail.com
+License: LICENSE.txt
+Description: Redis client for Python trollius
+ ===========================================================================
+ (ported from `asyncio-redis`_)
+
+ |Build Status| |Wheel Status| |Doc Status|
+
+
+
+ Supports
+ ---------
+ - CPython 2.7, 3.3-3.5
+ - PyPy
+ - PyPy3
+
+
+ Description
+ ------------
+
+
+ Redis client for the `PEP 3156`_ Python event loop ported to Trollius.
+
+ .. _PEP 3156: http://legacy.python.org/dev/peps/pep-3156/
+
+ This Redis library is a completely asynchronous, non-blocking client for a
+ Redis server. It depends on trollius (asyncio compatible for PEP 3156). It
+ supports Python 2 and 3 Trollius-using developers.
+
+ If you're new to asyncio, it can be helpful to check out
+ `the asyncio documentation`_ first.
+
+ .. _the asyncio documentation: http://docs.python.org/dev/library/asyncio.html
+
+ To see the original awesome driver that I ported from, I advise you to take a look at Jonathan Slenders `asyncio-redis`_.
+
+ .. _asyncio-redis: https://github.com/jonathanslenders/asyncio-redis.git
+
+
+ Features
+ --------
+
+ - Works for the trollius asyncio-compatible (PEP3156) event loop
+ - No dependencies except trollius
+ - Connection pooling
+ - Automatic conversion from unicode (Python) to bytes (inside Redis.)
+ - Bytes and str protocols.
+ - Completely tested
+ - Blocking calls and transactions supported
+ - Streaming of some multi bulk replies
+ - Pubsub support
+
+
+ Installation
+ ------------
+
+ .. code::
+
+ pip install trollius-redis
+
+ Documentation
+ -------------
+
+ View documentation at `read-the-docs`_
+
+ .. _read-the-docs: http://trollius-redis.readthedocs.org/en/latest/
+
+
+ The connection class
+ --------------------
+
+ A ``trollius_redis.Connection`` instance will take care of the connection and
+ will automatically reconnect, using a new transport when the connection drops.
+ This connection class also acts as a proxy to a ``trollius_redis.RedisProtocol``
+ instance; any Redis command of the protocol can be called directly at the
+ connection.
+
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create Redis connection
+ connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))
+
+ # Set a key
+ yield From(connection.set(u'my_key', u'my_value'))
+
+ # When finished, close the connection.
+ connection.close()
+
+ if __name__ == '__main__':
+ loop = trollius.get_event_loop()
+ loop.run_until_complete(example())
+
+
+ Connection pooling
+ ------------------
+
+ Requests will automatically be distributed among all connections in a pool. If
+ a connection is blocking because of --for instance-- a blocking rpop, another
+ connection will be used for new commands.
+
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create Redis connection
+ connection = yield From(trollius_redis.Pool.create(host=u'localhost', port=6379, poolsize=10))
+
+ # Set a key
+ yield From(connection.set(u'my_key', u'my_value'))
+
+ # When finished, close the connection pool.
+ connection.close()
+
+
+ Transactions example
+ --------------------
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create Redis connection
+ connection = yield From(trollius_redis.Pool.create(host=u'localhost', port=6379, poolsize=10))
+
+ # Create transaction
+ transaction = yield From(connection.multi())
+
+ # Run commands in transaction (they return future objects)
+ f1 = yield From(transaction.set(u'key', u'value'))
+ f2 = yield From(transaction.set(u'another_key', u'another_value'))
+
+ # Commit transaction
+ yield From(transaction.execute())
+
+ # Retrieve results
+ result1 = yield From(f1)
+ result2 = yield From(f2)
+
+ # When finished, close the connection pool.
+ connection.close()
+
+ It's recommended to use a large enough poolsize. A connection will be occupied
+ as long as there's a transaction running in there.
+
+
+ Pubsub example
+ --------------
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create connection
+ connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))
+
+ # Create subscriber.
+ subscriber = yield From(connection.start_subscribe())
+
+ # Subscribe to channel.
+ yield From(subscriber.subscribe([u'our-channel']))
+
+ # Inside a while loop, wait for incoming events.
+ while True:
+ reply = yield From(subscriber.next_published())
+ print(u'Received: ', repr(reply.value), u'on channel', reply.channel)
+
+ # When finished, close the connection.
+ connection.close()
+
+
+ LUA Scripting example
+ ---------------------
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ code = \
+ u"""
+ local value = redis.call('GET', KEYS[1])
+ value = tonumber(value)
+ return value * ARGV[1]
+ """
+
+ @trollius.coroutine
+ def example():
+ connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))
+
+ # Set a key
+ yield From(connection.set(u'my_key', u'2'))
+
+ # Register script
+ multiply = yield From(connection.register_script(code))
+
+ # Run script
+ script_reply = yield From(multiply.run(keys=[u'my_key'], args=[u'5']))
+ result = yield From(script_reply.return_value())
+ print(result) # prints 2 * 5
+
+ # When finished, close the connection.
+ connection.close()
+
+
+ Example using the Protocol class
+ --------------------------------
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ loop = trollius.get_event_loop()
+
+ # Create Redis connection
+ transport, protocol = yield From(loop.create_connection(
+ trollius_redis.RedisProtocol, u'localhost', 6379))
+
+ # Set a key
+ yield From(protocol.set(u'my_key', u'my_value'))
+
+ # Get a key
+ result = yield From(protocol.get(u'my_key'))
+ print(result)
+
+ # Close transport when finished.
+ transport.close()
+
+ if __name__ == '__main__':
+ trollius.get_event_loop().run_until_complete(example())
+
+
+ .. |Build Status| image:: https://travis-ci.org/benjolitz/trollius-redis.svg?branch=master
+ :target: https://travis-ci.org/benjolitz/trollius-redis
+ :alt: Build Status from Travis-CI
+
+
+ .. |Wheel Status| image:: https://pypip.in/wheel/trollius_redis/badge.svg
+ :target: https://pypi.python.org/pypi/trollius_redis/
+ :alt: Wheel Status
+
+ .. |Doc Status| image:: https://readthedocs.org/projects/trollius-redis/badge/?version=latest
+ :target: https://readthedocs.org/projects/trollius-redis/?badge=latest
+ :alt: Documentation Status
+
+
+Platform: UNKNOWN
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: Topic :: Database
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..54c6367
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,267 @@
+Redis client for Python trollius
+===========================================================================
+(ported from `asyncio-redis`_)
+
+|Build Status| |Wheel Status| |Doc Status|
+
+
+
+Supports
+---------
+- CPython 2.7, 3.3-3.5
+- PyPy
+- PyPy3
+
+
+Description
+------------
+
+
+Redis client for the `PEP 3156`_ Python event loop ported to Trollius.
+
+.. _PEP 3156: http://legacy.python.org/dev/peps/pep-3156/
+
+This Redis library is a completely asynchronous, non-blocking client for a
+Redis server. It depends on trollius (asyncio compatible for PEP 3156). It
+supports Python 2 and 3 Trollius-using developers.
+
+If you're new to asyncio, it can be helpful to check out
+`the asyncio documentation`_ first.
+
+.. _the asyncio documentation: http://docs.python.org/dev/library/asyncio.html
+
+To see the original awesome driver that I ported from, I advise you to take a look at Jonathan Slenders `asyncio-redis`_.
+
+.. _asyncio-redis: https://github.com/jonathanslenders/asyncio-redis.git
+
+
+Features
+--------
+
+- Works for the trollius asyncio-compatible (PEP3156) event loop
+- No dependencies except trollius
+- Connection pooling
+- Automatic conversion from unicode (Python) to bytes (inside Redis.)
+- Bytes and str protocols.
+- Completely tested
+- Blocking calls and transactions supported
+- Streaming of some multi bulk replies
+- Pubsub support
+
+
+Installation
+------------
+
+.. code::
+
+ pip install trollius-redis
+
+Documentation
+-------------
+
+View documentation at `read-the-docs`_
+
+.. _read-the-docs: http://trollius-redis.readthedocs.org/en/latest/
+
+
+The connection class
+--------------------
+
+A ``trollius_redis.Connection`` instance will take care of the connection and
+will automatically reconnect, using a new transport when the connection drops.
+This connection class also acts as a proxy to a ``trollius_redis.RedisProtocol``
+instance; any Redis command of the protocol can be called directly at the
+connection.
+
+
+.. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create Redis connection
+ connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))
+
+ # Set a key
+ yield From(connection.set(u'my_key', u'my_value'))
+
+ # When finished, close the connection.
+ connection.close()
+
+ if __name__ == '__main__':
+ loop = trollius.get_event_loop()
+ loop.run_until_complete(example())
+
+
+Connection pooling
+------------------
+
+Requests will automatically be distributed among all connections in a pool. If
+a connection is blocking because of --for instance-- a blocking rpop, another
+connection will be used for new commands.
+
+
+.. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create Redis connection
+ connection = yield From(trollius_redis.Pool.create(host=u'localhost', port=6379, poolsize=10))
+
+ # Set a key
+ yield From(connection.set(u'my_key', u'my_value'))
+
+ # When finished, close the connection pool.
+ connection.close()
+
+
+Transactions example
+--------------------
+
+.. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create Redis connection
+ connection = yield From(trollius_redis.Pool.create(host=u'localhost', port=6379, poolsize=10))
+
+ # Create transaction
+ transaction = yield From(connection.multi())
+
+ # Run commands in transaction (they return future objects)
+ f1 = yield From(transaction.set(u'key', u'value'))
+ f2 = yield From(transaction.set(u'another_key', u'another_value'))
+
+ # Commit transaction
+ yield From(transaction.execute())
+
+ # Retrieve results
+ result1 = yield From(f1)
+ result2 = yield From(f2)
+
+ # When finished, close the connection pool.
+ connection.close()
+
+It's recommended to use a large enough poolsize. A connection will be occupied
+as long as there's a transaction running in there.
+
+
+Pubsub example
+--------------
+
+.. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create connection
+ connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))
+
+ # Create subscriber.
+ subscriber = yield From(connection.start_subscribe())
+
+ # Subscribe to channel.
+ yield From(subscriber.subscribe([u'our-channel']))
+
+ # Inside a while loop, wait for incoming events.
+ while True:
+ reply = yield From(subscriber.next_published())
+ print(u'Received: ', repr(reply.value), u'on channel', reply.channel)
+
+ # When finished, close the connection.
+ connection.close()
+
+
+LUA Scripting example
+---------------------
+
+.. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ code = \
+ u"""
+ local value = redis.call('GET', KEYS[1])
+ value = tonumber(value)
+ return value * ARGV[1]
+ """
+
+ @trollius.coroutine
+ def example():
+ connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))
+
+ # Set a key
+ yield From(connection.set(u'my_key', u'2'))
+
+ # Register script
+ multiply = yield From(connection.register_script(code))
+
+ # Run script
+ script_reply = yield From(multiply.run(keys=[u'my_key'], args=[u'5']))
+ result = yield From(script_reply.return_value())
+ print(result) # prints 2 * 5
+
+ # When finished, close the connection.
+ connection.close()
+
+
+Example using the Protocol class
+--------------------------------
+
+.. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ loop = trollius.get_event_loop()
+
+ # Create Redis connection
+ transport, protocol = yield From(loop.create_connection(
+ trollius_redis.RedisProtocol, u'localhost', 6379))
+
+ # Set a key
+ yield From(protocol.set(u'my_key', u'my_value'))
+
+ # Get a key
+ result = yield From(protocol.get(u'my_key'))
+ print(result)
+
+ # Close transport when finished.
+ transport.close()
+
+ if __name__ == '__main__':
+ trollius.get_event_loop().run_until_complete(example())
+
+
+.. |Build Status| image:: https://travis-ci.org/benjolitz/trollius-redis.svg?branch=master
+ :target: https://travis-ci.org/benjolitz/trollius-redis
+ :alt: Build Status from Travis-CI
+
+
+.. |Wheel Status| image:: https://pypip.in/wheel/trollius_redis/badge.svg
+ :target: https://pypi.python.org/pypi/trollius_redis/
+ :alt: Wheel Status
+
+.. |Doc Status| image:: https://readthedocs.org/projects/trollius-redis/badge/?version=latest
+ :target: https://readthedocs.org/projects/trollius-redis/?badge=latest
+ :alt: Documentation Status
+
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..1db831f
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,11 @@
+[metadata]
+description-file = README.rst
+
+[bdist_wheel]
+universal = 1
+
+[egg_info]
+tag_build =
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..3291b66
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+from setuptools import setup
+from codecs import open
+
+install_requires = ['trollius', 'six']
+
+try:
+ from unittest import mock
+ mock
+except ImportError:
+ install_requires.append('mock')
+
+try:
+ import __pypy__
+ __pypy__
+except ImportError:
+ install_requires.append('hiredis')
+
+with open("README.rst", 'r') as fh:
+ description = fh.read()
+
+setup(
+ name='trollius_redis',
+ author='Ben Jolitz',
+ author_email="ben.jolitz+trollius_redis at gmail.com",
+ classifiers=[
+ # How mature is this project? Common values are
+ # 3 - Alpha
+ # 4 - Beta
+ # 5 - Production/Stable
+ 'Development Status :: 4 - Beta',
+
+ # Indicate who your project is intended for
+ 'Intended Audience :: Developers',
+ 'Topic :: Database',
+
+ # Pick your license as you wish (should match "license" above)
+ 'License :: OSI Approved :: BSD License',
+
+ # Specify the Python versions you support here. In particular, ensure
+ # that you indicate whether you support Python 2, Python 3 or both.
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
+ ],
+ version='0.1.4',
+ license='LICENSE.txt',
+ url='https://github.com/benjolitz/trollius-redis',
+
+ description='PEP 3156 implementation of the redis protocol.',
+ long_description=description,
+ packages=['trollius_redis'],
+ install_requires=install_requires
+)
diff --git a/trollius_redis.egg-info/PKG-INFO b/trollius_redis.egg-info/PKG-INFO
new file mode 100644
index 0000000..24c2f04
--- /dev/null
+++ b/trollius_redis.egg-info/PKG-INFO
@@ -0,0 +1,286 @@
+Metadata-Version: 1.1
+Name: trollius-redis
+Version: 0.1.4
+Summary: PEP 3156 implementation of the redis protocol.
+Home-page: https://github.com/benjolitz/trollius-redis
+Author: Ben Jolitz
+Author-email: ben.jolitz+trollius_redis at gmail.com
+License: LICENSE.txt
+Description: Redis client for Python trollius
+ ===========================================================================
+ (ported from `asyncio-redis`_)
+
+ |Build Status| |Wheel Status| |Doc Status|
+
+
+
+ Supports
+ ---------
+ - CPython 2.7, 3.3-3.5
+ - PyPy
+ - PyPy3
+
+
+ Description
+ ------------
+
+
+ Redis client for the `PEP 3156`_ Python event loop ported to Trollius.
+
+ .. _PEP 3156: http://legacy.python.org/dev/peps/pep-3156/
+
+ This Redis library is a completely asynchronous, non-blocking client for a
+ Redis server. It depends on trollius (asyncio compatible for PEP 3156). It
+ supports Python 2 and 3 Trollius-using developers.
+
+ If you're new to asyncio, it can be helpful to check out
+ `the asyncio documentation`_ first.
+
+ .. _the asyncio documentation: http://docs.python.org/dev/library/asyncio.html
+
+ To see the original awesome driver that I ported from, I advise you to take a look at Jonathan Slenders `asyncio-redis`_.
+
+ .. _asyncio-redis: https://github.com/jonathanslenders/asyncio-redis.git
+
+
+ Features
+ --------
+
+ - Works for the trollius asyncio-compatible (PEP3156) event loop
+ - No dependencies except trollius
+ - Connection pooling
+ - Automatic conversion from unicode (Python) to bytes (inside Redis.)
+ - Bytes and str protocols.
+ - Completely tested
+ - Blocking calls and transactions supported
+ - Streaming of some multi bulk replies
+ - Pubsub support
+
+
+ Installation
+ ------------
+
+ .. code::
+
+ pip install trollius-redis
+
+ Documentation
+ -------------
+
+ View documentation at `read-the-docs`_
+
+ .. _read-the-docs: http://trollius-redis.readthedocs.org/en/latest/
+
+
+ The connection class
+ --------------------
+
+ A ``trollius_redis.Connection`` instance will take care of the connection and
+ will automatically reconnect, using a new transport when the connection drops.
+ This connection class also acts as a proxy to a ``trollius_redis.RedisProtocol``
+ instance; any Redis command of the protocol can be called directly at the
+ connection.
+
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create Redis connection
+ connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))
+
+ # Set a key
+ yield From(connection.set(u'my_key', u'my_value'))
+
+ # When finished, close the connection.
+ connection.close()
+
+ if __name__ == '__main__':
+ loop = trollius.get_event_loop()
+ loop.run_until_complete(example())
+
+
+ Connection pooling
+ ------------------
+
+ Requests will automatically be distributed among all connections in a pool. If
+ a connection is blocking because of --for instance-- a blocking rpop, another
+ connection will be used for new commands.
+
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create Redis connection
+ connection = yield From(trollius_redis.Pool.create(host=u'localhost', port=6379, poolsize=10))
+
+ # Set a key
+ yield From(connection.set(u'my_key', u'my_value'))
+
+ # When finished, close the connection pool.
+ connection.close()
+
+
+ Transactions example
+ --------------------
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create Redis connection
+ connection = yield From(trollius_redis.Pool.create(host=u'localhost', port=6379, poolsize=10))
+
+ # Create transaction
+ transaction = yield From(connection.multi())
+
+ # Run commands in transaction (they return future objects)
+ f1 = yield From(transaction.set(u'key', u'value'))
+ f2 = yield From(transaction.set(u'another_key', u'another_value'))
+
+ # Commit transaction
+ yield From(transaction.execute())
+
+ # Retrieve results
+ result1 = yield From(f1)
+ result2 = yield From(f2)
+
+ # When finished, close the connection pool.
+ connection.close()
+
+ It's recommended to use a large enough poolsize. A connection will be occupied
+ as long as there's a transaction running in there.
+
+
+ Pubsub example
+ --------------
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ # Create connection
+ connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))
+
+ # Create subscriber.
+ subscriber = yield From(connection.start_subscribe())
+
+ # Subscribe to channel.
+ yield From(subscriber.subscribe([u'our-channel']))
+
+ # Inside a while loop, wait for incoming events.
+ while True:
+ reply = yield From(subscriber.next_published())
+ print(u'Received: ', repr(reply.value), u'on channel', reply.channel)
+
+ # When finished, close the connection.
+ connection.close()
+
+
+ LUA Scripting example
+ ---------------------
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ code = \
+ u"""
+ local value = redis.call('GET', KEYS[1])
+ value = tonumber(value)
+ return value * ARGV[1]
+ """
+
+ @trollius.coroutine
+ def example():
+ connection = yield From(trollius_redis.Connection.create(host=u'localhost', port=6379))
+
+ # Set a key
+ yield From(connection.set(u'my_key', u'2'))
+
+ # Register script
+ multiply = yield From(connection.register_script(code))
+
+ # Run script
+ script_reply = yield From(multiply.run(keys=[u'my_key'], args=[u'5']))
+ result = yield From(script_reply.return_value())
+ print(result) # prints 2 * 5
+
+ # When finished, close the connection.
+ connection.close()
+
+
+ Example using the Protocol class
+ --------------------------------
+
+ .. code:: python
+
+ import trollius
+ from trollius import From
+ import trollius_redis
+
+ @trollius.coroutine
+ def example():
+ loop = trollius.get_event_loop()
+
+ # Create Redis connection
+ transport, protocol = yield From(loop.create_connection(
+ trollius_redis.RedisProtocol, u'localhost', 6379))
+
+ # Set a key
+ yield From(protocol.set(u'my_key', u'my_value'))
+
+ # Get a key
+ result = yield From(protocol.get(u'my_key'))
+ print(result)
+
+ # Close transport when finished.
+ transport.close()
+
+ if __name__ == '__main__':
+ trollius.get_event_loop().run_until_complete(example())
+
+
+ .. |Build Status| image:: https://travis-ci.org/benjolitz/trollius-redis.svg?branch=master
+ :target: https://travis-ci.org/benjolitz/trollius-redis
+ :alt: Build Status from Travis-CI
+
+
+ .. |Wheel Status| image:: https://pypip.in/wheel/trollius_redis/badge.svg
+ :target: https://pypi.python.org/pypi/trollius_redis/
+ :alt: Wheel Status
+
+ .. |Doc Status| image:: https://readthedocs.org/projects/trollius-redis/badge/?version=latest
+ :target: https://readthedocs.org/projects/trollius-redis/?badge=latest
+ :alt: Documentation Status
+
+
+Platform: UNKNOWN
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: Topic :: Database
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
diff --git a/trollius_redis.egg-info/SOURCES.txt b/trollius_redis.egg-info/SOURCES.txt
new file mode 100644
index 0000000..635fe77
--- /dev/null
+++ b/trollius_redis.egg-info/SOURCES.txt
@@ -0,0 +1,17 @@
+README.rst
+setup.cfg
+setup.py
+trollius_redis/__init__.py
+trollius_redis/connection.py
+trollius_redis/cursors.py
+trollius_redis/encoders.py
+trollius_redis/exceptions.py
+trollius_redis/log.py
+trollius_redis/pool.py
+trollius_redis/protocol.py
+trollius_redis/replies.py
+trollius_redis.egg-info/PKG-INFO
+trollius_redis.egg-info/SOURCES.txt
+trollius_redis.egg-info/dependency_links.txt
+trollius_redis.egg-info/requires.txt
+trollius_redis.egg-info/top_level.txt
\ No newline at end of file
diff --git a/trollius_redis.egg-info/dependency_links.txt b/trollius_redis.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/trollius_redis.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/trollius_redis.egg-info/requires.txt b/trollius_redis.egg-info/requires.txt
new file mode 100644
index 0000000..e4de99b
--- /dev/null
+++ b/trollius_redis.egg-info/requires.txt
@@ -0,0 +1,4 @@
+trollius
... 3886 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/trollius-redis.git
More information about the Python-modules-commits
mailing list