Skip to content

Commit

Permalink
Flake8 fixes and indentation fix
Browse files Browse the repository at this point in the history
Fixes for Flake8 error and indentation bug fix to return result when object_filter is None
  • Loading branch information
sunank200 committed Jul 16, 2021
1 parent 9bd5bc1 commit f2f4cbc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions airflow/providers/amazon/aws/hooks/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,9 @@ def __init__(self, data):

def filter(self, object_filter: Optional[dict] = None) -> list:
"""
object_filter = {
'key': 'Sample',
'LastModified__gt': datetime.now()
}
object_filter = {'key': 'Sample','LastModified__gt': datetime.now()}
if object_filter is None return all the Keys.
"""
# if object_filter is None return all the Keys.
if object_filter is None:
result = []
if "Contents" in self.data:
Expand All @@ -84,8 +81,10 @@ def filter(self, object_filter: Optional[dict] = None) -> list:
def parse_filter(item) -> operation:
"""
The item is expected to be a tuple with exactly two elements
>>> parse_filter(('LastModified__gt', datetime.strptime('2018-11-25T09:55:48+0000','%Y-%m-%dT%H:%M:%S%z')))
Q(op=<built-in function gt>, key='LastModified__gt', value=datetime.strptime('2018-11-25T09:55:48+0000','%Y-%m-%dT%H:%M:%S%z'))
>>> parse_filter(('LastModified__gt',
datetime.strptime('2018-11-25T09:55:48+0000','%Y-%m-%dT%H:%M:%S%z')))
Q(op=<built-in function gt>, key='LastModified__gt',
value=datetime.strptime('2018-11-25T09:55:48+0000','%Y-%m-%dT%H:%M:%S%z'))
>>> parse_filter(('Key', 'Sample'))
Q(op=<built-in function eq>, key='Key', value='Sample')
>>> parse_filter(('LastModified__bad', 'red'))
Expand Down

0 comments on commit f2f4cbc

Please sign in to comment.