Skip to content

Commit

Permalink
Ensure _s3 is always defined for more pythonic checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jtratner committed Mar 28, 2017
1 parent ba04570 commit 786e5e9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions luigi/contrib/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class S3Client(FileSystem):
boto-powered S3 client.
"""

_s3 = None

def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
**kwargs):
from boto.s3.key import Key
Expand All @@ -94,7 +96,7 @@ def s3(self):

options = dict(self._options)

if getattr(self, '_s3', None):
if self._s3:
return self._s3

aws_access_key_id = options.get('aws_access_key_id')
Expand Down Expand Up @@ -128,11 +130,6 @@ def s3(self):
def s3(self, value):
self._s3 = value

@s3.deleter
def s3(self):
if hasattr(self, '_s3'):
del self._s3

def exists(self, path):
"""
Does provided path exist on S3?
Expand Down

0 comments on commit 786e5e9

Please sign in to comment.