From e876292eab2976f2df247d7d4c0531f448311f83 Mon Sep 17 00:00:00 2001 From: Anand Tripathi Date: Sat, 4 Mar 2023 13:20:08 +0100 Subject: [PATCH] snake_case convention for better readibility (#382) --- examples/todomvc.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/todomvc.py b/examples/todomvc.py index 42017a30..252177b5 100644 --- a/examples/todomvc.py +++ b/examples/todomvc.py @@ -49,10 +49,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("/") @@ -63,14 +63,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("/") @@ -83,20 +83,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__":