Skip to content

Commit f68c993

Browse files
authored
Fix pep8 errors (#26)
* Fix pep8 errors
1 parent 21ed7fc commit f68c993

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

cmreslogging/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
except ImportError:
2222
AWS4AUTH_SUPPORTED = False
2323

24-
from serializers import CMRESSerializer
24+
from cmreslogging.serializers import CMRESSerializer
2525

2626

2727
class CMRESHandler(logging.Handler):

cmreslogging/serializers.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,25 @@
55

66
from elasticsearch.serializer import JSONSerializer
77

8+
89
class CMRESSerializer(JSONSerializer):
9-
""" JSON serializer inherited from the elastic search JSON serializer
10+
""" JSON serializer inherited from the elastic search JSON serializer
1011
1112
Allows to serialize logs for a elasticsearch use.
1213
Manage the record.exc_info containing an exception type.
1314
"""
1415
def default(self, data):
1516
""" Default overrides the elasticsearch default method
1617
17-
Allows to transform unknown types into strings
18-
19-
:params data: The data to serialize before sending it to elastic search
18+
Allows to transform unknown types into strings
19+
20+
:params data: The data to serialize before sending it to elastic search
2021
"""
22+
result = None
2123
if isinstance(data, (date, datetime)):
22-
return data.isoformat()
24+
result = data.isoformat()
2325
elif isinstance(data, Decimal):
24-
return float(data)
26+
result = float(data)
2527
else:
26-
return str(data)
28+
result = str(data)
29+
return result

0 commit comments

Comments
 (0)