From c34a9003ee7bc76b16d86abbb409f485baa19647 Mon Sep 17 00:00:00 2001 From: Anand Tripathi Date: Mon, 25 Oct 2021 11:00:35 +0200 Subject: [PATCH] snake_case convention for better readibility --- examples/todomvc.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/todomvc.py b/examples/todomvc.py index 19e45cf3..d751dd93 100644 --- a/examples/todomvc.py +++ b/examples/todomvc.py @@ -44,10 +44,10 @@ def delete(self, id): self.todos.remove(todo) -DAO = TodoDAO() -DAO.create({"task": "Build an API"}) -DAO.create({"task": "?????"}) -DAO.create({"task": "profit!"}) +todo_dao = TodoDAO() +todo_dao.create({"task": "Build an API"}) +todo_dao.create({"task": "?????"}) +todo_dao.create({"task": "profit!"}) @ns.route("/") @@ -58,14 +58,14 @@ class TodoList(Resource): @ns.marshal_list_with(todo) def get(self): """List all tasks""" - return DAO.todos + return todo_dao.todos @ns.doc("create_todo") @ns.expect(todo) @ns.marshal_with(todo, code=201) def post(self): """Create a new task""" - return DAO.create(api.payload), 201 + return todo_dao.create(api.payload), 201 @ns.route("/") @@ -78,20 +78,20 @@ class Todo(Resource): @ns.marshal_with(todo) def get(self, id): """Fetch a given resource""" - return DAO.get(id) + return todo_dao.get(id) @ns.doc("delete_todo") @ns.response(204, "Todo deleted") def delete(self, id): """Delete a task given its identifier""" - DAO.delete(id) + todo_dao.delete(id) return "", 204 @ns.expect(todo) @ns.marshal_with(todo) def put(self, id): """Update a task given its identifier""" - return DAO.update(id, api.payload) + return todo_dao.update(id, api.payload) if __name__ == "__main__":