Skip to content

Commit e876292

Browse files
snake_case convention for better readibility (#382)
1 parent f755aeb commit e876292

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

examples/todomvc.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ def delete(self, id):
4949
self.todos.remove(todo)
5050

5151

52-
DAO = TodoDAO()
53-
DAO.create({"task": "Build an API"})
54-
DAO.create({"task": "?????"})
55-
DAO.create({"task": "profit!"})
52+
todo_dao = TodoDAO()
53+
todo_dao.create({"task": "Build an API"})
54+
todo_dao.create({"task": "?????"})
55+
todo_dao.create({"task": "profit!"})
5656

5757

5858
@ns.route("/")
@@ -63,14 +63,14 @@ class TodoList(Resource):
6363
@ns.marshal_list_with(todo)
6464
def get(self):
6565
"""List all tasks"""
66-
return DAO.todos
66+
return todo_dao.todos
6767

6868
@ns.doc("create_todo")
6969
@ns.expect(todo)
7070
@ns.marshal_with(todo, code=201)
7171
def post(self):
7272
"""Create a new task"""
73-
return DAO.create(api.payload), 201
73+
return todo_dao.create(api.payload), 201
7474

7575

7676
@ns.route("/<int:id>")
@@ -83,20 +83,20 @@ class Todo(Resource):
8383
@ns.marshal_with(todo)
8484
def get(self, id):
8585
"""Fetch a given resource"""
86-
return DAO.get(id)
86+
return todo_dao.get(id)
8787

8888
@ns.doc("delete_todo")
8989
@ns.response(204, "Todo deleted")
9090
def delete(self, id):
9191
"""Delete a task given its identifier"""
92-
DAO.delete(id)
92+
todo_dao.delete(id)
9393
return "", 204
9494

9595
@ns.expect(todo)
9696
@ns.marshal_with(todo)
9797
def put(self, id):
9898
"""Update a task given its identifier"""
99-
return DAO.update(id, api.payload)
99+
return todo_dao.update(id, api.payload)
100100

101101

102102
if __name__ == "__main__":

0 commit comments

Comments
 (0)