minor PEP8 corrections

email
androiddrew 7 years ago
parent 36377d0b50
commit 7c88fe83c4

@ -3,6 +3,7 @@ from apistar.backends.sqlalchemy_backend import Session
from models.schema import User from models.schema import User
def create_user(session: Session, email, password): def create_user(session: Session, email, password):
user = User(email, password) user = User(email, password)
session.add(user) session.add(user)
@ -12,4 +13,4 @@ def create_user(session: Session, email, password):
commands = [ commands = [
Command('create_user', create_user) Command('create_user', create_user)
] ]

@ -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…
Cancel
Save