Skip to content

Commit

Permalink
Fix missing/extra whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
alisaifee committed May 19, 2020
1 parent f14f1c9 commit 7f1930e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion limits/limits.py
Expand Up @@ -38,7 +38,7 @@ def __new__(cls, name, parents, dct):
return granularity


#pylint: disable=no-member
# pylint: disable=no-member
@add_metaclass(RateLimitItemMeta)
@total_ordering
class RateLimitItem(object):
Expand Down
6 changes: 2 additions & 4 deletions limits/storage.py
Expand Up @@ -141,8 +141,8 @@ def __expire_events(self):
for event in list(self.events[key]):
with event:
if (
event.expiry <= time.time() and
event in self.events[key]
event.expiry <= time.time()
and event in self.events[key]
):
self.events[key].remove(event)
for key in list(self.expirations.keys()):
Expand Down Expand Up @@ -550,7 +550,6 @@ def get(self, key):
"""
return super(RedisStorage, self).get(key, self.storage_slave)


def get_expiry(self, key):
"""
:param str key: the key to get the expiry for
Expand Down Expand Up @@ -693,7 +692,6 @@ def storage(self):

return self.local_storage.storage


def get(self, key):
"""
:param str key: the key to get the counter value for
Expand Down
1 change: 1 addition & 0 deletions limits/strategies.py
Expand Up @@ -52,6 +52,7 @@ def get_window_stats(self, item, *identifiers):
def clear(self, item, *identifiers):
return self.storage().clear(item.key_for(*identifiers))


class MovingWindowRateLimiter(RateLimiter):
"""
Reference: :ref:`moving-window`
Expand Down
4 changes: 2 additions & 2 deletions tests/__init__.py
Expand Up @@ -6,8 +6,8 @@
import unittest

RUN_GAE = (
sys.version_info[:2] == (2, 7)
and platform.python_implementation() == 'CPython'
sys.version_info[:2] == (2, 7)
and platform.python_implementation() == 'CPython'
)


Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_concurrency.py
Expand Up @@ -58,4 +58,3 @@ def hit():

self.assertTrue(time.time() - start < 1)
self.assertEqual(len(hits), 100)

4 changes: 2 additions & 2 deletions tests/test_limit_granularities.py
Expand Up @@ -4,6 +4,7 @@

from limits import limits


@pytest.mark.unit
class GranularityTests(unittest.TestCase):
def test_seconds_value(self):
Expand Down Expand Up @@ -48,8 +49,7 @@ def test_representation(self):

def test_comparison(self):
self.assertTrue(
limits.RateLimitItemPerSecond(1) <
limits.RateLimitItemPerMinute(1)
limits.RateLimitItemPerSecond(1) < limits.RateLimitItemPerMinute(1)
)
self.assertTrue(
limits.RateLimitItemPerMinute(1) < limits.RateLimitItemPerHour(1)
Expand Down
4 changes: 3 additions & 1 deletion tests/test_storage.py
Expand Up @@ -151,7 +151,6 @@ def test_storage_check(self):
if RUN_GAE:
self.assertTrue(storage_from_string("gaememcached://").check())


def test_pluggable_storage_invalid_construction(self):
def cons():
class _(Storage):
Expand Down Expand Up @@ -208,6 +207,7 @@ def get_moving_window(self, *a, **k):
self.assertTrue(isinstance(storage, MyStorage))
MovingWindowRateLimiter(storage)


@pytest.mark.unit
class MemoryStorageTests(unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -276,6 +276,7 @@ def test_expiry_moving_window(self):
time.sleep(0.1)
self.assertEqual([], self.storage.events[per_min.key_for()])


@pytest.mark.unit
class SharedRedisTests(object):
def test_fixed_window(self):
Expand Down Expand Up @@ -328,6 +329,7 @@ def test_moving_window_expiry(self):
time.sleep(0.05)
self.assertTrue(self.storage.storage.keys("%s/*" % limit.namespace) == [])


@pytest.mark.unit
class RedisStorageTests(SharedRedisTests, unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit 7f1930e

Please sign in to comment.