Skip to content

Commit

Permalink
Reduce max_line_length from 120 to 80
Browse files Browse the repository at this point in the history
  • Loading branch information
underyx committed Jul 18, 2016
1 parent 2a98042 commit 4d9eab6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .coafile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ bears =
GitCommitBear,

use_spaces = True
max_line_length = 120
max_line_length = 80
max_lines_per_file = 1000

ci_keywords = FIXME, pdb.set_trace()
Expand Down
24 changes: 14 additions & 10 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ History
0.3.0 (2016-07-18)
------------------

- **Backwards incompatible:** The ``FlaskRedis.init_app`` method no longer takes a ``strict`` parameter. Pass this flag
when creating your ``FlaskRedis`` instance, instead.
- **Backwards incompatible:** The extension will now be registered under the (lowercased) config prefix of the instance.
The default config prefix is ``'REDIS'``, so unless you change that, you can still access the extension via
- **Backwards incompatible:** The ``FlaskRedis.init_app`` method no longer takes
a ``strict`` parameter. Pass this flag when creating your ``FlaskRedis``
instance, instead.
- **Backwards incompatible:** The extension will now be registered under the
(lowercased) config prefix of the instance. The default config prefix is
``'REDIS'``, so unless you change that, you can still access the extension via
``app.extensions['redis']`` as before.
- **Backwards incompatible:** The default class has been changed to ``redis.StrictRedis``. You can switch back to the
old ``redis.Redis`` class by specifying ``strict=False`` in the ``FlaskRedis`` kwargs.
- You can now pass all supported ``Redis`` keyword arguments (such as ``decode_responses``) to ``FlaskRedis`` and they
will be correctly passed over to the ``redis-py`` instance. Thanks, @giyyapan!
- Usage like ``redis_store['key'] = value``, ``redis_store['key']``, and ``del redis_store['key']`` is now supported.
Thanks, @ariscn!
- **Backwards incompatible:** The default class has been changed to
``redis.StrictRedis``. You can switch back to the old ``redis.Redis`` class by
specifying ``strict=False`` in the ``FlaskRedis`` kwargs.
- You can now pass all supported ``Redis`` keyword arguments (such as
``decode_responses``) to ``FlaskRedis`` and they will be correctly passed over
to the ``redis-py`` instance. Thanks, @giyyapan!
- Usage like ``redis_store['key'] = value``, ``redis_store['key']``, and
``del redis_store['key']`` is now supported. Thanks, @ariscn!

0.2.0 (4/15/2015)
-----------------
Expand Down
41 changes: 26 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Flask-Redis
:target: https://coveralls.io/github/underyx/flask-redis
:alt: Test Coverage

.. image:: https://landscape.io/github/underyx/flask-redis/master/landscape.svg?style=flat
.. image:: https://landscape.io/github/underyx/flask-redis/master/landscape.svg
?style=flat
:target: https://landscape.io/github/underyx/flask-redis
:alt: Code Health

Expand Down Expand Up @@ -45,7 +46,8 @@ Or if you *must* use easy_install:
Configuration
-------------

Your configuration should be declared within your Flask config. Set the URL of your database like this:
Your configuration should be declared within your Flask config. Set the URL of
your database like this:

.. code-block:: python
Expand Down Expand Up @@ -78,7 +80,8 @@ or
redis_store.init_app(app)
return app
or perhaps you want to use the old, plain ``Redis`` class instead of ``StrictRedis``
or perhaps you want to use the old, plain ``Redis`` class instead of
``StrictRedis``

.. code-block:: python
Expand All @@ -91,8 +94,9 @@ or perhaps you want to use the old, plain ``Redis`` class instead of ``StrictRed
or maybe you want to use
`mockredis <https://github.com/locationlabs/mockredis>`_ to make your unit
tests simpler. As of ``mockredis`` 2.9.0.10, it does not have the ``from_url()``
classmethod that ``FlaskRedis`` depends on, so we wrap it and add our own.
tests simpler. As of ``mockredis`` 2.9.0.10, it does not have the
``from_url()`` classmethod that ``FlaskRedis`` depends on, so we wrap it and add
our own.

.. code-block:: python
Expand Down Expand Up @@ -121,7 +125,8 @@ classmethod that ``FlaskRedis`` depends on, so we wrap it and add our own.
Usage
-----

``FlaskRedis`` proxies attribute access to an underlying Redis connection. So treat it as if it were a regular ``Redis``
``FlaskRedis`` proxies attribute access to an underlying Redis connection. So
treat it as if it were a regular ``Redis``
instance.

.. code-block:: python
Expand All @@ -132,21 +137,27 @@ instance.
def index():
return redis_store.get('potato', 'Not Set')
**Protip:** The redis-py_ package currently holds the 'redis' namespace, so if you are looking to make use of it, your
Redis object shouldn't be named 'redis'.
**Protip:** The redis-py_ package currently holds the 'redis' namespace, so if
you are looking to make use of it, your Redis object shouldn't be named 'redis'.

For detailed instructions regarding the usage of the client, check the redis-py_ documentation.
For detailed instructions regarding the usage of the client, check the redis-py_
documentation.

Advanced features, such as Lua scripting, pipelines and callbacks are detailed within the projects README.
Advanced features, such as Lua scripting, pipelines and callbacks are detailed
within the projects README.

Contribute
----------

#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a
Contributor Friendly tag for issues that should be ideal for people who are not very familiar with the codebase yet.
#. Fork `the repository`_ on Github to start making your changes to the **master** branch (or branch off of it).
#. Write a test which shows that the bug was fixed or that the feature works as expected.
#. Send a pull request and bug the maintainer until it gets merged and published.
#. Check for open issues or open a fresh issue to start a discussion around a
feature idea or a bug. There is a Contributor Friendly tag for issues that
should be ideal for people who are not very familiar with the codebase yet.
#. Fork `the repository`_ on Github to start making your changes to the
**master** branch (or branch off of it).
#. Write a test which shows that the bug was fixed or that the feature works as
expected.
#. Send a pull request and bug the maintainer until it gets merged and
published.

.. _`the repository`: https://github.com/underyx/flask-redis
.. _redis-py: https://github.com/andymccurdy/redis-py
6 changes: 4 additions & 2 deletions flask_redis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, app=None, strict=True, config_prefix='REDIS', **kwargs):

@classmethod
def from_custom_provider(cls, provider, app=None, **kwargs):
assert provider is not None, 'your custom provider cannot be None, come on'
assert provider is not None, 'your custom provider is None, come on'

# We never pass the app parameter here, so we can call init_app
# ourselves later, after the provider class has been set
Expand All @@ -38,7 +38,9 @@ def init_app(self, app, **kwargs):
)

self.provider_kwargs.update(kwargs)
self._redis_client = self.provider_class.from_url(redis_url, **self.provider_kwargs)
self._redis_client = self.provider_class.from_url(
redis_url, **self.provider_kwargs
)

if not hasattr(app, 'extensions'):
app.extensions = {}
Expand Down

0 comments on commit 4d9eab6

Please sign in to comment.