repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
bram85/topydo
topydo/ui/columns/CommandLineWidget.py
CommandLineWidget._complete
def _complete(self): """ Main completion function. Gets list of potential completion candidates for currently edited word, completes it to the longest common part, and shows convenient completion widget (if multiple completions are returned) with currently selected candi...
python
def _complete(self): """ Main completion function. Gets list of potential completion candidates for currently edited word, completes it to the longest common part, and shows convenient completion widget (if multiple completions are returned) with currently selected candi...
[ "def", "_complete", "(", "self", ")", ":", "def", "find_word_start", "(", "p_text", ",", "p_pos", ")", ":", "\"\"\" Returns position of the beginning of a word ending in p_pos. \"\"\"", "return", "p_text", ".", "lstrip", "(", ")", ".", "rfind", "(", "' '", ",", "0...
Main completion function. Gets list of potential completion candidates for currently edited word, completes it to the longest common part, and shows convenient completion widget (if multiple completions are returned) with currently selected candidate highlighted.
[ "Main", "completion", "function", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/CommandLineWidget.py#L110-L155
train
bram85/topydo
topydo/ui/columns/CommandLineWidget.py
CommandLineWidget._home_del
def _home_del(self): """ Deletes the line content before the cursor """ text = self.edit_text[self.edit_pos:] self.set_edit_text(text) self._home()
python
def _home_del(self): """ Deletes the line content before the cursor """ text = self.edit_text[self.edit_pos:] self.set_edit_text(text) self._home()
[ "def", "_home_del", "(", "self", ")", ":", "text", "=", "self", ".", "edit_text", "[", "self", ".", "edit_pos", ":", "]", "self", ".", "set_edit_text", "(", "text", ")", "self", ".", "_home", "(", ")" ]
Deletes the line content before the cursor
[ "Deletes", "the", "line", "content", "before", "the", "cursor" ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/CommandLineWidget.py#L197-L201
train
bram85/topydo
topydo/ui/columns/CommandLineWidget.py
CommandLineWidget._end_del
def _end_del(self): """ Deletes the line content after the cursor """ text = self.edit_text[:self.edit_pos] self.set_edit_text(text)
python
def _end_del(self): """ Deletes the line content after the cursor """ text = self.edit_text[:self.edit_pos] self.set_edit_text(text)
[ "def", "_end_del", "(", "self", ")", ":", "text", "=", "self", ".", "edit_text", "[", ":", "self", ".", "edit_pos", "]", "self", ".", "set_edit_text", "(", "text", ")" ]
Deletes the line content after the cursor
[ "Deletes", "the", "line", "content", "after", "the", "cursor" ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/CommandLineWidget.py#L203-L206
train
bram85/topydo
topydo/lib/Graph.py
DirectedGraph.add_edge
def add_edge(self, p_from, p_to, p_id=None): """ Adds an edge to the graph. The nodes will be added if they don't exist. The p_id is the id of the edge, if the client wishes to maintain this. """ if not self.has_edge(p_from, p_to): if not self.has_node(p_from): ...
python
def add_edge(self, p_from, p_to, p_id=None): """ Adds an edge to the graph. The nodes will be added if they don't exist. The p_id is the id of the edge, if the client wishes to maintain this. """ if not self.has_edge(p_from, p_to): if not self.has_node(p_from): ...
[ "def", "add_edge", "(", "self", ",", "p_from", ",", "p_to", ",", "p_id", "=", "None", ")", ":", "if", "not", "self", ".", "has_edge", "(", "p_from", ",", "p_to", ")", ":", "if", "not", "self", ".", "has_node", "(", "p_from", ")", ":", "self", "."...
Adds an edge to the graph. The nodes will be added if they don't exist. The p_id is the id of the edge, if the client wishes to maintain this.
[ "Adds", "an", "edge", "to", "the", "graph", ".", "The", "nodes", "will", "be", "added", "if", "they", "don", "t", "exist", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Graph.py#L39-L53
train
bram85/topydo
topydo/lib/Graph.py
DirectedGraph.reachable_nodes
def reachable_nodes(self, p_id, p_recursive=True, p_reverse=False): """ Returns the set of all neighbors that the given node can reach. If recursive, it will also return the neighbor's neighbors, etc. If reverse, the arrows are reversed and then the reachable neighbors are locat...
python
def reachable_nodes(self, p_id, p_recursive=True, p_reverse=False): """ Returns the set of all neighbors that the given node can reach. If recursive, it will also return the neighbor's neighbors, etc. If reverse, the arrows are reversed and then the reachable neighbors are locat...
[ "def", "reachable_nodes", "(", "self", ",", "p_id", ",", "p_recursive", "=", "True", ",", "p_reverse", "=", "False", ")", ":", "stack", "=", "[", "p_id", "]", "visited", "=", "set", "(", ")", "result", "=", "set", "(", ")", "while", "len", "(", "st...
Returns the set of all neighbors that the given node can reach. If recursive, it will also return the neighbor's neighbors, etc. If reverse, the arrows are reversed and then the reachable neighbors are located.
[ "Returns", "the", "set", "of", "all", "neighbors", "that", "the", "given", "node", "can", "reach", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Graph.py#L73-L106
train
bram85/topydo
topydo/lib/Graph.py
DirectedGraph.reachable_nodes_reverse
def reachable_nodes_reverse(self, p_id, p_recursive=True): """ Find neighbors in the inverse graph. """ return self.reachable_nodes(p_id, p_recursive, True)
python
def reachable_nodes_reverse(self, p_id, p_recursive=True): """ Find neighbors in the inverse graph. """ return self.reachable_nodes(p_id, p_recursive, True)
[ "def", "reachable_nodes_reverse", "(", "self", ",", "p_id", ",", "p_recursive", "=", "True", ")", ":", "return", "self", ".", "reachable_nodes", "(", "p_id", ",", "p_recursive", ",", "True", ")" ]
Find neighbors in the inverse graph.
[ "Find", "neighbors", "in", "the", "inverse", "graph", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Graph.py#L108-L110
train
bram85/topydo
topydo/lib/Graph.py
DirectedGraph.remove_node
def remove_node(self, p_id, remove_unconnected_nodes=True): """ Removes a node from the graph. """ if self.has_node(p_id): for neighbor in self.incoming_neighbors(p_id): self._edges[neighbor].remove(p_id) neighbors = set() if remove_unconnected_nodes:...
python
def remove_node(self, p_id, remove_unconnected_nodes=True): """ Removes a node from the graph. """ if self.has_node(p_id): for neighbor in self.incoming_neighbors(p_id): self._edges[neighbor].remove(p_id) neighbors = set() if remove_unconnected_nodes:...
[ "def", "remove_node", "(", "self", ",", "p_id", ",", "remove_unconnected_nodes", "=", "True", ")", ":", "if", "self", ".", "has_node", "(", "p_id", ")", ":", "for", "neighbor", "in", "self", ".", "incoming_neighbors", "(", "p_id", ")", ":", "self", ".", ...
Removes a node from the graph.
[ "Removes", "a", "node", "from", "the", "graph", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Graph.py#L112-L126
train
bram85/topydo
topydo/lib/Graph.py
DirectedGraph.is_isolated
def is_isolated(self, p_id): """ Returns True iff the given node has no incoming or outgoing edges. """ return(len(self.incoming_neighbors(p_id)) == 0 and len(self.outgoing_neighbors(p_id)) == 0)
python
def is_isolated(self, p_id): """ Returns True iff the given node has no incoming or outgoing edges. """ return(len(self.incoming_neighbors(p_id)) == 0 and len(self.outgoing_neighbors(p_id)) == 0)
[ "def", "is_isolated", "(", "self", ",", "p_id", ")", ":", "return", "(", "len", "(", "self", ".", "incoming_neighbors", "(", "p_id", ")", ")", "==", "0", "and", "len", "(", "self", ".", "outgoing_neighbors", "(", "p_id", ")", ")", "==", "0", ")" ]
Returns True iff the given node has no incoming or outgoing edges.
[ "Returns", "True", "iff", "the", "given", "node", "has", "no", "incoming", "or", "outgoing", "edges", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Graph.py#L128-L133
train
bram85/topydo
topydo/lib/Graph.py
DirectedGraph.has_edge
def has_edge(self, p_from, p_to): """ Returns True when the graph has the given edge. """ return p_from in self._edges and p_to in self._edges[p_from]
python
def has_edge(self, p_from, p_to): """ Returns True when the graph has the given edge. """ return p_from in self._edges and p_to in self._edges[p_from]
[ "def", "has_edge", "(", "self", ",", "p_from", ",", "p_to", ")", ":", "return", "p_from", "in", "self", ".", "_edges", "and", "p_to", "in", "self", ".", "_edges", "[", "p_from", "]" ]
Returns True when the graph has the given edge.
[ "Returns", "True", "when", "the", "graph", "has", "the", "given", "edge", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Graph.py#L135-L137
train
bram85/topydo
topydo/lib/Graph.py
DirectedGraph.remove_edge
def remove_edge(self, p_from, p_to, p_remove_unconnected_nodes=True): """ Removes an edge from the graph. When remove_unconnected_nodes is True, then the nodes are also removed if they become isolated. """ if self.has_edge(p_from, p_to): self._edges[p_from].r...
python
def remove_edge(self, p_from, p_to, p_remove_unconnected_nodes=True): """ Removes an edge from the graph. When remove_unconnected_nodes is True, then the nodes are also removed if they become isolated. """ if self.has_edge(p_from, p_to): self._edges[p_from].r...
[ "def", "remove_edge", "(", "self", ",", "p_from", ",", "p_to", ",", "p_remove_unconnected_nodes", "=", "True", ")", ":", "if", "self", ".", "has_edge", "(", "p_from", ",", "p_to", ")", ":", "self", ".", "_edges", "[", "p_from", "]", ".", "remove", "(",...
Removes an edge from the graph. When remove_unconnected_nodes is True, then the nodes are also removed if they become isolated.
[ "Removes", "an", "edge", "from", "the", "graph", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Graph.py#L156-L176
train
bram85/topydo
topydo/lib/Graph.py
DirectedGraph.transitively_reduce
def transitively_reduce(self): """ Performs a transitive reduction on the graph. """ removals = set() for from_node, neighbors in self._edges.items(): childpairs = \ [(c1, c2) for c1 in neighbors for c2 in neighbors if c1 != c2] for child...
python
def transitively_reduce(self): """ Performs a transitive reduction on the graph. """ removals = set() for from_node, neighbors in self._edges.items(): childpairs = \ [(c1, c2) for c1 in neighbors for c2 in neighbors if c1 != c2] for child...
[ "def", "transitively_reduce", "(", "self", ")", ":", "removals", "=", "set", "(", ")", "for", "from_node", ",", "neighbors", "in", "self", ".", "_edges", ".", "items", "(", ")", ":", "childpairs", "=", "[", "(", "c1", ",", "c2", ")", "for", "c1", "...
Performs a transitive reduction on the graph.
[ "Performs", "a", "transitive", "reduction", "on", "the", "graph", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Graph.py#L178-L194
train
bram85/topydo
topydo/lib/Graph.py
DirectedGraph.dot
def dot(self, p_print_labels=True): """ Prints the graph in Dot format. """ out = 'digraph g {\n' for from_node, neighbors in sorted(self._edges.items()): out += " {}\n".format(from_node) for neighbor in sorted(neighbors): out += " {} -> {}".format(fro...
python
def dot(self, p_print_labels=True): """ Prints the graph in Dot format. """ out = 'digraph g {\n' for from_node, neighbors in sorted(self._edges.items()): out += " {}\n".format(from_node) for neighbor in sorted(neighbors): out += " {} -> {}".format(fro...
[ "def", "dot", "(", "self", ",", "p_print_labels", "=", "True", ")", ":", "out", "=", "'digraph g {\\n'", "for", "from_node", ",", "neighbors", "in", "sorted", "(", "self", ".", "_edges", ".", "items", "(", ")", ")", ":", "out", "+=", "\" {}\\n\"", "."...
Prints the graph in Dot format.
[ "Prints", "the", "graph", "in", "Dot", "format", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Graph.py#L196-L213
train
bram85/topydo
topydo/commands/ListCommand.py
ListCommand._print
def _print(self): """ Prints the todos in the right format. Defaults to normal text output (with possible colors and other pretty printing). If a format was specified on the commandline, this format is sent to the output. """ if self.printer is None: ...
python
def _print(self): """ Prints the todos in the right format. Defaults to normal text output (with possible colors and other pretty printing). If a format was specified on the commandline, this format is sent to the output. """ if self.printer is None: ...
[ "def", "_print", "(", "self", ")", ":", "if", "self", ".", "printer", "is", "None", ":", "# create a standard printer with some filters", "indent", "=", "config", "(", ")", ".", "list_indent", "(", ")", "final_format", "=", "' '", "*", "indent", "+", "self",...
Prints the todos in the right format. Defaults to normal text output (with possible colors and other pretty printing). If a format was specified on the commandline, this format is sent to the output.
[ "Prints", "the", "todos", "in", "the", "right", "format", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/commands/ListCommand.py#L134-L159
train
bram85/topydo
topydo/lib/TodoParser.py
parse_line
def parse_line(p_string): """ Parses a single line as can be encountered in a todo.txt file. First checks whether the standard elements are present, such as priority, creation date, completeness check and the completion date. Then the rest of the analyzed for any occurrences of contexts, projects o...
python
def parse_line(p_string): """ Parses a single line as can be encountered in a todo.txt file. First checks whether the standard elements are present, such as priority, creation date, completeness check and the completion date. Then the rest of the analyzed for any occurrences of contexts, projects o...
[ "def", "parse_line", "(", "p_string", ")", ":", "result", "=", "{", "'completed'", ":", "False", ",", "'completionDate'", ":", "None", ",", "'priority'", ":", "None", ",", "'creationDate'", ":", "None", ",", "'text'", ":", "\"\"", ",", "'projects'", ":", ...
Parses a single line as can be encountered in a todo.txt file. First checks whether the standard elements are present, such as priority, creation date, completeness check and the completion date. Then the rest of the analyzed for any occurrences of contexts, projects or tags. Returns an dictionary...
[ "Parses", "a", "single", "line", "as", "can", "be", "encountered", "in", "a", "todo", ".", "txt", "file", ".", "First", "checks", "whether", "the", "standard", "elements", "are", "present", "such", "as", "priority", "creation", "date", "completeness", "check...
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoParser.py#L41-L120
train
bram85/topydo
topydo/ui/prompt/PromptCompleter.py
_dates
def _dates(p_word_before_cursor): """ Generator for date completion. """ to_absolute = lambda s: relative_date_to_date(s).isoformat() start_value_pos = p_word_before_cursor.find(':') + 1 value = p_word_before_cursor[start_value_pos:] for reldate in date_suggestions(): if not reldate.starts...
python
def _dates(p_word_before_cursor): """ Generator for date completion. """ to_absolute = lambda s: relative_date_to_date(s).isoformat() start_value_pos = p_word_before_cursor.find(':') + 1 value = p_word_before_cursor[start_value_pos:] for reldate in date_suggestions(): if not reldate.starts...
[ "def", "_dates", "(", "p_word_before_cursor", ")", ":", "to_absolute", "=", "lambda", "s", ":", "relative_date_to_date", "(", "s", ")", ".", "isoformat", "(", ")", "start_value_pos", "=", "p_word_before_cursor", ".", "find", "(", "':'", ")", "+", "1", "value...
Generator for date completion.
[ "Generator", "for", "date", "completion", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/prompt/PromptCompleter.py#L31-L42
train
bram85/topydo
topydo/ui/columns/CompletionBoxWidget.py
CompletionBoxWidget.add_completions
def add_completions(self, p_completions): """ Creates proper urwid.Text widgets for all completion candidates from p_completions list, and populates them into the items attribute. """ palette = PaletteItem.MARKED for completion in p_completions: width = len(co...
python
def add_completions(self, p_completions): """ Creates proper urwid.Text widgets for all completion candidates from p_completions list, and populates them into the items attribute. """ palette = PaletteItem.MARKED for completion in p_completions: width = len(co...
[ "def", "add_completions", "(", "self", ",", "p_completions", ")", ":", "palette", "=", "PaletteItem", ".", "MARKED", "for", "completion", "in", "p_completions", ":", "width", "=", "len", "(", "completion", ")", "if", "width", ">", "self", ".", "min_width", ...
Creates proper urwid.Text widgets for all completion candidates from p_completions list, and populates them into the items attribute.
[ "Creates", "proper", "urwid", ".", "Text", "widgets", "for", "all", "completion", "candidates", "from", "p_completions", "list", "and", "populates", "them", "into", "the", "items", "attribute", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/CompletionBoxWidget.py#L44-L56
train
bram85/topydo
topydo/lib/View.py
View._apply_filters
def _apply_filters(self, p_todos): """ Applies the filters to the list of todo items. """ result = p_todos for _filter in sorted(self._filters, key=lambda f: f.order): result = _filter.filter(result) return result
python
def _apply_filters(self, p_todos): """ Applies the filters to the list of todo items. """ result = p_todos for _filter in sorted(self._filters, key=lambda f: f.order): result = _filter.filter(result) return result
[ "def", "_apply_filters", "(", "self", ",", "p_todos", ")", ":", "result", "=", "p_todos", "for", "_filter", "in", "sorted", "(", "self", ".", "_filters", ",", "key", "=", "lambda", "f", ":", "f", ".", "order", ")", ":", "result", "=", "_filter", ".",...
Applies the filters to the list of todo items.
[ "Applies", "the", "filters", "to", "the", "list", "of", "todo", "items", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/View.py#L32-L39
train
bram85/topydo
topydo/lib/View.py
View.todos
def todos(self): """ Returns a sorted and filtered list of todos in this view. """ result = self._sorter.sort(self.todolist.todos()) return self._apply_filters(result)
python
def todos(self): """ Returns a sorted and filtered list of todos in this view. """ result = self._sorter.sort(self.todolist.todos()) return self._apply_filters(result)
[ "def", "todos", "(", "self", ")", ":", "result", "=", "self", ".", "_sorter", ".", "sort", "(", "self", ".", "todolist", ".", "todos", "(", ")", ")", "return", "self", ".", "_apply_filters", "(", "result", ")" ]
Returns a sorted and filtered list of todos in this view.
[ "Returns", "a", "sorted", "and", "filtered", "list", "of", "todos", "in", "this", "view", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/View.py#L42-L45
train
bram85/topydo
topydo/commands/DoCommand.py
DoCommand.execute_specific
def execute_specific(self, p_todo): """ Actions specific to this command. """ self._handle_recurrence(p_todo) self.execute_specific_core(p_todo) printer = PrettyPrinter() self.out(self.prefix() + printer.print_todo(p_todo))
python
def execute_specific(self, p_todo): """ Actions specific to this command. """ self._handle_recurrence(p_todo) self.execute_specific_core(p_todo) printer = PrettyPrinter() self.out(self.prefix() + printer.print_todo(p_todo))
[ "def", "execute_specific", "(", "self", ",", "p_todo", ")", ":", "self", ".", "_handle_recurrence", "(", "p_todo", ")", "self", ".", "execute_specific_core", "(", "p_todo", ")", "printer", "=", "PrettyPrinter", "(", ")", "self", ".", "out", "(", "self", "....
Actions specific to this command.
[ "Actions", "specific", "to", "this", "command", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/commands/DoCommand.py#L81-L87
train
bram85/topydo
topydo/lib/Utils.py
date_string_to_date
def date_string_to_date(p_date): """ Given a date in YYYY-MM-DD, returns a Python date object. Throws a ValueError if the date is invalid. """ result = None if p_date: parsed_date = re.match(r'(\d{4})-(\d{2})-(\d{2})', p_date) if parsed_date: result = date( ...
python
def date_string_to_date(p_date): """ Given a date in YYYY-MM-DD, returns a Python date object. Throws a ValueError if the date is invalid. """ result = None if p_date: parsed_date = re.match(r'(\d{4})-(\d{2})-(\d{2})', p_date) if parsed_date: result = date( ...
[ "def", "date_string_to_date", "(", "p_date", ")", ":", "result", "=", "None", "if", "p_date", ":", "parsed_date", "=", "re", ".", "match", "(", "r'(\\d{4})-(\\d{2})-(\\d{2})'", ",", "p_date", ")", "if", "parsed_date", ":", "result", "=", "date", "(", "int", ...
Given a date in YYYY-MM-DD, returns a Python date object. Throws a ValueError if the date is invalid.
[ "Given", "a", "date", "in", "YYYY", "-", "MM", "-", "DD", "returns", "a", "Python", "date", "object", ".", "Throws", "a", "ValueError", "if", "the", "date", "is", "invalid", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Utils.py#L28-L46
train
bram85/topydo
topydo/lib/Utils.py
get_terminal_size
def get_terminal_size(p_getter=None): """ Try to determine terminal size at run time. If that is not possible, returns the default size of 80x24. By default, the size is determined with provided get_terminal_size by shutil. Sometimes an UI may want to specify the desired width, then it can prov...
python
def get_terminal_size(p_getter=None): """ Try to determine terminal size at run time. If that is not possible, returns the default size of 80x24. By default, the size is determined with provided get_terminal_size by shutil. Sometimes an UI may want to specify the desired width, then it can prov...
[ "def", "get_terminal_size", "(", "p_getter", "=", "None", ")", ":", "try", ":", "return", "get_terminal_size", ".", "getter", "(", ")", "except", "AttributeError", ":", "if", "p_getter", ":", "get_terminal_size", ".", "getter", "=", "p_getter", "else", ":", ...
Try to determine terminal size at run time. If that is not possible, returns the default size of 80x24. By default, the size is determined with provided get_terminal_size by shutil. Sometimes an UI may want to specify the desired width, then it can provide a getter that returns a named tuple (columns, ...
[ "Try", "to", "determine", "terminal", "size", "at", "run", "time", ".", "If", "that", "is", "not", "possible", "returns", "the", "default", "size", "of", "80x24", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Utils.py#L59-L95
train
bram85/topydo
topydo/lib/Utils.py
translate_key_to_config
def translate_key_to_config(p_key): """ Translates urwid key event to form understandable by topydo config parser. """ if len(p_key) > 1: key = p_key.capitalize() if key.startswith('Ctrl') or key.startswith('Meta'): key = key[0] + '-' + key[5:] key = '<' + key + '>' ...
python
def translate_key_to_config(p_key): """ Translates urwid key event to form understandable by topydo config parser. """ if len(p_key) > 1: key = p_key.capitalize() if key.startswith('Ctrl') or key.startswith('Meta'): key = key[0] + '-' + key[5:] key = '<' + key + '>' ...
[ "def", "translate_key_to_config", "(", "p_key", ")", ":", "if", "len", "(", "p_key", ")", ">", "1", ":", "key", "=", "p_key", ".", "capitalize", "(", ")", "if", "key", ".", "startswith", "(", "'Ctrl'", ")", "or", "key", ".", "startswith", "(", "'Meta...
Translates urwid key event to form understandable by topydo config parser.
[ "Translates", "urwid", "key", "event", "to", "form", "understandable", "by", "topydo", "config", "parser", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Utils.py#L98-L110
train
bram85/topydo
topydo/lib/Utils.py
humanize_date
def humanize_date(p_datetime): """ Returns a relative date string from a datetime object. """ now = arrow.now() _date = now.replace(day=p_datetime.day, month=p_datetime.month, year=p_datetime.year) return _date.humanize(now).replace('just now', 'today')
python
def humanize_date(p_datetime): """ Returns a relative date string from a datetime object. """ now = arrow.now() _date = now.replace(day=p_datetime.day, month=p_datetime.month, year=p_datetime.year) return _date.humanize(now).replace('just now', 'today')
[ "def", "humanize_date", "(", "p_datetime", ")", ":", "now", "=", "arrow", ".", "now", "(", ")", "_date", "=", "now", ".", "replace", "(", "day", "=", "p_datetime", ".", "day", ",", "month", "=", "p_datetime", ".", "month", ",", "year", "=", "p_dateti...
Returns a relative date string from a datetime object.
[ "Returns", "a", "relative", "date", "string", "from", "a", "datetime", "object", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Utils.py#L112-L116
train
bram85/topydo
topydo/ui/columns/Main.py
UIApplication._check_id_validity
def _check_id_validity(self, p_ids): """ Checks if there are any invalid todo IDs in p_ids list. Returns proper error message if any ID is invalid and None otherwise. """ errors = [] valid_ids = self.todolist.ids() if len(p_ids) == 0: errors.append('...
python
def _check_id_validity(self, p_ids): """ Checks if there are any invalid todo IDs in p_ids list. Returns proper error message if any ID is invalid and None otherwise. """ errors = [] valid_ids = self.todolist.ids() if len(p_ids) == 0: errors.append('...
[ "def", "_check_id_validity", "(", "self", ",", "p_ids", ")", ":", "errors", "=", "[", "]", "valid_ids", "=", "self", ".", "todolist", ".", "ids", "(", ")", "if", "len", "(", "p_ids", ")", "==", "0", ":", "errors", ".", "append", "(", "'No todo item w...
Checks if there are any invalid todo IDs in p_ids list. Returns proper error message if any ID is invalid and None otherwise.
[ "Checks", "if", "there", "are", "any", "invalid", "todo", "IDs", "in", "p_ids", "list", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/Main.py#L286-L302
train
bram85/topydo
topydo/ui/columns/Main.py
UIApplication._execute_handler
def _execute_handler(self, p_command, p_todo_id=None, p_output=None): """ Executes a command, given as a string. """ p_output = p_output or self._output self._console_visible = False self._last_cmd = (p_command, p_output == self._output) try: p_comma...
python
def _execute_handler(self, p_command, p_todo_id=None, p_output=None): """ Executes a command, given as a string. """ p_output = p_output or self._output self._console_visible = False self._last_cmd = (p_command, p_output == self._output) try: p_comma...
[ "def", "_execute_handler", "(", "self", ",", "p_command", ",", "p_todo_id", "=", "None", ",", "p_output", "=", "None", ")", ":", "p_output", "=", "p_output", "or", "self", ".", "_output", "self", ".", "_console_visible", "=", "False", "self", ".", "_last_c...
Executes a command, given as a string.
[ "Executes", "a", "command", "given", "as", "a", "string", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/Main.py#L304-L359
train
bram85/topydo
topydo/ui/columns/Main.py
UIApplication._viewdata_to_view
def _viewdata_to_view(self, p_data): """ Converts a dictionary describing a view to an actual UIView instance. """ sorter = Sorter(p_data['sortexpr'], p_data['groupexpr']) filters = [] if not p_data['show_all']: filters.append(DependencyFilter(self.todolist))...
python
def _viewdata_to_view(self, p_data): """ Converts a dictionary describing a view to an actual UIView instance. """ sorter = Sorter(p_data['sortexpr'], p_data['groupexpr']) filters = [] if not p_data['show_all']: filters.append(DependencyFilter(self.todolist))...
[ "def", "_viewdata_to_view", "(", "self", ",", "p_data", ")", ":", "sorter", "=", "Sorter", "(", "p_data", "[", "'sortexpr'", "]", ",", "p_data", "[", "'groupexpr'", "]", ")", "filters", "=", "[", "]", "if", "not", "p_data", "[", "'show_all'", "]", ":",...
Converts a dictionary describing a view to an actual UIView instance.
[ "Converts", "a", "dictionary", "describing", "a", "view", "to", "an", "actual", "UIView", "instance", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/Main.py#L479-L493
train
bram85/topydo
topydo/ui/columns/Main.py
UIApplication._update_view
def _update_view(self, p_data): """ Creates a view from the data entered in the view widget. """ view = self._viewdata_to_view(p_data) if self.column_mode == _APPEND_COLUMN or self.column_mode == _COPY_COLUMN: self._add_column(view) elif self.column_mode == _INSERT_COLUMN: ...
python
def _update_view(self, p_data): """ Creates a view from the data entered in the view widget. """ view = self._viewdata_to_view(p_data) if self.column_mode == _APPEND_COLUMN or self.column_mode == _COPY_COLUMN: self._add_column(view) elif self.column_mode == _INSERT_COLUMN: ...
[ "def", "_update_view", "(", "self", ",", "p_data", ")", ":", "view", "=", "self", ".", "_viewdata_to_view", "(", "p_data", ")", "if", "self", ".", "column_mode", "==", "_APPEND_COLUMN", "or", "self", ".", "column_mode", "==", "_COPY_COLUMN", ":", "self", "...
Creates a view from the data entered in the view widget.
[ "Creates", "a", "view", "from", "the", "data", "entered", "in", "the", "view", "widget", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/Main.py#L495-L510
train
bram85/topydo
topydo/ui/columns/Main.py
UIApplication._add_column
def _add_column(self, p_view, p_pos=None): """ Given an UIView, adds a new column widget with the todos in that view. When no position is given, it is added to the end, otherwise inserted before that position. """ def execute_silent(p_cmd, p_todo_id=None): se...
python
def _add_column(self, p_view, p_pos=None): """ Given an UIView, adds a new column widget with the todos in that view. When no position is given, it is added to the end, otherwise inserted before that position. """ def execute_silent(p_cmd, p_todo_id=None): se...
[ "def", "_add_column", "(", "self", ",", "p_view", ",", "p_pos", "=", "None", ")", ":", "def", "execute_silent", "(", "p_cmd", ",", "p_todo_id", "=", "None", ")", ":", "self", ".", "_execute_handler", "(", "p_cmd", ",", "p_todo_id", ",", "lambda", "_", ...
Given an UIView, adds a new column widget with the todos in that view. When no position is given, it is added to the end, otherwise inserted before that position.
[ "Given", "an", "UIView", "adds", "a", "new", "column", "widget", "with", "the", "todos", "in", "that", "view", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/Main.py#L512-L549
train
bram85/topydo
topydo/ui/columns/Main.py
UIApplication._process_mark_toggle
def _process_mark_toggle(self, p_todo_id, p_force=None): """ Adds p_todo_id to marked_todos attribute and returns True if p_todo_id is not already marked. Removes p_todo_id from marked_todos and returns False otherwise. p_force parameter accepting 'mark' or 'unmark' values, if s...
python
def _process_mark_toggle(self, p_todo_id, p_force=None): """ Adds p_todo_id to marked_todos attribute and returns True if p_todo_id is not already marked. Removes p_todo_id from marked_todos and returns False otherwise. p_force parameter accepting 'mark' or 'unmark' values, if s...
[ "def", "_process_mark_toggle", "(", "self", ",", "p_todo_id", ",", "p_force", "=", "None", ")", ":", "if", "p_force", "in", "[", "'mark'", ",", "'unmark'", "]", ":", "action", "=", "p_force", "else", ":", "action", "=", "'mark'", "if", "p_todo_id", "not"...
Adds p_todo_id to marked_todos attribute and returns True if p_todo_id is not already marked. Removes p_todo_id from marked_todos and returns False otherwise. p_force parameter accepting 'mark' or 'unmark' values, if set, can force desired action without checking p_todo_id presence in m...
[ "Adds", "p_todo_id", "to", "marked_todos", "attribute", "and", "returns", "True", "if", "p_todo_id", "is", "not", "already", "marked", ".", "Removes", "p_todo_id", "from", "marked_todos", "and", "returns", "False", "otherwise", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/Main.py#L683-L702
train
bram85/topydo
topydo/ui/columns/ViewWidget.py
ViewWidget.reset
def reset(self): """ Resets the form. """ self.titleedit.set_edit_text("") self.sortedit.set_edit_text("") self.filteredit.set_edit_text("") self.relevantradio.set_state(True) self.pile.focus_item = 0
python
def reset(self): """ Resets the form. """ self.titleedit.set_edit_text("") self.sortedit.set_edit_text("") self.filteredit.set_edit_text("") self.relevantradio.set_state(True) self.pile.focus_item = 0
[ "def", "reset", "(", "self", ")", ":", "self", ".", "titleedit", ".", "set_edit_text", "(", "\"\"", ")", "self", ".", "sortedit", ".", "set_edit_text", "(", "\"\"", ")", "self", ".", "filteredit", ".", "set_edit_text", "(", "\"\"", ")", "self", ".", "r...
Resets the form.
[ "Resets", "the", "form", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/ViewWidget.py#L71-L77
train
bram85/topydo
topydo/lib/TodoBase.py
TodoBase.has_tag
def has_tag(self, p_key, p_value=""): """ Returns true when there is at least one tag with the given key. If a value is passed, it will only return true when there exists a tag with the given key-value combination. """ tags = self.fields['tags'] return p_key in ta...
python
def has_tag(self, p_key, p_value=""): """ Returns true when there is at least one tag with the given key. If a value is passed, it will only return true when there exists a tag with the given key-value combination. """ tags = self.fields['tags'] return p_key in ta...
[ "def", "has_tag", "(", "self", ",", "p_key", ",", "p_value", "=", "\"\"", ")", ":", "tags", "=", "self", ".", "fields", "[", "'tags'", "]", "return", "p_key", "in", "tags", "and", "(", "p_value", "==", "\"\"", "or", "p_value", "in", "tags", "[", "p...
Returns true when there is at least one tag with the given key. If a value is passed, it will only return true when there exists a tag with the given key-value combination.
[ "Returns", "true", "when", "there", "is", "at", "least", "one", "tag", "with", "the", "given", "key", ".", "If", "a", "value", "is", "passed", "it", "will", "only", "return", "true", "when", "there", "exists", "a", "tag", "with", "the", "given", "key",...
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoBase.py#L60-L67
train
bram85/topydo
topydo/lib/TodoBase.py
TodoBase._remove_tag_helper
def _remove_tag_helper(self, p_key, p_value): """ Removes a tag from the internal todo dictionary. Only those instances with the given value are removed. If the value is empty, all tags with the given key are removed. """ tags = self.fields['tags'] try: ...
python
def _remove_tag_helper(self, p_key, p_value): """ Removes a tag from the internal todo dictionary. Only those instances with the given value are removed. If the value is empty, all tags with the given key are removed. """ tags = self.fields['tags'] try: ...
[ "def", "_remove_tag_helper", "(", "self", ",", "p_key", ",", "p_value", ")", ":", "tags", "=", "self", ".", "fields", "[", "'tags'", "]", "try", ":", "tags", "[", "p_key", "]", "=", "[", "t", "for", "t", "in", "tags", "[", "p_key", "]", "if", "p_...
Removes a tag from the internal todo dictionary. Only those instances with the given value are removed. If the value is empty, all tags with the given key are removed.
[ "Removes", "a", "tag", "from", "the", "internal", "todo", "dictionary", ".", "Only", "those", "instances", "with", "the", "given", "value", "are", "removed", ".", "If", "the", "value", "is", "empty", "all", "tags", "with", "the", "given", "key", "are", "...
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoBase.py#L73-L86
train
bram85/topydo
topydo/lib/TodoBase.py
TodoBase.set_tag
def set_tag(self, p_key, p_value="", p_force_add=False, p_old_value=""): """ Sets a occurrence of the tag identified by p_key. Sets an arbitrary instance of the tag when the todo contains multiple tags with this key. When p_key does not exist, the tag is added. When p_value is n...
python
def set_tag(self, p_key, p_value="", p_force_add=False, p_old_value=""): """ Sets a occurrence of the tag identified by p_key. Sets an arbitrary instance of the tag when the todo contains multiple tags with this key. When p_key does not exist, the tag is added. When p_value is n...
[ "def", "set_tag", "(", "self", ",", "p_key", ",", "p_value", "=", "\"\"", ",", "p_force_add", "=", "False", ",", "p_old_value", "=", "\"\"", ")", ":", "if", "p_value", "==", "\"\"", ":", "self", ".", "remove_tag", "(", "p_key", ",", "p_old_value", ")",...
Sets a occurrence of the tag identified by p_key. Sets an arbitrary instance of the tag when the todo contains multiple tags with this key. When p_key does not exist, the tag is added. When p_value is not set, the tag will be removed. When p_force_add is true, a tag will always be adde...
[ "Sets", "a", "occurrence", "of", "the", "tag", "identified", "by", "p_key", ".", "Sets", "an", "arbitrary", "instance", "of", "the", "tag", "when", "the", "todo", "contains", "multiple", "tags", "with", "this", "key", ".", "When", "p_key", "does", "not", ...
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoBase.py#L88-L123
train
bram85/topydo
topydo/lib/TodoBase.py
TodoBase.tags
def tags(self): """ Returns a list of tuples with key-value pairs representing tags in this todo item. """ tags = self.fields['tags'] return [(t, v) for t in tags for v in tags[t]]
python
def tags(self): """ Returns a list of tuples with key-value pairs representing tags in this todo item. """ tags = self.fields['tags'] return [(t, v) for t in tags for v in tags[t]]
[ "def", "tags", "(", "self", ")", ":", "tags", "=", "self", ".", "fields", "[", "'tags'", "]", "return", "[", "(", "t", ",", "v", ")", "for", "t", "in", "tags", "for", "v", "in", "tags", "[", "t", "]", "]" ]
Returns a list of tuples with key-value pairs representing tags in this todo item.
[ "Returns", "a", "list", "of", "tuples", "with", "key", "-", "value", "pairs", "representing", "tags", "in", "this", "todo", "item", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoBase.py#L138-L144
train
bram85/topydo
topydo/lib/TodoBase.py
TodoBase.set_source_text
def set_source_text(self, p_text): """ Sets the todo source text. The text will be parsed again. """ self.src = p_text.strip() self.fields = parse_line(self.src)
python
def set_source_text(self, p_text): """ Sets the todo source text. The text will be parsed again. """ self.src = p_text.strip() self.fields = parse_line(self.src)
[ "def", "set_source_text", "(", "self", ",", "p_text", ")", ":", "self", ".", "src", "=", "p_text", ".", "strip", "(", ")", "self", ".", "fields", "=", "parse_line", "(", "self", ".", "src", ")" ]
Sets the todo source text. The text will be parsed again.
[ "Sets", "the", "todo", "source", "text", ".", "The", "text", "will", "be", "parsed", "again", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoBase.py#L177-L180
train
bram85/topydo
topydo/lib/TodoBase.py
TodoBase.set_completed
def set_completed(self, p_completion_date=date.today()): """ Marks the todo as complete. Sets the completed flag and sets the completion date to today. """ if not self.is_completed(): self.set_priority(None) self.fields['completed'] = True sel...
python
def set_completed(self, p_completion_date=date.today()): """ Marks the todo as complete. Sets the completed flag and sets the completion date to today. """ if not self.is_completed(): self.set_priority(None) self.fields['completed'] = True sel...
[ "def", "set_completed", "(", "self", ",", "p_completion_date", "=", "date", ".", "today", "(", ")", ")", ":", "if", "not", "self", ".", "is_completed", "(", ")", ":", "self", ".", "set_priority", "(", "None", ")", "self", ".", "fields", "[", "'complete...
Marks the todo as complete. Sets the completed flag and sets the completion date to today.
[ "Marks", "the", "todo", "as", "complete", ".", "Sets", "the", "completed", "flag", "and", "sets", "the", "completion", "date", "to", "today", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoBase.py#L201-L214
train
bram85/topydo
topydo/lib/TodoBase.py
TodoBase.set_creation_date
def set_creation_date(self, p_date=date.today()): """ Sets the creation date of a todo. Should be passed a date object. """ self.fields['creationDate'] = p_date # not particularly pretty, but inspired by # http://bugs.python.org/issue1519638 non-existent matches trigger ...
python
def set_creation_date(self, p_date=date.today()): """ Sets the creation date of a todo. Should be passed a date object. """ self.fields['creationDate'] = p_date # not particularly pretty, but inspired by # http://bugs.python.org/issue1519638 non-existent matches trigger ...
[ "def", "set_creation_date", "(", "self", ",", "p_date", "=", "date", ".", "today", "(", ")", ")", ":", "self", ".", "fields", "[", "'creationDate'", "]", "=", "p_date", "# not particularly pretty, but inspired by", "# http://bugs.python.org/issue1519638 non-existent mat...
Sets the creation date of a todo. Should be passed a date object.
[ "Sets", "the", "creation", "date", "of", "a", "todo", ".", "Should", "be", "passed", "a", "date", "object", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoBase.py#L216-L229
train
bram85/topydo
topydo/ui/columns/TodoListWidget.py
TodoListWidget.update
def update(self): """ Updates the todo list according to the todos in the view associated with this list. """ old_focus_position = self.todolist.focus id_length = max_id_length(self.view.todolist.count()) del self.todolist[:] for group, todos in self.vie...
python
def update(self): """ Updates the todo list according to the todos in the view associated with this list. """ old_focus_position = self.todolist.focus id_length = max_id_length(self.view.todolist.count()) del self.todolist[:] for group, todos in self.vie...
[ "def", "update", "(", "self", ")", ":", "old_focus_position", "=", "self", ".", "todolist", ".", "focus", "id_length", "=", "max_id_length", "(", "self", ".", "view", ".", "todolist", ".", "count", "(", ")", ")", "del", "self", ".", "todolist", "[", ":...
Updates the todo list according to the todos in the view associated with this list.
[ "Updates", "the", "todo", "list", "according", "to", "the", "todos", "in", "the", "view", "associated", "with", "this", "list", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/TodoListWidget.py#L87-L115
train
bram85/topydo
topydo/ui/columns/TodoListWidget.py
TodoListWidget._execute_on_selected
def _execute_on_selected(self, p_cmd_str, p_execute_signal): """ Executes command specified by p_cmd_str on selected todo item. p_cmd_str should be a string with one replacement field ('{}') which will be substituted by id of the selected todo item. p_execute_signal is the sign...
python
def _execute_on_selected(self, p_cmd_str, p_execute_signal): """ Executes command specified by p_cmd_str on selected todo item. p_cmd_str should be a string with one replacement field ('{}') which will be substituted by id of the selected todo item. p_execute_signal is the sign...
[ "def", "_execute_on_selected", "(", "self", ",", "p_cmd_str", ",", "p_execute_signal", ")", ":", "try", ":", "todo", "=", "self", ".", "listbox", ".", "focus", ".", "todo", "todo_id", "=", "str", "(", "self", ".", "view", ".", "todolist", ".", "number", ...
Executes command specified by p_cmd_str on selected todo item. p_cmd_str should be a string with one replacement field ('{}') which will be substituted by id of the selected todo item. p_execute_signal is the signal name passed to the main loop. It should be one of 'execute_command' or...
[ "Executes", "command", "specified", "by", "p_cmd_str", "on", "selected", "todo", "item", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/TodoListWidget.py#L233-L254
train
bram85/topydo
topydo/ui/columns/TodoListWidget.py
TodoListWidget.execute_builtin_action
def execute_builtin_action(self, p_action_str, p_size=None): """ Executes built-in action specified in p_action_str. Currently supported actions are: 'up', 'down', 'home', 'end', 'first_column', 'last_column', 'prev_column', 'next_column', 'append_column', 'insert_column', 'edit...
python
def execute_builtin_action(self, p_action_str, p_size=None): """ Executes built-in action specified in p_action_str. Currently supported actions are: 'up', 'down', 'home', 'end', 'first_column', 'last_column', 'prev_column', 'next_column', 'append_column', 'insert_column', 'edit...
[ "def", "execute_builtin_action", "(", "self", ",", "p_action_str", ",", "p_size", "=", "None", ")", ":", "column_actions", "=", "[", "'first_column'", ",", "'last_column'", ",", "'prev_column'", ",", "'next_column'", ",", "'append_column'", ",", "'insert_column'", ...
Executes built-in action specified in p_action_str. Currently supported actions are: 'up', 'down', 'home', 'end', 'first_column', 'last_column', 'prev_column', 'next_column', 'append_column', 'insert_column', 'edit_column', 'delete_column', 'copy_column', swap_right', 'swap_left', 'post...
[ "Executes", "built", "-", "in", "action", "specified", "in", "p_action_str", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/TodoListWidget.py#L277-L318
train
bram85/topydo
topydo/ui/columns/TodoListWidget.py
TodoListWidget._add_pending_action
def _add_pending_action(self, p_action, p_size): """ Creates action waiting for execution and forwards it to the mainloop. """ def generate_callback(): def callback(*args): self.resolve_action(p_action, p_size) self.keystate = None ...
python
def _add_pending_action(self, p_action, p_size): """ Creates action waiting for execution and forwards it to the mainloop. """ def generate_callback(): def callback(*args): self.resolve_action(p_action, p_size) self.keystate = None ...
[ "def", "_add_pending_action", "(", "self", ",", "p_action", ",", "p_size", ")", ":", "def", "generate_callback", "(", ")", ":", "def", "callback", "(", "*", "args", ")", ":", "self", ".", "resolve_action", "(", "p_action", ",", "p_size", ")", "self", "."...
Creates action waiting for execution and forwards it to the mainloop.
[ "Creates", "action", "waiting", "for", "execution", "and", "forwards", "it", "to", "the", "mainloop", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/TodoListWidget.py#L320-L331
train
bram85/topydo
topydo/lib/TodoFile.py
TodoFile.read
def read(self): """ Reads the todo.txt file and returns a list of todo items. """ todos = [] try: todofile = codecs.open(self.path, 'r', encoding="utf-8") todos = todofile.readlines() todofile.close() except IOError: pass return to...
python
def read(self): """ Reads the todo.txt file and returns a list of todo items. """ todos = [] try: todofile = codecs.open(self.path, 'r', encoding="utf-8") todos = todofile.readlines() todofile.close() except IOError: pass return to...
[ "def", "read", "(", "self", ")", ":", "todos", "=", "[", "]", "try", ":", "todofile", "=", "codecs", ".", "open", "(", "self", ".", "path", ",", "'r'", ",", "encoding", "=", "\"utf-8\"", ")", "todos", "=", "todofile", ".", "readlines", "(", ")", ...
Reads the todo.txt file and returns a list of todo items.
[ "Reads", "the", "todo", ".", "txt", "file", "and", "returns", "a", "list", "of", "todo", "items", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoFile.py#L34-L44
train
bram85/topydo
topydo/lib/TodoFile.py
TodoFile.write
def write(self, p_todos): """ Writes all the todo items to the todo.txt file. p_todos can be a list of todo items, or a string that is just written to the file. """ todofile = codecs.open(self.path, 'w', encoding="utf-8") if p_todos is list: for tod...
python
def write(self, p_todos): """ Writes all the todo items to the todo.txt file. p_todos can be a list of todo items, or a string that is just written to the file. """ todofile = codecs.open(self.path, 'w', encoding="utf-8") if p_todos is list: for tod...
[ "def", "write", "(", "self", ",", "p_todos", ")", ":", "todofile", "=", "codecs", ".", "open", "(", "self", ".", "path", ",", "'w'", ",", "encoding", "=", "\"utf-8\"", ")", "if", "p_todos", "is", "list", ":", "for", "todo", "in", "p_todos", ":", "t...
Writes all the todo items to the todo.txt file. p_todos can be a list of todo items, or a string that is just written to the file.
[ "Writes", "all", "the", "todo", "items", "to", "the", "todo", ".", "txt", "file", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoFile.py#L46-L64
train
bram85/topydo
topydo/ui/UILoader.py
main
def main(): """ Main entry point of the CLI. """ try: args = sys.argv[1:] try: _, args = getopt.getopt(args, MAIN_OPTS, MAIN_LONG_OPTS) except getopt.GetoptError as e: error(str(e)) sys.exit(1) if args[0] == 'prompt': try: ...
python
def main(): """ Main entry point of the CLI. """ try: args = sys.argv[1:] try: _, args = getopt.getopt(args, MAIN_OPTS, MAIN_LONG_OPTS) except getopt.GetoptError as e: error(str(e)) sys.exit(1) if args[0] == 'prompt': try: ...
[ "def", "main", "(", ")", ":", "try", ":", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", "try", ":", "_", ",", "args", "=", "getopt", ".", "getopt", "(", "args", ",", "MAIN_OPTS", ",", "MAIN_LONG_OPTS", ")", "except", "getopt", ".", "Getopt...
Main entry point of the CLI.
[ "Main", "entry", "point", "of", "the", "CLI", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/UILoader.py#L33-L64
train
bram85/topydo
topydo/lib/Importance.py
importance
def importance(p_todo, p_ignore_weekend=config().ignore_weekends()): """ Calculates the importance of the given task. Returns an importance of zero when the task has been completed. If p_ignore_weekend is True, the importance value of the due date will be calculated as if Friday is immediately foll...
python
def importance(p_todo, p_ignore_weekend=config().ignore_weekends()): """ Calculates the importance of the given task. Returns an importance of zero when the task has been completed. If p_ignore_weekend is True, the importance value of the due date will be calculated as if Friday is immediately foll...
[ "def", "importance", "(", "p_todo", ",", "p_ignore_weekend", "=", "config", "(", ")", ".", "ignore_weekends", "(", ")", ")", ":", "result", "=", "2", "priority", "=", "p_todo", ".", "priority", "(", ")", "result", "+=", "IMPORTANCE_VALUE", "[", "priority",...
Calculates the importance of the given task. Returns an importance of zero when the task has been completed. If p_ignore_weekend is True, the importance value of the due date will be calculated as if Friday is immediately followed by Monday. This in case of a todo list at the office and you don't work ...
[ "Calculates", "the", "importance", "of", "the", "given", "task", ".", "Returns", "an", "importance", "of", "zero", "when", "the", "task", "has", "been", "completed", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Importance.py#L44-L79
train
bram85/topydo
topydo/lib/TodoList.py
TodoList._maintain_dep_graph
def _maintain_dep_graph(self, p_todo): """ Makes sure that the dependency graph is consistent according to the given todo. """ dep_id = p_todo.tag_value('id') # maintain dependency graph if dep_id: self._parentdict[dep_id] = p_todo self._de...
python
def _maintain_dep_graph(self, p_todo): """ Makes sure that the dependency graph is consistent according to the given todo. """ dep_id = p_todo.tag_value('id') # maintain dependency graph if dep_id: self._parentdict[dep_id] = p_todo self._de...
[ "def", "_maintain_dep_graph", "(", "self", ",", "p_todo", ")", ":", "dep_id", "=", "p_todo", ".", "tag_value", "(", "'id'", ")", "# maintain dependency graph", "if", "dep_id", ":", "self", ".", "_parentdict", "[", "dep_id", "]", "=", "p_todo", "self", ".", ...
Makes sure that the dependency graph is consistent according to the given todo.
[ "Makes", "sure", "that", "the", "dependency", "graph", "is", "consistent", "according", "to", "the", "given", "todo", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoList.py#L86-L109
train
bram85/topydo
topydo/lib/TodoList.py
TodoList.add_dependency
def add_dependency(self, p_from_todo, p_to_todo): """ Adds a dependency from task 1 to task 2. """ def find_next_id(): """ Find a new unused ID. Unused means that no task has it as an 'id' value or as a 'p' value. """ def id_exists(...
python
def add_dependency(self, p_from_todo, p_to_todo): """ Adds a dependency from task 1 to task 2. """ def find_next_id(): """ Find a new unused ID. Unused means that no task has it as an 'id' value or as a 'p' value. """ def id_exists(...
[ "def", "add_dependency", "(", "self", ",", "p_from_todo", ",", "p_to_todo", ")", ":", "def", "find_next_id", "(", ")", ":", "\"\"\"\n Find a new unused ID.\n Unused means that no task has it as an 'id' value or as a 'p'\n value.\n \"\"\"", ...
Adds a dependency from task 1 to task 2.
[ "Adds", "a", "dependency", "from", "task", "1", "to", "task", "2", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoList.py#L153-L210
train
bram85/topydo
topydo/lib/TodoList.py
TodoList.remove_dependency
def remove_dependency(self, p_from_todo, p_to_todo, p_leave_tags=False): """ Removes a dependency between two todos. """ dep_id = p_from_todo.tag_value('id') if dep_id: self._depgraph.remove_edge(hash(p_from_todo), hash(p_to_todo)) self.dirty = True # clean dang...
python
def remove_dependency(self, p_from_todo, p_to_todo, p_leave_tags=False): """ Removes a dependency between two todos. """ dep_id = p_from_todo.tag_value('id') if dep_id: self._depgraph.remove_edge(hash(p_from_todo), hash(p_to_todo)) self.dirty = True # clean dang...
[ "def", "remove_dependency", "(", "self", ",", "p_from_todo", ",", "p_to_todo", ",", "p_leave_tags", "=", "False", ")", ":", "dep_id", "=", "p_from_todo", ".", "tag_value", "(", "'id'", ")", "if", "dep_id", ":", "self", ".", "_depgraph", ".", "remove_edge", ...
Removes a dependency between two todos.
[ "Removes", "a", "dependency", "between", "two", "todos", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoList.py#L213-L227
train
bram85/topydo
topydo/lib/TodoList.py
TodoList.clean_dependencies
def clean_dependencies(self): """ Cleans the dependency graph. This is achieved by performing a transitive reduction on the dependency graph and removing unused dependency ids from the graph (in that order). """ def remove_tag(p_todo, p_tag, p_value): ...
python
def clean_dependencies(self): """ Cleans the dependency graph. This is achieved by performing a transitive reduction on the dependency graph and removing unused dependency ids from the graph (in that order). """ def remove_tag(p_todo, p_tag, p_value): ...
[ "def", "clean_dependencies", "(", "self", ")", ":", "def", "remove_tag", "(", "p_todo", ",", "p_tag", ",", "p_value", ")", ":", "\"\"\"\n Removes a tag from a todo item.\n \"\"\"", "p_todo", ".", "remove_tag", "(", "p_tag", ",", "p_value", ")", ...
Cleans the dependency graph. This is achieved by performing a transitive reduction on the dependency graph and removing unused dependency ids from the graph (in that order).
[ "Cleans", "the", "dependency", "graph", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoList.py#L250-L291
train
bram85/topydo
topydo/lib/printers/Json.py
_convert_todo
def _convert_todo(p_todo): """ Converts a Todo instance to a dictionary. """ creation_date = p_todo.creation_date() completion_date = p_todo.completion_date() result = { 'source': p_todo.source(), 'text': p_todo.text(), 'priority': p_todo.priority(), 'completed': p_todo....
python
def _convert_todo(p_todo): """ Converts a Todo instance to a dictionary. """ creation_date = p_todo.creation_date() completion_date = p_todo.completion_date() result = { 'source': p_todo.source(), 'text': p_todo.text(), 'priority': p_todo.priority(), 'completed': p_todo....
[ "def", "_convert_todo", "(", "p_todo", ")", ":", "creation_date", "=", "p_todo", ".", "creation_date", "(", ")", "completion_date", "=", "p_todo", ".", "completion_date", "(", ")", "result", "=", "{", "'source'", ":", "p_todo", ".", "source", "(", ")", ","...
Converts a Todo instance to a dictionary.
[ "Converts", "a", "Todo", "instance", "to", "a", "dictionary", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/printers/Json.py#L27-L46
train
bram85/topydo
topydo/lib/ChangeSet.py
get_backup_path
def get_backup_path(): """ Returns full path and filename of backup file """ dirname, filename = path.split(path.splitext(config().todotxt())[0]) filename = '.' + filename + '.bak' return path.join(dirname, filename)
python
def get_backup_path(): """ Returns full path and filename of backup file """ dirname, filename = path.split(path.splitext(config().todotxt())[0]) filename = '.' + filename + '.bak' return path.join(dirname, filename)
[ "def", "get_backup_path", "(", ")", ":", "dirname", ",", "filename", "=", "path", ".", "split", "(", "path", ".", "splitext", "(", "config", "(", ")", ".", "todotxt", "(", ")", ")", "[", "0", "]", ")", "filename", "=", "'.'", "+", "filename", "+", ...
Returns full path and filename of backup file
[ "Returns", "full", "path", "and", "filename", "of", "backup", "file" ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ChangeSet.py#L36-L41
train
bram85/topydo
topydo/lib/ChangeSet.py
ChangeSet._read
def _read(self): """ Reads backup file from json_file property and sets backup_dict property with data decompressed and deserialized from that file. If no usable data is found backup_dict is set to the empty dict. """ self.json_file.seek(0) try: data =...
python
def _read(self): """ Reads backup file from json_file property and sets backup_dict property with data decompressed and deserialized from that file. If no usable data is found backup_dict is set to the empty dict. """ self.json_file.seek(0) try: data =...
[ "def", "_read", "(", "self", ")", ":", "self", ".", "json_file", ".", "seek", "(", "0", ")", "try", ":", "data", "=", "zlib", ".", "decompress", "(", "self", ".", "json_file", ".", "read", "(", ")", ")", "self", ".", "backup_dict", "=", "json", "...
Reads backup file from json_file property and sets backup_dict property with data decompressed and deserialized from that file. If no usable data is found backup_dict is set to the empty dict.
[ "Reads", "backup", "file", "from", "json_file", "property", "and", "sets", "backup_dict", "property", "with", "data", "decompressed", "and", "deserialized", "from", "that", "file", ".", "If", "no", "usable", "data", "is", "found", "backup_dict", "is", "set", "...
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ChangeSet.py#L64-L75
train
bram85/topydo
topydo/lib/ChangeSet.py
ChangeSet._write
def _write(self): """ Writes data from backup_dict property in serialized and compressed form to backup file pointed in json_file property. """ self.json_file.seek(0) self.json_file.truncate() dump = json.dumps(self.backup_dict) dump_c = zlib.compress(dump...
python
def _write(self): """ Writes data from backup_dict property in serialized and compressed form to backup file pointed in json_file property. """ self.json_file.seek(0) self.json_file.truncate() dump = json.dumps(self.backup_dict) dump_c = zlib.compress(dump...
[ "def", "_write", "(", "self", ")", ":", "self", ".", "json_file", ".", "seek", "(", "0", ")", "self", ".", "json_file", ".", "truncate", "(", ")", "dump", "=", "json", ".", "dumps", "(", "self", ".", "backup_dict", ")", "dump_c", "=", "zlib", ".", ...
Writes data from backup_dict property in serialized and compressed form to backup file pointed in json_file property.
[ "Writes", "data", "from", "backup_dict", "property", "in", "serialized", "and", "compressed", "form", "to", "backup", "file", "pointed", "in", "json_file", "property", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ChangeSet.py#L77-L86
train
bram85/topydo
topydo/lib/ChangeSet.py
ChangeSet.save
def save(self, p_todolist): """ Saves a tuple with archive, todolist and command with its arguments into the backup file with unix timestamp as the key. Tuple is then indexed in backup file with combination of hash calculated from p_todolist and unix timestamp. Backup file is clo...
python
def save(self, p_todolist): """ Saves a tuple with archive, todolist and command with its arguments into the backup file with unix timestamp as the key. Tuple is then indexed in backup file with combination of hash calculated from p_todolist and unix timestamp. Backup file is clo...
[ "def", "save", "(", "self", ",", "p_todolist", ")", ":", "self", ".", "_trim", "(", ")", "current_hash", "=", "hash_todolist", "(", "p_todolist", ")", "list_todo", "=", "(", "self", ".", "todolist", ".", "print_todos", "(", ")", "+", "'\\n'", ")", ".",...
Saves a tuple with archive, todolist and command with its arguments into the backup file with unix timestamp as the key. Tuple is then indexed in backup file with combination of hash calculated from p_todolist and unix timestamp. Backup file is closed afterwards.
[ "Saves", "a", "tuple", "with", "archive", "todolist", "and", "command", "with", "its", "arguments", "into", "the", "backup", "file", "with", "unix", "timestamp", "as", "the", "key", ".", "Tuple", "is", "then", "indexed", "in", "backup", "file", "with", "co...
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ChangeSet.py#L96-L119
train
bram85/topydo
topydo/lib/ChangeSet.py
ChangeSet.delete
def delete(self, p_timestamp=None, p_write=True): """ Removes backup from the backup file. """ timestamp = p_timestamp or self.timestamp index = self._get_index() try: del self.backup_dict[timestamp] index.remove(index[[change[0] for change in index].index(timest...
python
def delete(self, p_timestamp=None, p_write=True): """ Removes backup from the backup file. """ timestamp = p_timestamp or self.timestamp index = self._get_index() try: del self.backup_dict[timestamp] index.remove(index[[change[0] for change in index].index(timest...
[ "def", "delete", "(", "self", ",", "p_timestamp", "=", "None", ",", "p_write", "=", "True", ")", ":", "timestamp", "=", "p_timestamp", "or", "self", ".", "timestamp", "index", "=", "self", ".", "_get_index", "(", ")", "try", ":", "del", "self", ".", ...
Removes backup from the backup file.
[ "Removes", "backup", "from", "the", "backup", "file", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ChangeSet.py#L121-L134
train
bram85/topydo
topydo/lib/ChangeSet.py
ChangeSet._trim
def _trim(self): """ Removes oldest backups that exceed the limit configured in backup_count option. Does not write back to file system, make sure to call self._write() afterwards. """ index = self._get_index() backup_limit = config().backup_count() - 1 ...
python
def _trim(self): """ Removes oldest backups that exceed the limit configured in backup_count option. Does not write back to file system, make sure to call self._write() afterwards. """ index = self._get_index() backup_limit = config().backup_count() - 1 ...
[ "def", "_trim", "(", "self", ")", ":", "index", "=", "self", ".", "_get_index", "(", ")", "backup_limit", "=", "config", "(", ")", ".", "backup_count", "(", ")", "-", "1", "for", "changeset", "in", "index", "[", "backup_limit", ":", "]", ":", "self",...
Removes oldest backups that exceed the limit configured in backup_count option. Does not write back to file system, make sure to call self._write() afterwards.
[ "Removes", "oldest", "backups", "that", "exceed", "the", "limit", "configured", "in", "backup_count", "option", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ChangeSet.py#L152-L164
train
bram85/topydo
topydo/lib/ChangeSet.py
ChangeSet.apply
def apply(self, p_todolist, p_archive): """ Applies backup on supplied p_todolist. """ if self.todolist and p_todolist: p_todolist.replace(self.todolist.todos()) if self.archive and p_archive: p_archive.replace(self.archive.todos())
python
def apply(self, p_todolist, p_archive): """ Applies backup on supplied p_todolist. """ if self.todolist and p_todolist: p_todolist.replace(self.todolist.todos()) if self.archive and p_archive: p_archive.replace(self.archive.todos())
[ "def", "apply", "(", "self", ",", "p_todolist", ",", "p_archive", ")", ":", "if", "self", ".", "todolist", "and", "p_todolist", ":", "p_todolist", ".", "replace", "(", "self", ".", "todolist", ".", "todos", "(", ")", ")", "if", "self", ".", "archive", ...
Applies backup on supplied p_todolist.
[ "Applies", "backup", "on", "supplied", "p_todolist", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ChangeSet.py#L185-L191
train
bram85/topydo
topydo/lib/printers/PrettyPrinter.py
pretty_printer_factory
def pretty_printer_factory(p_todolist, p_additional_filters=None): """ Returns a pretty printer suitable for the ls and dep subcommands. """ p_additional_filters = p_additional_filters or [] printer = PrettyPrinter() printer.add_filter(PrettyPrinterNumbers(p_todolist)) for ppf in p_additional_filt...
python
def pretty_printer_factory(p_todolist, p_additional_filters=None): """ Returns a pretty printer suitable for the ls and dep subcommands. """ p_additional_filters = p_additional_filters or [] printer = PrettyPrinter() printer.add_filter(PrettyPrinterNumbers(p_todolist)) for ppf in p_additional_filt...
[ "def", "pretty_printer_factory", "(", "p_todolist", ",", "p_additional_filters", "=", "None", ")", ":", "p_additional_filters", "=", "p_additional_filters", "or", "[", "]", "printer", "=", "PrettyPrinter", "(", ")", "printer", ".", "add_filter", "(", "PrettyPrinterN...
Returns a pretty printer suitable for the ls and dep subcommands.
[ "Returns", "a", "pretty", "printer", "suitable", "for", "the", "ls", "and", "dep", "subcommands", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/printers/PrettyPrinter.py#L113-L127
train
bram85/topydo
topydo/lib/printers/PrettyPrinter.py
PrettyPrinter.print_todo
def print_todo(self, p_todo): """ Given a todo item, pretty print it. """ todo_str = p_todo.source() for ppf in self.filters: todo_str = ppf.filter(todo_str, p_todo) return TopydoString(todo_str)
python
def print_todo(self, p_todo): """ Given a todo item, pretty print it. """ todo_str = p_todo.source() for ppf in self.filters: todo_str = ppf.filter(todo_str, p_todo) return TopydoString(todo_str)
[ "def", "print_todo", "(", "self", ",", "p_todo", ")", ":", "todo_str", "=", "p_todo", ".", "source", "(", ")", "for", "ppf", "in", "self", ".", "filters", ":", "todo_str", "=", "ppf", ".", "filter", "(", "todo_str", ",", "p_todo", ")", "return", "Top...
Given a todo item, pretty print it.
[ "Given", "a", "todo", "item", "pretty", "print", "it", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/printers/PrettyPrinter.py#L72-L79
train
bram85/topydo
topydo/lib/Sorter.py
Sorter.group
def group(self, p_todos): """ Groups the todos according to the given group string. """ # preorder todos for the group sort p_todos = _apply_sort_functions(p_todos, self.pregroupfunctions) # initialize result with a single group result = OrderedDict([((), p_todos...
python
def group(self, p_todos): """ Groups the todos according to the given group string. """ # preorder todos for the group sort p_todos = _apply_sort_functions(p_todos, self.pregroupfunctions) # initialize result with a single group result = OrderedDict([((), p_todos...
[ "def", "group", "(", "self", ",", "p_todos", ")", ":", "# preorder todos for the group sort", "p_todos", "=", "_apply_sort_functions", "(", "p_todos", ",", "self", ".", "pregroupfunctions", ")", "# initialize result with a single group", "result", "=", "OrderedDict", "(...
Groups the todos according to the given group string.
[ "Groups", "the", "todos", "according", "to", "the", "given", "group", "string", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Sorter.py#L237-L270
train
bram85/topydo
topydo/lib/ListFormat.py
_strip_placeholder_braces
def _strip_placeholder_braces(p_matchobj): """ Returns string with conditional braces around placeholder stripped and percent sign glued into placeholder character. Returned string is composed from 'start', 'before', 'placeholder', 'after', 'whitespace', and 'end' match-groups of p_matchobj. Condit...
python
def _strip_placeholder_braces(p_matchobj): """ Returns string with conditional braces around placeholder stripped and percent sign glued into placeholder character. Returned string is composed from 'start', 'before', 'placeholder', 'after', 'whitespace', and 'end' match-groups of p_matchobj. Condit...
[ "def", "_strip_placeholder_braces", "(", "p_matchobj", ")", ":", "before", "=", "p_matchobj", ".", "group", "(", "'before'", ")", "or", "''", "placeholder", "=", "p_matchobj", ".", "group", "(", "'placeholder'", ")", "after", "=", "p_matchobj", ".", "group", ...
Returns string with conditional braces around placeholder stripped and percent sign glued into placeholder character. Returned string is composed from 'start', 'before', 'placeholder', 'after', 'whitespace', and 'end' match-groups of p_matchobj. Conditional braces are stripped from 'before' and 'after'...
[ "Returns", "string", "with", "conditional", "braces", "around", "placeholder", "stripped", "and", "percent", "sign", "glued", "into", "placeholder", "character", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ListFormat.py#L65-L85
train
bram85/topydo
topydo/lib/ListFormat.py
_truncate
def _truncate(p_str, p_repl): """ Returns p_str with truncated and ended with '...' version of p_repl. Place of the truncation is calculated depending on p_max_width. """ # 4 is for '...' and an extra space at the end text_lim = _columns() - len(escape_ansi(p_str)) - 4 truncated_str = re.su...
python
def _truncate(p_str, p_repl): """ Returns p_str with truncated and ended with '...' version of p_repl. Place of the truncation is calculated depending on p_max_width. """ # 4 is for '...' and an extra space at the end text_lim = _columns() - len(escape_ansi(p_str)) - 4 truncated_str = re.su...
[ "def", "_truncate", "(", "p_str", ",", "p_repl", ")", ":", "# 4 is for '...' and an extra space at the end", "text_lim", "=", "_columns", "(", ")", "-", "len", "(", "escape_ansi", "(", "p_str", ")", ")", "-", "4", "truncated_str", "=", "re", ".", "sub", "(",...
Returns p_str with truncated and ended with '...' version of p_repl. Place of the truncation is calculated depending on p_max_width.
[ "Returns", "p_str", "with", "truncated", "and", "ended", "with", "...", "version", "of", "p_repl", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ListFormat.py#L99-L109
train
bram85/topydo
topydo/lib/ListFormat.py
ListFormatParser._preprocess_format
def _preprocess_format(self): """ Preprocess the format_string attribute. Splits the format string on each placeholder and returns a list of tuples containing substring, placeholder name, and function retrieving content for placeholder (getter). Relevant placeholder fun...
python
def _preprocess_format(self): """ Preprocess the format_string attribute. Splits the format string on each placeholder and returns a list of tuples containing substring, placeholder name, and function retrieving content for placeholder (getter). Relevant placeholder fun...
[ "def", "_preprocess_format", "(", "self", ")", ":", "format_split", "=", "re", ".", "split", "(", "r'(?<!\\\\)%'", ",", "self", ".", "format_string", ")", "preprocessed_format", "=", "[", "]", "for", "idx", ",", "substr", "in", "enumerate", "(", "format_spli...
Preprocess the format_string attribute. Splits the format string on each placeholder and returns a list of tuples containing substring, placeholder name, and function retrieving content for placeholder (getter). Relevant placeholder functions (getters) are taken from 'placehold...
[ "Preprocess", "the", "format_string", "attribute", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ListFormat.py#L225-L266
train
bram85/topydo
topydo/lib/ListFormat.py
ListFormatParser.parse
def parse(self, p_todo): """ Returns fully parsed string from 'format_string' attribute with all placeholders properly substituted by content obtained from p_todo. It uses preprocessed form of 'format_string' (result of ListFormatParser._preprocess_format) stored in 'format_list...
python
def parse(self, p_todo): """ Returns fully parsed string from 'format_string' attribute with all placeholders properly substituted by content obtained from p_todo. It uses preprocessed form of 'format_string' (result of ListFormatParser._preprocess_format) stored in 'format_list...
[ "def", "parse", "(", "self", ",", "p_todo", ")", ":", "parsed_list", "=", "[", "]", "repl_trunc", "=", "None", "for", "substr", ",", "placeholder", ",", "getter", "in", "self", ".", "format_list", ":", "repl", "=", "getter", "(", "p_todo", ")", "if", ...
Returns fully parsed string from 'format_string' attribute with all placeholders properly substituted by content obtained from p_todo. It uses preprocessed form of 'format_string' (result of ListFormatParser._preprocess_format) stored in 'format_list' attribute.
[ "Returns", "fully", "parsed", "string", "from", "format_string", "attribute", "with", "all", "placeholders", "properly", "substituted", "by", "content", "obtained", "from", "p_todo", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/ListFormat.py#L268-L307
train
bram85/topydo
topydo/ui/prompt/Prompt.py
PromptApplication._load_file
def _load_file(self): """ Reads the configured todo.txt file and loads it into the todo list instance. """ self.todolist.erase() self.todolist.add_list(self.todofile.read()) self.completer = PromptCompleter(self.todolist)
python
def _load_file(self): """ Reads the configured todo.txt file and loads it into the todo list instance. """ self.todolist.erase() self.todolist.add_list(self.todofile.read()) self.completer = PromptCompleter(self.todolist)
[ "def", "_load_file", "(", "self", ")", ":", "self", ".", "todolist", ".", "erase", "(", ")", "self", ".", "todolist", ".", "add_list", "(", "self", ".", "todofile", ".", "read", "(", ")", ")", "self", ".", "completer", "=", "PromptCompleter", "(", "s...
Reads the configured todo.txt file and loads it into the todo list instance.
[ "Reads", "the", "configured", "todo", ".", "txt", "file", "and", "loads", "it", "into", "the", "todo", "list", "instance", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/prompt/Prompt.py#L56-L63
train
bram85/topydo
topydo/lib/Command.py
Command.execute
def execute(self): """ Execute the command. Intercepts the help subsubcommand to show the help text. """ if self.args and self.argument(0) == "help": self.error(self.usage() + "\n\n" + self.help()) return False return True
python
def execute(self): """ Execute the command. Intercepts the help subsubcommand to show the help text. """ if self.args and self.argument(0) == "help": self.error(self.usage() + "\n\n" + self.help()) return False return True
[ "def", "execute", "(", "self", ")", ":", "if", "self", ".", "args", "and", "self", ".", "argument", "(", "0", ")", "==", "\"help\"", ":", "self", ".", "error", "(", "self", ".", "usage", "(", ")", "+", "\"\\n\\n\"", "+", "self", ".", "help", "(",...
Execute the command. Intercepts the help subsubcommand to show the help text.
[ "Execute", "the", "command", ".", "Intercepts", "the", "help", "subsubcommand", "to", "show", "the", "help", "text", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Command.py#L59-L68
train
bram85/topydo
topydo/lib/Command.py
Command.argument
def argument(self, p_number): """ Retrieves a value from the argument list at the given position. """ try: return self.args[p_number] except IndexError as ie: raise InvalidCommandArgument from ie
python
def argument(self, p_number): """ Retrieves a value from the argument list at the given position. """ try: return self.args[p_number] except IndexError as ie: raise InvalidCommandArgument from ie
[ "def", "argument", "(", "self", ",", "p_number", ")", ":", "try", ":", "return", "self", ".", "args", "[", "p_number", "]", "except", "IndexError", "as", "ie", ":", "raise", "InvalidCommandArgument", "from", "ie" ]
Retrieves a value from the argument list at the given position.
[ "Retrieves", "a", "value", "from", "the", "argument", "list", "at", "the", "given", "position", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Command.py#L70-L75
train
bram85/topydo
topydo/lib/Config.py
config
def config(p_path=None, p_overrides=None): """ Retrieve the config instance. If a path is given, the instance is overwritten by the one that supplies an additional filename (for testability). Moreover, no other configuration files will be read when a path is given. Overrides will discard a set...
python
def config(p_path=None, p_overrides=None): """ Retrieve the config instance. If a path is given, the instance is overwritten by the one that supplies an additional filename (for testability). Moreover, no other configuration files will be read when a path is given. Overrides will discard a set...
[ "def", "config", "(", "p_path", "=", "None", ",", "p_overrides", "=", "None", ")", ":", "if", "not", "config", ".", "instance", "or", "p_path", "is", "not", "None", "or", "p_overrides", "is", "not", "None", ":", "try", ":", "config", ".", "instance", ...
Retrieve the config instance. If a path is given, the instance is overwritten by the one that supplies an additional filename (for testability). Moreover, no other configuration files will be read when a path is given. Overrides will discard a setting in any configuration file and use the passed v...
[ "Retrieve", "the", "config", "instance", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Config.py#L486-L504
train
bram85/topydo
topydo/lib/Config.py
_Config.colors
def colors(self, p_hint_possible=True): """ Returns 0, 16 or 256 representing the number of colors that should be used in the output. A hint can be passed whether the device that will output the text supports colors. """ lookup = { 'false': 0, ...
python
def colors(self, p_hint_possible=True): """ Returns 0, 16 or 256 representing the number of colors that should be used in the output. A hint can be passed whether the device that will output the text supports colors. """ lookup = { 'false': 0, ...
[ "def", "colors", "(", "self", ",", "p_hint_possible", "=", "True", ")", ":", "lookup", "=", "{", "'false'", ":", "0", ",", "'no'", ":", "0", ",", "'0'", ":", "0", ",", "'1'", ":", "16", ",", "'true'", ":", "16", ",", "'yes'", ":", "16", ",", ...
Returns 0, 16 or 256 representing the number of colors that should be used in the output. A hint can be passed whether the device that will output the text supports colors.
[ "Returns", "0", "16", "or", "256", "representing", "the", "number", "of", "colors", "that", "should", "be", "used", "in", "the", "output", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Config.py#L209-L243
train
bram85/topydo
topydo/lib/Config.py
_Config.hidden_tags
def hidden_tags(self): """ Returns a list of tags to be hidden from the 'ls' output. """ hidden_tags = self.cp.get('ls', 'hide_tags') # pylint: disable=no-member return [] if hidden_tags == '' else [tag.strip() for tag in hidden_tags.split(','...
python
def hidden_tags(self): """ Returns a list of tags to be hidden from the 'ls' output. """ hidden_tags = self.cp.get('ls', 'hide_tags') # pylint: disable=no-member return [] if hidden_tags == '' else [tag.strip() for tag in hidden_tags.split(','...
[ "def", "hidden_tags", "(", "self", ")", ":", "hidden_tags", "=", "self", ".", "cp", ".", "get", "(", "'ls'", ",", "'hide_tags'", ")", "# pylint: disable=no-member", "return", "[", "]", "if", "hidden_tags", "==", "''", "else", "[", "tag", ".", "strip", "(...
Returns a list of tags to be hidden from the 'ls' output.
[ "Returns", "a", "list", "of", "tags", "to", "be", "hidden", "from", "the", "ls", "output", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Config.py#L322-L327
train
bram85/topydo
topydo/lib/Config.py
_Config.hidden_item_tags
def hidden_item_tags(self): """ Returns a list of tags which hide an item from the 'ls' output. """ hidden_item_tags = self.cp.get('ls', 'hidden_item_tags') # pylint: disable=no-member return [] if hidden_item_tags == '' else [tag.strip() for tag in ...
python
def hidden_item_tags(self): """ Returns a list of tags which hide an item from the 'ls' output. """ hidden_item_tags = self.cp.get('ls', 'hidden_item_tags') # pylint: disable=no-member return [] if hidden_item_tags == '' else [tag.strip() for tag in ...
[ "def", "hidden_item_tags", "(", "self", ")", ":", "hidden_item_tags", "=", "self", ".", "cp", ".", "get", "(", "'ls'", ",", "'hidden_item_tags'", ")", "# pylint: disable=no-member", "return", "[", "]", "if", "hidden_item_tags", "==", "''", "else", "[", "tag", ...
Returns a list of tags which hide an item from the 'ls' output.
[ "Returns", "a", "list", "of", "tags", "which", "hide", "an", "item", "from", "the", "ls", "output", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Config.py#L329-L334
train
bram85/topydo
topydo/lib/Config.py
_Config.priority_color
def priority_color(self, p_priority): """ Returns a dict with priorities as keys and color numbers as value. """ def _str_to_dict(p_string): pri_colors_dict = dict() for pri_color in p_string.split(','): pri, color = pri_color.split(':') ...
python
def priority_color(self, p_priority): """ Returns a dict with priorities as keys and color numbers as value. """ def _str_to_dict(p_string): pri_colors_dict = dict() for pri_color in p_string.split(','): pri, color = pri_color.split(':') ...
[ "def", "priority_color", "(", "self", ",", "p_priority", ")", ":", "def", "_str_to_dict", "(", "p_string", ")", ":", "pri_colors_dict", "=", "dict", "(", ")", "for", "pri_color", "in", "p_string", ".", "split", "(", "','", ")", ":", "pri", ",", "color", ...
Returns a dict with priorities as keys and color numbers as value.
[ "Returns", "a", "dict", "with", "priorities", "as", "keys", "and", "color", "numbers", "as", "value", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Config.py#L337-L359
train
bram85/topydo
topydo/lib/Config.py
_Config.aliases
def aliases(self): """ Returns dict with aliases names as keys and pairs of actual subcommand and alias args as values. """ aliases = self.cp.items('aliases') alias_dict = dict() for alias, meaning in aliases: try: meaning = shlex.spli...
python
def aliases(self): """ Returns dict with aliases names as keys and pairs of actual subcommand and alias args as values. """ aliases = self.cp.items('aliases') alias_dict = dict() for alias, meaning in aliases: try: meaning = shlex.spli...
[ "def", "aliases", "(", "self", ")", ":", "aliases", "=", "self", ".", "cp", ".", "items", "(", "'aliases'", ")", "alias_dict", "=", "dict", "(", ")", "for", "alias", ",", "meaning", "in", "aliases", ":", "try", ":", "meaning", "=", "shlex", ".", "s...
Returns dict with aliases names as keys and pairs of actual subcommand and alias args as values.
[ "Returns", "dict", "with", "aliases", "names", "as", "keys", "and", "pairs", "of", "actual", "subcommand", "and", "alias", "args", "as", "values", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Config.py#L404-L421
train
bram85/topydo
topydo/lib/Config.py
_Config.column_keymap
def column_keymap(self): """ Returns keymap and keystates used in column mode """ keystates = set() shortcuts = self.cp.items('column_keymap') keymap_dict = dict(shortcuts) for combo, action in shortcuts: # add all possible prefixes to keystates combo_as...
python
def column_keymap(self): """ Returns keymap and keystates used in column mode """ keystates = set() shortcuts = self.cp.items('column_keymap') keymap_dict = dict(shortcuts) for combo, action in shortcuts: # add all possible prefixes to keystates combo_as...
[ "def", "column_keymap", "(", "self", ")", ":", "keystates", "=", "set", "(", ")", "shortcuts", "=", "self", ".", "cp", ".", "items", "(", "'column_keymap'", ")", "keymap_dict", "=", "dict", "(", "shortcuts", ")", "for", "combo", ",", "action", "in", "s...
Returns keymap and keystates used in column mode
[ "Returns", "keymap", "and", "keystates", "used", "in", "column", "mode" ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Config.py#L440-L460
train
bram85/topydo
topydo/lib/Config.py
_Config.editor
def editor(self): """ Returns the editor to invoke. It returns a list with the command in the first position and its arguments in the remainder. """ result = 'vi' if 'TOPYDO_EDITOR' in os.environ and os.environ['TOPYDO_EDITOR']: result = os.environ['TOPYDO_EDI...
python
def editor(self): """ Returns the editor to invoke. It returns a list with the command in the first position and its arguments in the remainder. """ result = 'vi' if 'TOPYDO_EDITOR' in os.environ and os.environ['TOPYDO_EDITOR']: result = os.environ['TOPYDO_EDI...
[ "def", "editor", "(", "self", ")", ":", "result", "=", "'vi'", "if", "'TOPYDO_EDITOR'", "in", "os", ".", "environ", "and", "os", ".", "environ", "[", "'TOPYDO_EDITOR'", "]", ":", "result", "=", "os", ".", "environ", "[", "'TOPYDO_EDITOR'", "]", "else", ...
Returns the editor to invoke. It returns a list with the command in the first position and its arguments in the remainder.
[ "Returns", "the", "editor", "to", "invoke", ".", "It", "returns", "a", "list", "with", "the", "command", "in", "the", "first", "position", "and", "its", "arguments", "in", "the", "remainder", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Config.py#L462-L477
train
bram85/topydo
topydo/commands/AddCommand.py
AddCommand.execute
def execute(self): """ Adds a todo item to the list. """ if not super().execute(): return False self.printer.add_filter(PrettyPrinterNumbers(self.todolist)) self._process_flags() if self.from_file: try: new_todos = self.get_todos_from_fil...
python
def execute(self): """ Adds a todo item to the list. """ if not super().execute(): return False self.printer.add_filter(PrettyPrinterNumbers(self.todolist)) self._process_flags() if self.from_file: try: new_todos = self.get_todos_from_fil...
[ "def", "execute", "(", "self", ")", ":", "if", "not", "super", "(", ")", ".", "execute", "(", ")", ":", "return", "False", "self", ".", "printer", ".", "add_filter", "(", "PrettyPrinterNumbers", "(", "self", ".", "todolist", ")", ")", "self", ".", "_...
Adds a todo item to the list.
[ "Adds", "a", "todo", "item", "to", "the", "list", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/commands/AddCommand.py#L80-L100
train
bram85/topydo
topydo/lib/Recurrence.py
advance_recurring_todo
def advance_recurring_todo(p_todo, p_offset=None, p_strict=False): """ Given a Todo item, return a new instance of a Todo item with the dates shifted according to the recurrence rule. Strict means that the real due date is taken as a offset, not today or a future date to determine the offset. ...
python
def advance_recurring_todo(p_todo, p_offset=None, p_strict=False): """ Given a Todo item, return a new instance of a Todo item with the dates shifted according to the recurrence rule. Strict means that the real due date is taken as a offset, not today or a future date to determine the offset. ...
[ "def", "advance_recurring_todo", "(", "p_todo", ",", "p_offset", "=", "None", ",", "p_strict", "=", "False", ")", ":", "todo", "=", "Todo", "(", "p_todo", ".", "source", "(", ")", ")", "pattern", "=", "todo", ".", "tag_value", "(", "'rec'", ")", "if", ...
Given a Todo item, return a new instance of a Todo item with the dates shifted according to the recurrence rule. Strict means that the real due date is taken as a offset, not today or a future date to determine the offset. When the todo item has no due date, then the date is used passed by the cal...
[ "Given", "a", "Todo", "item", "return", "a", "new", "instance", "of", "a", "Todo", "item", "with", "the", "dates", "shifted", "according", "to", "the", "recurrence", "rule", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Recurrence.py#L30-L73
train
bram85/topydo
topydo/lib/HashListValues.py
_get_table_size
def _get_table_size(p_alphabet, p_num): """ Returns a prime number that is suitable for the hash table size. The size is dependent on the alphabet used, and the number of items that need to be hashed. The table size is at least 100 times larger than the number of items to be hashed, to avoid collisi...
python
def _get_table_size(p_alphabet, p_num): """ Returns a prime number that is suitable for the hash table size. The size is dependent on the alphabet used, and the number of items that need to be hashed. The table size is at least 100 times larger than the number of items to be hashed, to avoid collisi...
[ "def", "_get_table_size", "(", "p_alphabet", ",", "p_num", ")", ":", "try", ":", "for", "width", ",", "size", "in", "sorted", "(", "_TABLE_SIZES", "[", "len", "(", "p_alphabet", ")", "]", ".", "items", "(", ")", ")", ":", "if", "p_num", "<", "size", ...
Returns a prime number that is suitable for the hash table size. The size is dependent on the alphabet used, and the number of items that need to be hashed. The table size is at least 100 times larger than the number of items to be hashed, to avoid collisions. When the alphabet is too little or too lar...
[ "Returns", "a", "prime", "number", "that", "is", "suitable", "for", "the", "hash", "table", "size", ".", "The", "size", "is", "dependent", "on", "the", "alphabet", "used", "and", "the", "number", "of", "items", "that", "need", "to", "be", "hashed", ".", ...
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/HashListValues.py#L79-L96
train
bram85/topydo
topydo/lib/HashListValues.py
hash_list_values
def hash_list_values(p_list, p_key=lambda i: i): # pragma: no branch """ Calculates a unique value for each item in the list, these can be used as identifiers. The value is based on hashing an item using the p_key function. Suitable for lists not larger than approx. 16K items. Returns a tupl...
python
def hash_list_values(p_list, p_key=lambda i: i): # pragma: no branch """ Calculates a unique value for each item in the list, these can be used as identifiers. The value is based on hashing an item using the p_key function. Suitable for lists not larger than approx. 16K items. Returns a tupl...
[ "def", "hash_list_values", "(", "p_list", ",", "p_key", "=", "lambda", "i", ":", "i", ")", ":", "# pragma: no branch", "def", "to_base", "(", "p_alphabet", ",", "p_value", ")", ":", "\"\"\"\n Converts integer to text ID with characters from the given alphabet.\n\n ...
Calculates a unique value for each item in the list, these can be used as identifiers. The value is based on hashing an item using the p_key function. Suitable for lists not larger than approx. 16K items. Returns a tuple with the status and a list of tuples where each item is combined with the ID...
[ "Calculates", "a", "unique", "value", "for", "each", "item", "in", "the", "list", "these", "can", "be", "used", "as", "identifiers", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/HashListValues.py#L98-L150
train
bram85/topydo
topydo/lib/HashListValues.py
max_id_length
def max_id_length(p_num): """ Returns the length of the IDs used, given the number of items that are assigned an ID. Used for padding in lists. """ try: alphabet = config().identifier_alphabet() length, _ = _get_table_size(alphabet, p_num) except _TableSizeException: leng...
python
def max_id_length(p_num): """ Returns the length of the IDs used, given the number of items that are assigned an ID. Used for padding in lists. """ try: alphabet = config().identifier_alphabet() length, _ = _get_table_size(alphabet, p_num) except _TableSizeException: leng...
[ "def", "max_id_length", "(", "p_num", ")", ":", "try", ":", "alphabet", "=", "config", "(", ")", ".", "identifier_alphabet", "(", ")", "length", ",", "_", "=", "_get_table_size", "(", "alphabet", ",", "p_num", ")", "except", "_TableSizeException", ":", "le...
Returns the length of the IDs used, given the number of items that are assigned an ID. Used for padding in lists.
[ "Returns", "the", "length", "of", "the", "IDs", "used", "given", "the", "number", "of", "items", "that", "are", "assigned", "an", "ID", ".", "Used", "for", "padding", "in", "lists", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/HashListValues.py#L152-L163
train
bram85/topydo
topydo/lib/prettyprinters/Colors.py
PrettyPrinterColorFilter.filter
def filter(self, p_todo_str, p_todo): """ Applies the colors. """ if config().colors(): p_todo_str = TopydoString(p_todo_str, p_todo) priority_color = config().priority_color(p_todo.priority()) colors = [ (r'\B@(\S*\w)', AbstractColor.CONTEXT), ...
python
def filter(self, p_todo_str, p_todo): """ Applies the colors. """ if config().colors(): p_todo_str = TopydoString(p_todo_str, p_todo) priority_color = config().priority_color(p_todo.priority()) colors = [ (r'\B@(\S*\w)', AbstractColor.CONTEXT), ...
[ "def", "filter", "(", "self", ",", "p_todo_str", ",", "p_todo", ")", ":", "if", "config", "(", ")", ".", "colors", "(", ")", ":", "p_todo_str", "=", "TopydoString", "(", "p_todo_str", ",", "p_todo", ")", "priority_color", "=", "config", "(", ")", ".", ...
Applies the colors.
[ "Applies", "the", "colors", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/prettyprinters/Colors.py#L34-L58
train
bram85/topydo
topydo/lib/Filter.py
get_filter_list
def get_filter_list(p_expression): """ Returns a list of GrepFilters, OrdinalTagFilters or NegationFilters based on the given filter expression. The filter expression is a list of strings. """ result = [] for arg in p_expression: # when a word starts with -, it should be negated ...
python
def get_filter_list(p_expression): """ Returns a list of GrepFilters, OrdinalTagFilters or NegationFilters based on the given filter expression. The filter expression is a list of strings. """ result = [] for arg in p_expression: # when a word starts with -, it should be negated ...
[ "def", "get_filter_list", "(", "p_expression", ")", ":", "result", "=", "[", "]", "for", "arg", "in", "p_expression", ":", "# when a word starts with -, it should be negated", "is_negated", "=", "len", "(", "arg", ")", ">", "1", "and", "arg", "[", "0", "]", ...
Returns a list of GrepFilters, OrdinalTagFilters or NegationFilters based on the given filter expression. The filter expression is a list of strings.
[ "Returns", "a", "list", "of", "GrepFilters", "OrdinalTagFilters", "or", "NegationFilters", "based", "on", "the", "given", "filter", "expression", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Filter.py#L377-L404
train
bram85/topydo
topydo/lib/Filter.py
DependencyFilter.match
def match(self, p_todo): """ Returns True when there are no children that are uncompleted yet. """ children = self.todolist.children(p_todo) uncompleted = [todo for todo in children if not todo.is_completed()] return not uncompleted
python
def match(self, p_todo): """ Returns True when there are no children that are uncompleted yet. """ children = self.todolist.children(p_todo) uncompleted = [todo for todo in children if not todo.is_completed()] return not uncompleted
[ "def", "match", "(", "self", ",", "p_todo", ")", ":", "children", "=", "self", ".", "todolist", ".", "children", "(", "p_todo", ")", "uncompleted", "=", "[", "todo", "for", "todo", "in", "children", "if", "not", "todo", ".", "is_completed", "(", ")", ...
Returns True when there are no children that are uncompleted yet.
[ "Returns", "True", "when", "there", "are", "no", "children", "that", "are", "uncompleted", "yet", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Filter.py#L135-L142
train
bram85/topydo
topydo/lib/Filter.py
InstanceFilter.match
def match(self, p_todo): """ Returns True when p_todo appears in the list of given todos. """ try: self.todos.index(p_todo) return True except ValueError: return False
python
def match(self, p_todo): """ Returns True when p_todo appears in the list of given todos. """ try: self.todos.index(p_todo) return True except ValueError: return False
[ "def", "match", "(", "self", ",", "p_todo", ")", ":", "try", ":", "self", ".", "todos", ".", "index", "(", "p_todo", ")", "return", "True", "except", "ValueError", ":", "return", "False" ]
Returns True when p_todo appears in the list of given todos.
[ "Returns", "True", "when", "p_todo", "appears", "in", "the", "list", "of", "given", "todos", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Filter.py#L166-L174
train
bram85/topydo
topydo/lib/Filter.py
HiddenTagFilter.match
def match(self, p_todo): """ Returns True when p_todo doesn't have a tag to mark it as hidden. """ for my_tag in config().hidden_item_tags(): my_values = p_todo.tag_values(my_tag) for my_value in my_values: if not my_value in (0, '0', False, 'False...
python
def match(self, p_todo): """ Returns True when p_todo doesn't have a tag to mark it as hidden. """ for my_tag in config().hidden_item_tags(): my_values = p_todo.tag_values(my_tag) for my_value in my_values: if not my_value in (0, '0', False, 'False...
[ "def", "match", "(", "self", ",", "p_todo", ")", ":", "for", "my_tag", "in", "config", "(", ")", ".", "hidden_item_tags", "(", ")", ":", "my_values", "=", "p_todo", ".", "tag_values", "(", "my_tag", ")", "for", "my_value", "in", "my_values", ":", "if",...
Returns True when p_todo doesn't have a tag to mark it as hidden.
[ "Returns", "True", "when", "p_todo", "doesn", "t", "have", "a", "tag", "to", "mark", "it", "as", "hidden", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Filter.py#L186-L196
train
bram85/topydo
topydo/lib/Filter.py
OrdinalFilter.compare_operands
def compare_operands(self, p_operand1, p_operand2): """ Returns True if conditional constructed from both operands and self.operator is valid. Returns False otherwise. """ if self.operator == '<': return p_operand1 < p_operand2 elif self.operator == '<=': ...
python
def compare_operands(self, p_operand1, p_operand2): """ Returns True if conditional constructed from both operands and self.operator is valid. Returns False otherwise. """ if self.operator == '<': return p_operand1 < p_operand2 elif self.operator == '<=': ...
[ "def", "compare_operands", "(", "self", ",", "p_operand1", ",", "p_operand2", ")", ":", "if", "self", ".", "operator", "==", "'<'", ":", "return", "p_operand1", "<", "p_operand2", "elif", "self", ".", "operator", "==", "'<='", ":", "return", "p_operand1", ...
Returns True if conditional constructed from both operands and self.operator is valid. Returns False otherwise.
[ "Returns", "True", "if", "conditional", "constructed", "from", "both", "operands", "and", "self", ".", "operator", "is", "valid", ".", "Returns", "False", "otherwise", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Filter.py#L232-L250
train
bram85/topydo
topydo/lib/Filter.py
PriorityFilter.match
def match(self, p_todo): """ Performs a match on a priority in the todo. It gets priority from p_todo and compares it with user-entered expression based on the given operator (default ==). It does that however in reversed order to obtain more intuitive result. Example: (>B) will...
python
def match(self, p_todo): """ Performs a match on a priority in the todo. It gets priority from p_todo and compares it with user-entered expression based on the given operator (default ==). It does that however in reversed order to obtain more intuitive result. Example: (>B) will...
[ "def", "match", "(", "self", ",", "p_todo", ")", ":", "operand1", "=", "self", ".", "value", "operand2", "=", "p_todo", ".", "priority", "(", ")", "or", "'ZZ'", "return", "self", ".", "compare_operands", "(", "operand1", ",", "operand2", ")" ]
Performs a match on a priority in the todo. It gets priority from p_todo and compares it with user-entered expression based on the given operator (default ==). It does that however in reversed order to obtain more intuitive result. Example: (>B) will match todos with priority (A). ...
[ "Performs", "a", "match", "on", "a", "priority", "in", "the", "todo", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Filter.py#L354-L368
train
bram85/topydo
topydo/ui/CompleterBase.py
date_suggestions
def date_suggestions(): """ Returns a list of relative date that is presented to the user as auto complete suggestions. """ # don't use strftime, prevent locales to kick in days_of_week = { 0: "Monday", 1: "Tuesday", 2: "Wednesday", 3: "Thursday", 4: "Frid...
python
def date_suggestions(): """ Returns a list of relative date that is presented to the user as auto complete suggestions. """ # don't use strftime, prevent locales to kick in days_of_week = { 0: "Monday", 1: "Tuesday", 2: "Wednesday", 3: "Thursday", 4: "Frid...
[ "def", "date_suggestions", "(", ")", ":", "# don't use strftime, prevent locales to kick in", "days_of_week", "=", "{", "0", ":", "\"Monday\"", ",", "1", ":", "\"Tuesday\"", ",", "2", ":", "\"Wednesday\"", ",", "3", ":", "\"Thursday\"", ",", "4", ":", "\"Friday\...
Returns a list of relative date that is presented to the user as auto complete suggestions.
[ "Returns", "a", "list", "of", "relative", "date", "that", "is", "presented", "to", "the", "user", "as", "auto", "complete", "suggestions", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/CompleterBase.py#L32-L61
train
bram85/topydo
topydo/ui/CLIApplicationBase.py
write
def write(p_file, p_string): """ Write p_string to file p_file, trailed by a newline character. ANSI codes are removed when the file is not a TTY (and colors are automatically determined). """ if not config().colors(p_file.isatty()): p_string = escape_ansi(p_string) if p_string: ...
python
def write(p_file, p_string): """ Write p_string to file p_file, trailed by a newline character. ANSI codes are removed when the file is not a TTY (and colors are automatically determined). """ if not config().colors(p_file.isatty()): p_string = escape_ansi(p_string) if p_string: ...
[ "def", "write", "(", "p_file", ",", "p_string", ")", ":", "if", "not", "config", "(", ")", ".", "colors", "(", "p_file", ".", "isatty", "(", ")", ")", ":", "p_string", "=", "escape_ansi", "(", "p_string", ")", "if", "p_string", ":", "p_file", ".", ...
Write p_string to file p_file, trailed by a newline character. ANSI codes are removed when the file is not a TTY (and colors are automatically determined).
[ "Write", "p_string", "to", "file", "p_file", "trailed", "by", "a", "newline", "character", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/CLIApplicationBase.py#L72-L83
train
bram85/topydo
topydo/ui/CLIApplicationBase.py
lookup_color
def lookup_color(p_color): """ Converts an AbstractColor to a normal Color. Returns the Color itself when a normal color is passed. """ if not lookup_color.colors: lookup_color.colors[AbstractColor.NEUTRAL] = Color('NEUTRAL') lookup_color.colors[AbstractColor.PROJECT] = config().proj...
python
def lookup_color(p_color): """ Converts an AbstractColor to a normal Color. Returns the Color itself when a normal color is passed. """ if not lookup_color.colors: lookup_color.colors[AbstractColor.NEUTRAL] = Color('NEUTRAL') lookup_color.colors[AbstractColor.PROJECT] = config().proj...
[ "def", "lookup_color", "(", "p_color", ")", ":", "if", "not", "lookup_color", ".", "colors", ":", "lookup_color", ".", "colors", "[", "AbstractColor", ".", "NEUTRAL", "]", "=", "Color", "(", "'NEUTRAL'", ")", "lookup_color", ".", "colors", "[", "AbstractColo...
Converts an AbstractColor to a normal Color. Returns the Color itself when a normal color is passed.
[ "Converts", "an", "AbstractColor", "to", "a", "normal", "Color", ".", "Returns", "the", "Color", "itself", "when", "a", "normal", "color", "is", "passed", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/CLIApplicationBase.py#L86-L101
train
bram85/topydo
topydo/ui/CLIApplicationBase.py
insert_ansi
def insert_ansi(p_string): """ Returns a string with color information at the right positions. """ result = p_string.data for pos, color in sorted(p_string.colors.items(), reverse=True): color = lookup_color(color) result = result[:pos] + color.as_ansi() + result[pos:] return result
python
def insert_ansi(p_string): """ Returns a string with color information at the right positions. """ result = p_string.data for pos, color in sorted(p_string.colors.items(), reverse=True): color = lookup_color(color) result = result[:pos] + color.as_ansi() + result[pos:] return result
[ "def", "insert_ansi", "(", "p_string", ")", ":", "result", "=", "p_string", ".", "data", "for", "pos", ",", "color", "in", "sorted", "(", "p_string", ".", "colors", ".", "items", "(", ")", ",", "reverse", "=", "True", ")", ":", "color", "=", "lookup_...
Returns a string with color information at the right positions.
[ "Returns", "a", "string", "with", "color", "information", "at", "the", "right", "positions", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/CLIApplicationBase.py#L105-L114
train
bram85/topydo
topydo/ui/CLIApplicationBase.py
version
def version(): """ Print the current version and exit. """ from topydo.lib.Version import VERSION, LICENSE print("topydo {}\n".format(VERSION)) print(LICENSE) sys.exit(0)
python
def version(): """ Print the current version and exit. """ from topydo.lib.Version import VERSION, LICENSE print("topydo {}\n".format(VERSION)) print(LICENSE) sys.exit(0)
[ "def", "version", "(", ")", ":", "from", "topydo", ".", "lib", ".", "Version", "import", "VERSION", ",", "LICENSE", "print", "(", "\"topydo {}\\n\"", ".", "format", "(", "VERSION", ")", ")", "print", "(", "LICENSE", ")", "sys", ".", "exit", "(", "0", ...
Print the current version and exit.
[ "Print", "the", "current", "version", "and", "exit", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/CLIApplicationBase.py#L130-L135
train
bram85/topydo
topydo/ui/CLIApplicationBase.py
CLIApplicationBase._archive
def _archive(self): """ Performs an archive action on the todolist. This means that all completed tasks are moved to the archive file (defaults to done.txt). """ archive, archive_file = _retrieve_archive() if self.backup: self.backup.add_archive(arch...
python
def _archive(self): """ Performs an archive action on the todolist. This means that all completed tasks are moved to the archive file (defaults to done.txt). """ archive, archive_file = _retrieve_archive() if self.backup: self.backup.add_archive(arch...
[ "def", "_archive", "(", "self", ")", ":", "archive", ",", "archive_file", "=", "_retrieve_archive", "(", ")", "if", "self", ".", "backup", ":", "self", ".", "backup", ".", "add_archive", "(", "archive", ")", "if", "archive", ":", "from", "topydo", ".", ...
Performs an archive action on the todolist. This means that all completed tasks are moved to the archive file (defaults to done.txt).
[ "Performs", "an", "archive", "action", "on", "the", "todolist", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/CLIApplicationBase.py#L221-L239
train
bram85/topydo
topydo/ui/CLIApplicationBase.py
CLIApplicationBase.is_read_only
def is_read_only(p_command): """ Returns True when the given command class is read-only. """ read_only_commands = tuple(cmd for cmd in ('revert', ) + READ_ONLY_COMMANDS) return p_command.name() in read_only_commands
python
def is_read_only(p_command): """ Returns True when the given command class is read-only. """ read_only_commands = tuple(cmd for cmd in ('revert', ) + READ_ONLY_COMMANDS) return p_command.name() in read_only_commands
[ "def", "is_read_only", "(", "p_command", ")", ":", "read_only_commands", "=", "tuple", "(", "cmd", "for", "cmd", "in", "(", "'revert'", ",", ")", "+", "READ_ONLY_COMMANDS", ")", "return", "p_command", ".", "name", "(", ")", "in", "read_only_commands" ]
Returns True when the given command class is read-only.
[ "Returns", "True", "when", "the", "given", "command", "class", "is", "read", "-", "only", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/CLIApplicationBase.py#L242-L246
train
bram85/topydo
topydo/ui/CLIApplicationBase.py
CLIApplicationBase._post_execute
def _post_execute(self): """ Should be called when executing the user requested command has been completed. It will do some maintenance and write out the final result to the todo.txt file. """ if self.todolist.dirty: # do not archive when the value of the fil...
python
def _post_execute(self): """ Should be called when executing the user requested command has been completed. It will do some maintenance and write out the final result to the todo.txt file. """ if self.todolist.dirty: # do not archive when the value of the fil...
[ "def", "_post_execute", "(", "self", ")", ":", "if", "self", ".", "todolist", ".", "dirty", ":", "# do not archive when the value of the filename is an empty string", "# (i.e. explicitly left empty in the configuration", "if", "self", ".", "do_archive", "and", "config", "("...
Should be called when executing the user requested command has been completed. It will do some maintenance and write out the final result to the todo.txt file.
[ "Should", "be", "called", "when", "executing", "the", "user", "requested", "command", "has", "been", "completed", ".", "It", "will", "do", "some", "maintenance", "and", "write", "out", "the", "final", "result", "to", "the", "todo", ".", "txt", "file", "." ...
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/CLIApplicationBase.py#L277-L305
train
bram85/topydo
topydo/lib/Todo.py
Todo.get_date
def get_date(self, p_tag): """ Given a date tag, return a date object. """ string = self.tag_value(p_tag) result = None try: result = date_string_to_date(string) if string else None except ValueError: pass return result
python
def get_date(self, p_tag): """ Given a date tag, return a date object. """ string = self.tag_value(p_tag) result = None try: result = date_string_to_date(string) if string else None except ValueError: pass return result
[ "def", "get_date", "(", "self", ",", "p_tag", ")", ":", "string", "=", "self", ".", "tag_value", "(", "p_tag", ")", "result", "=", "None", "try", ":", "result", "=", "date_string_to_date", "(", "string", ")", "if", "string", "else", "None", "except", "...
Given a date tag, return a date object.
[ "Given", "a", "date", "tag", "return", "a", "date", "object", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Todo.py#L38-L48
train
bram85/topydo
topydo/lib/Todo.py
Todo.is_active
def is_active(self): """ Returns True when the start date is today or in the past and the task has not yet been completed. """ start = self.start_date() return not self.is_completed() and (not start or start <= date.today())
python
def is_active(self): """ Returns True when the start date is today or in the past and the task has not yet been completed. """ start = self.start_date() return not self.is_completed() and (not start or start <= date.today())
[ "def", "is_active", "(", "self", ")", ":", "start", "=", "self", ".", "start_date", "(", ")", "return", "not", "self", ".", "is_completed", "(", ")", "and", "(", "not", "start", "or", "start", "<=", "date", ".", "today", "(", ")", ")" ]
Returns True when the start date is today or in the past and the task has not yet been completed.
[ "Returns", "True", "when", "the", "start", "date", "is", "today", "or", "in", "the", "past", "and", "the", "task", "has", "not", "yet", "been", "completed", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Todo.py#L58-L64
train
bram85/topydo
topydo/lib/Todo.py
Todo.days_till_due
def days_till_due(self): """ Returns the number of days till the due date. Returns a negative number of days when the due date is in the past. Returns 0 when the task has no due date. """ due = self.due_date() if due: diff = due - date.today() ...
python
def days_till_due(self): """ Returns the number of days till the due date. Returns a negative number of days when the due date is in the past. Returns 0 when the task has no due date. """ due = self.due_date() if due: diff = due - date.today() ...
[ "def", "days_till_due", "(", "self", ")", ":", "due", "=", "self", ".", "due_date", "(", ")", "if", "due", ":", "diff", "=", "due", "-", "date", ".", "today", "(", ")", "return", "diff", ".", "days", "return", "0" ]
Returns the number of days till the due date. Returns a negative number of days when the due date is in the past. Returns 0 when the task has no due date.
[ "Returns", "the", "number", "of", "days", "till", "the", "due", "date", ".", "Returns", "a", "negative", "number", "of", "days", "when", "the", "due", "date", "is", "in", "the", "past", ".", "Returns", "0", "when", "the", "task", "has", "no", "due", ...
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Todo.py#L73-L83
train
bram85/topydo
topydo/commands/DepCommand.py
DepCommand._handle_ls
def _handle_ls(self): """ Handles the ls subsubcommand. """ try: arg1 = self.argument(1) arg2 = self.argument(2) todos = [] if arg2 == 'to' or arg1 == 'before': # dep ls 1 to OR dep ls before 1 number = arg1 if arg2 == 'to'...
python
def _handle_ls(self): """ Handles the ls subsubcommand. """ try: arg1 = self.argument(1) arg2 = self.argument(2) todos = [] if arg2 == 'to' or arg1 == 'before': # dep ls 1 to OR dep ls before 1 number = arg1 if arg2 == 'to'...
[ "def", "_handle_ls", "(", "self", ")", ":", "try", ":", "arg1", "=", "self", ".", "argument", "(", "1", ")", "arg2", "=", "self", ".", "argument", "(", "2", ")", "todos", "=", "[", "]", "if", "arg2", "==", "'to'", "or", "arg1", "==", "'before'", ...
Handles the ls subsubcommand.
[ "Handles", "the", "ls", "subsubcommand", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/commands/DepCommand.py#L104-L131
train
bram85/topydo
topydo/commands/DepCommand.py
DepCommand._handle_dot
def _handle_dot(self): """ Handles the dot subsubcommand. """ self.printer = DotPrinter(self.todolist) try: arg = self.argument(1) todo = self.todolist.todo(arg) arg = self.argument(1) todos = set([self.todolist.todo(arg)]) todos |= se...
python
def _handle_dot(self): """ Handles the dot subsubcommand. """ self.printer = DotPrinter(self.todolist) try: arg = self.argument(1) todo = self.todolist.todo(arg) arg = self.argument(1) todos = set([self.todolist.todo(arg)]) todos |= se...
[ "def", "_handle_dot", "(", "self", ")", ":", "self", ".", "printer", "=", "DotPrinter", "(", "self", ".", "todolist", ")", "try", ":", "arg", "=", "self", ".", "argument", "(", "1", ")", "todo", "=", "self", ".", "todolist", ".", "todo", "(", "arg"...
Handles the dot subsubcommand.
[ "Handles", "the", "dot", "subsubcommand", "." ]
b59fcfca5361869a6b78d4c9808c7c6cd0a18b58
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/commands/DepCommand.py#L133-L150
train