minor PEP8 corrections
parent
36377d0b50
commit
7c88fe83c4
@ -1,9 +1,10 @@
|
|||||||
import datetime as dt
|
import datetime as dt
|
||||||
import decimal
|
import decimal
|
||||||
|
|
||||||
|
|
||||||
def alchemyencoder(obj):
|
def alchemyencoder(obj):
|
||||||
"""JSON encoder function for SQLAlchemy special classes."""
|
"""JSON encoder function with support for ISO 8601 datetime serialization and Decimal to float casting"""
|
||||||
if isinstance(obj, dt.datetime):
|
if isinstance(obj, dt.datetime):
|
||||||
return obj.isoformat()
|
return obj.isoformat()
|
||||||
elif isinstance(obj, decimal.Decimal):
|
elif isinstance(obj, decimal.Decimal):
|
||||||
return float(obj)
|
return float(obj)
|
||||||
|
Loading…
Reference in New Issue