Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

PEP8ify/pyflakes + renamed redish.utils.key -> redish.utils.mkey

  • Loading branch information...
commit f46c8c40f1279375dd79d3727522ed7305913f1f 1 parent ad3f236
Ask Solem authored
View
1  examples/feedentries.py
@@ -52,4 +52,3 @@ class Entries(Manager):
for post in iter(posts):
print("(%s) %s" % (post.id, post.title))
-
View
16 redish/client.py
@@ -1,7 +1,7 @@
from redis import Redis as _RedisClient
from redish import types
-from redish.utils import key
+from redish.utils import mkey
from redish.serialization import Pickler
DEFAULT_PORT = 6379
@@ -113,7 +113,7 @@ def update(self, mapping):
def rename(self, old_name, new_name):
"""Rename key to a new name."""
- return self.api.rename(key(old_name), key(new_name))
+ return self.api.rename(mkey(old_name), mkey(new_name))
def keys(self, pattern="*"):
"""Get a list of all the keys in the database, or
@@ -149,8 +149,8 @@ def values(self, pattern="*"):
def pop(self, name):
"""Get and remove key from database (atomic)."""
- name = key(name)
- temp = key((name, "__poptmp__"))
+ name = mkey(name)
+ temp = mkey((name, "__poptmp__"))
if self.rename(name, temp):
value = self[temp]
del(self[temp])
@@ -159,7 +159,7 @@ def pop(self, name):
def __getitem__(self, name):
"""``x.__getitem__(name) <==> x[name]``"""
- name = key(name)
+ name = mkey(name)
value = self.api.get(name)
if value is None:
raise KeyError(name)
@@ -175,11 +175,11 @@ def get(self, key, default=None):
def __setitem__(self, name, value):
"""``x.__setitem(name, value) <==> x[name] = value``"""
- return self.api.set(key(name), self.prepare_value(value))
+ return self.api.set(mkey(name), self.prepare_value(value))
def __delitem__(self, name):
"""``x.__delitem__(name) <==> del(x[name])``"""
- name = key(name)
+ name = mkey(name)
if not self.api.delete(name):
raise KeyError(name)
@@ -189,7 +189,7 @@ def __len__(self):
def __contains__(self, name):
"""``x.__contains__(name) <==> name in x``"""
- return self.api.exists(key(name))
+ return self.api.exists(mkey(name))
def __repr__(self):
"""``x.__repr__() <==> repr(x)``"""
View
6 redish/types.py
@@ -2,13 +2,13 @@
from redis.exceptions import ResponseError
-from redish.utils import maybe_list, key
+from redish.utils import mkey
class Type(object):
def __init__(self, name, client):
- self.name = key(name)
+ self.name = mkey(name)
self.client = client
@@ -464,7 +464,7 @@ class LifoQueue(Queue):
entries first."""
def __init__(self, name, client, initial=None, maxsize=0):
- super(LIFOQueue, self).__init__(name, client, initial, maxsize)
+ super(LifoQueue, self).__init__(name, client, initial, maxsize)
self._pop = self.list.popleft
self._bpop = self.client.blpop
View
3  redish/utils.py
@@ -1,5 +1,4 @@
import time
-import operator
from datetime import datetime
@@ -11,7 +10,7 @@ def maybe_list(value):
return [value]
-def key(names):
+def mkey(names):
return ":".join(maybe_list(names))
Please sign in to comment.
Something went wrong with that request. Please try again.