Skip to content

Commit

Permalink
Fix long lines in superset/results_backends.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Yolken committed Feb 3, 2017
1 parent 00b6b0a commit f85481d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions superset/results_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class S3Cache(BaseCache):
Adapted from examples in
https://github.com/pallets/werkzeug/blob/master/werkzeug/contrib/cache.py.
Timeout parameters are ignored as S3 doesn't support key-level expiration. To expire
keys, set up an expiration policy as described in
Timeout parameters are ignored as S3 doesn't support key-level expiration.
To expire keys, set up an expiration policy as described in
https://aws.amazon.com/blogs/aws/amazon-s3-object-expiration/.
"""

Expand All @@ -50,7 +50,11 @@ def get(self, key):
value_file = StringIO.StringIO()

try:
self.s3_client.download_fileobj(self.bucket, self._full_s3_key(key), value_file)
self.s3_client.download_fileobj(
self.bucket,
self._full_s3_key(key),
value_file
)
except Exception as e:
logging.warn('Exception while trying to get %s: %s', key, e)
return None
Expand Down Expand Up @@ -102,7 +106,11 @@ def set(self, key, value, timeout=None):

try:
value_file.seek(0)
self.s3_client.upload_fileobj(value_file, self.bucket, self._full_s3_key(key))
self.s3_client.upload_fileobj(
value_file,
self.bucket,
self._full_s3_key(key)
)
except Exception as e:
logging.warn('Exception while trying to set %s: %s', key, e)
return False
Expand Down

0 comments on commit f85481d

Please sign in to comment.