Skip to content

Commit 9abd67f

Browse files
authored
Update app.py to work with Python version 3.9.7 and follow isort
Updating the import orders and the datetime usage to follow a pattern that works with 3.9.7 and 3.13
1 parent d2d6e4a commit 9abd67f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

examples/sqlalchemy/app.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import datetime
2-
from datetime import timezone
31
import logging
2+
from datetime import datetime, timezone
43

5-
import connexion
64
import orm
7-
from connexion import NoContent
8-
5+
from connexion import FlaskApp, NoContent
96

107
def get_pets(limit, animal_type=None):
118
with db_session_factory() as db_session:
@@ -30,7 +27,7 @@ def put_pet(pet_id, pet):
3027
p.update(**pet)
3128
else:
3229
logging.info("Creating pet %s..", pet_id)
33-
pet["created"] = datetime.datetime.now(timezone.UTC)
30+
pet["created"] = datetime.now(timezone.UTC)
3431
db_session.add(orm.Pet(**pet))
3532
db_session.commit()
3633
return NoContent, (200 if p is not None else 201)
@@ -57,7 +54,7 @@ def delete_pet(pet_id):
5754
}
5855
for id_, pet in pets.items():
5956
put_pet(id_, pet)
60-
app = connexion.FlaskApp(__name__, specification_dir="spec")
57+
app = FlaskApp(__name__, specification_dir="spec")
6158
app.add_api("openapi.yaml")
6259
app.add_api("swagger.yaml")
6360

0 commit comments

Comments
 (0)