Documentation and formatting fixes
This commit is contained in:
parent
134d71f44d
commit
9686e43ec2
2 changed files with 10 additions and 12 deletions
|
@ -57,14 +57,14 @@ class Todo(TodoObject):
|
|||
else: # catch-all for unlisted notes
|
||||
return 0
|
||||
|
||||
def _get_parent(self, level, obj: TodoObject, obj_type: Type[TodoObject] = None):
|
||||
def _get_parent(self, level: int, obj: TodoObject, obj_type: Optional[Type[TodoObject]] = None):
|
||||
"""Gets the parent for an object at level X.
|
||||
If an object with a lower level cannot be found within the obj, it will return the obj.
|
||||
|
||||
Args:
|
||||
level (int): The level to find the parent for.
|
||||
obj (TodoObject): Object to grab parents from.
|
||||
obj_type (Type[TodoObject]): The type of the object the parent should be. Default is None.
|
||||
obj_type (Type[TodoObject], optional): The type of the object the parent should be. Default is None.
|
||||
|
||||
Returns:
|
||||
TodoObject: The object found.
|
||||
|
|
|
@ -24,10 +24,10 @@ class TodoObject:
|
|||
|
||||
Args:
|
||||
immediate (bool, optional): Whether it should return immediate children only. Defaults to False.
|
||||
obj_type (Optional[Type[T]], optional): Specify the types of children to return. Defaults to None.
|
||||
obj_type (Type[Note | Category | Task], optional): Specify the types of children to return. Defaults to None.
|
||||
|
||||
Returns:
|
||||
list[T]: [description]
|
||||
list[Note | Category | Task]: Returns all children that match the criteria.
|
||||
"""
|
||||
output = []
|
||||
for child in self.children:
|
||||
|
@ -45,10 +45,10 @@ class TodoObject:
|
|||
"""Get all parents of an object. Optionally specify a class of TodoObject to return.
|
||||
|
||||
Args:
|
||||
obj_type (Optional[Type[T]], optional): Specify the types of parents to return. Defaults to None.
|
||||
obj_type (Type[Note | Category | Task], optional): Specify the types of parents to return. Defaults to None.
|
||||
|
||||
Returns:
|
||||
list[T]: List of parents found.
|
||||
list[Note | Category | Task]: List of parents found.
|
||||
"""
|
||||
output = []
|
||||
for parent in self.parents:
|
||||
|
@ -67,7 +67,6 @@ class TodoObject:
|
|||
Returns:
|
||||
str: the markdown text generated
|
||||
"""
|
||||
|
||||
output = ""
|
||||
for i in self.get_children():
|
||||
if len(output) > 0:
|
||||
|
@ -127,13 +126,12 @@ class TodoObject:
|
|||
complete (Optional[bool], optional): If true, return completed tasks only, inverse if False. Defaults to None.
|
||||
|
||||
Returns:
|
||||
Task: [description]
|
||||
Task: Returns the task found
|
||||
"""
|
||||
for task in self.get_tasks(immediate, complete):
|
||||
if re.match(regex, task.text):
|
||||
return task
|
||||
|
||||
|
||||
def get_categories(self, immediate: bool = False) -> list[Category]:
|
||||
"""Gets all categories from children of the TodoObject.
|
||||
|
||||
|
@ -150,7 +148,7 @@ class TodoObject:
|
|||
immediate (bool, optional): Whether or not it should return immediate children only. Defaults to False.
|
||||
|
||||
Returns:
|
||||
Category: [description]
|
||||
Category: Returns the category found.
|
||||
"""
|
||||
for category in self.get_categories(immediate):
|
||||
if re.match(regex, category.text):
|
||||
|
@ -161,7 +159,7 @@ class TodoObject:
|
|||
|
||||
Args:
|
||||
immediate (bool, optional): Whether or not it should return immeduate children only. Defaults to False.
|
||||
c
|
||||
|
||||
Returns:
|
||||
Note: Returns all notes found.
|
||||
"""
|
||||
|
@ -175,7 +173,7 @@ c
|
|||
immediate (bool, optional): Whether or not it should return immediate children only. Defaults to False.
|
||||
|
||||
Returns:
|
||||
Note: [description]
|
||||
Note: Returns the note found.
|
||||
"""
|
||||
for note in self.get_notes(immediate):
|
||||
if re.match(regex, note.text):
|
||||
|
|
Loading…
Reference in a new issue