Skip to content

Commit

Permalink
Update docstring and rename jsonData/toJson to json_data/to_json
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Jun 17, 2021
1 parent 20bdc00 commit b8a53e1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/webqueue2api/parser/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ class Queue:
>>> queue = Queue("ce")
Attributes:
name: The name of the queue.
items: A list of Items in the queue.
jsonData: A JSON serializable representation of the Queue.
name (str): The name of the queue.
path: (pathlib.Path): The path of the queue directory.
items (list): A list of Items in the queue.
json_data (dict): A JSON serializable representation of the Queue.
Raises:
QueueDoesNotExistError: If a queue's directory does not exist on the filesystem.
Expand All @@ -33,9 +34,8 @@ def __init__(self, name: str) -> None:

self.items = self.get_items()

self.jsonData = {
self.json_data = {
"name": self.name,
"length": len(self)
}

def get_items(self) -> list:
Expand All @@ -56,7 +56,7 @@ def get_items(self) -> list:

return items

def toJson(self) -> dict:
def to_json(self) -> dict:
"""Return JSON safe representation of the Queue
The JSON representation of every item in the Queue is added to the
Expand All @@ -68,9 +68,9 @@ def toJson(self) -> dict:
items = []
for item in self.items:
items.append(item.toJson())
self.jsonData["items"] = items
self.json_data["items"] = items

return self.jsonData
return self.json_data

def __len__(self) -> int:
return len(self.items)
Expand Down

0 comments on commit b8a53e1

Please sign in to comment.