From 7c88fe83c492d2d87c9da0c58310a1f0614b1621 Mon Sep 17 00:00:00 2001 From: androiddrew Date: Mon, 9 Oct 2017 07:35:07 -0400 Subject: [PATCH] minor PEP8 corrections --- cookie_api/commands.py | 3 ++- cookie_api/models/util.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cookie_api/commands.py b/cookie_api/commands.py index b834c67..9c06112 100644 --- a/cookie_api/commands.py +++ b/cookie_api/commands.py @@ -3,6 +3,7 @@ from apistar.backends.sqlalchemy_backend import Session from models.schema import User + def create_user(session: Session, email, password): user = User(email, password) session.add(user) @@ -12,4 +13,4 @@ def create_user(session: Session, email, password): commands = [ Command('create_user', create_user) -] \ No newline at end of file +] diff --git a/cookie_api/models/util.py b/cookie_api/models/util.py index be07f85..1351458 100644 --- a/cookie_api/models/util.py +++ b/cookie_api/models/util.py @@ -1,9 +1,10 @@ import datetime as dt import decimal + 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): return obj.isoformat() elif isinstance(obj, decimal.Decimal): - return float(obj) \ No newline at end of file + return float(obj)