API#
- todobricks.todo.combine_lists(todolist1, todolist2)#
combine two lists
- Parameters
todolist1 (list) – list of todo items
todolist2 (list) – list of todo items
- Returns
combined_list – one list with all items
- Return type
list
- todobricks.todo.count_tasks(todo_list)#
count items overall or by group
- Parameters
todo_list (list or dictionary) – todo list as a list or a grouped todo list as a dictionary
- Returns
count (integer or dictionary) – the count of items in the list or a dictionary with the same keys as
input and the number of items in each value as the values
- todobricks.todo.group_tasks(todo_list, by='project')#
group tasks by a specific feild of the todo.txt standard
- Parameters
todo_list (list) – todo list to work with
by ({'project', 'context', or 'due_date'}) – type of content to group by
- todobricks.todo.grouped_to_list(grouped_tasks, order_dicts=None, ascending=False)#
take grouped tasks and put them back to a list, optionally ordered by a dictionary otherwise sorted ascending
- Parameters
grouped_tasks (dict) –
- todobricks.todo.is_complete(todo_item)#
check if a single item is complete (first character is x, then space)
- Parameters
todo_item (string) – one item from a todolist
- Returns
is_done – true if the line starts with ‘x ‘
- Return type
boolean
- todobricks.todo.is_file_extension(file_name, text_extension)#
check if the given file has the specified extension
- Parameters
file_name (string or path object) – path to the file
text_extension (string) – the file extension (the part after the .) to be checked for
- Returns
is_match – True if the file has the specified extension
- Return type
boolean
- todobricks.todo.read_csv_file(file_name)#
read a csv file and turn it into a dataframe
- Parameters
file_name (string or path object) – path to the file
- Returns
df – a pandas DataFrame object of the data in the csv file
- Return type
pandas.DataFrame
- todobricks.todo.read_txt_file(file_name)#
read a plain text file
- Parameters
file_name (string or path object) – path to the file
- Returns
text – text of the file as a single string
- Return type
string
- todobricks.todo.remove_complete_tasks(todo_list)#
remove items that are marked complete (first character is x, then space)
- Parameters
todo_list (list) – list of todo items
- Returns
todo_list – list of todo items without complete items
- Return type
list
- todobricks.todo.search_code_file(file_name, comment_type='#')#
find comments in a code file that have todo items
Parameters
- todobricks.todo.split_txt_file(text)#
split a blob of text into a list
- Parameters
text (string) – text as read from a todo.txt file
- Returns
list_txt
- Return type
the same text, split into a list of items
- todobricks.todo.write_file(todo_list, file_name)#
write a lit out to a file
- Parameters
todo_list (list) – list of todo items
file_name (string or path object) – path to the file