Skip to content

Commit

Permalink
Fix misc. style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Yolken committed Feb 3, 2017
1 parent f85481d commit 6a0a1af
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions superset/results_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def __init__(self, default_timeout=300):

def get(self, key):
"""Look up key in the cache and return the value for it.
:param key: the key to be looked up.
:returns: The value if it exists and is readable, else ``None``.
"""
Expand All @@ -64,6 +65,7 @@ def get(self, key):

def delete(self, key):
"""Delete `key` from the cache.
:param key: the key to delete.
:returns: Whether the key existed and has been deleted.
:rtype: boolean
Expand All @@ -72,7 +74,7 @@ def delete(self, key):
return False
else:
try:
response = self.s3_client.delete_objects(
self.s3_client.delete_objects(
Bucket=self.bucket,
Delete={
'Objects': [
Expand All @@ -89,8 +91,10 @@ def delete(self, key):
return True

def set(self, key, value, timeout=None):
"""Add a new key/value to the cache (overwrites value, if key already
exists in the cache).
"""Add a new key/value to the cache.
If the key already exists, the existing value is overwritten.
:param key: the key to set
:param value: the value for the key
:param timeout: the cache timeout for the key in seconds (if not
Expand Down Expand Up @@ -118,8 +122,8 @@ def set(self, key, value, timeout=None):
return True

def add(self, key, value, timeout=None):
"""Works like :meth:`set` but does not overwrite the values of already
existing keys.
"""Works like :meth:`set` but does not overwrite existing values.
:param key: the key to set
:param value: the value for the key
:param timeout: the cache timeout for the key in seconds (if not
Expand All @@ -135,8 +139,9 @@ def add(self, key, value, timeout=None):
return self.set(key, value, timeout=timeout)

def clear(self):
"""Clears the cache. Keep in mind that not all caches support
completely clearing the cache.
"""Clears the cache.
Keep in mind that not all caches support completely clearing the cache.
:returns: Whether the cache has been cleared.
:rtype: boolean
"""
Expand All @@ -153,7 +158,7 @@ def _key_exists(self, key):
Bucket=self.bucket,
Key=self._full_s3_key(key)
)
except Exception as e:
except Exception:
# head_object throws an exception when object doesn't exist
return False
else:
Expand Down

0 comments on commit 6a0a1af

Please sign in to comment.