magodo.types module

Custom types used by this library.

class AbstractMagicTodo(*args, **kwargs)[source]

Bases: magodo.types.AbstractTodo, Protocol, Generic[magodo.types.T]

Describes how subclasses of MagicTodoMixin should look.

classmethod cast_from_line_spells(line)[source]

Casts all from_line spells on line.

Parameters

line (str) –

Return type

str

cast_to_line_spells(line)[source]

Casts all to_line spells on line.

Parameters

line (str) –

Return type

str

classmethod cast_todo_spells(todo)[source]

Casts all spells associated with this MagicTodo on todo.

Parameters

todo (TypeVar(T, bound= AbstractTodo)) –

Return type

Union[Ok[TypeVar(T, bound= AbstractTodo), ErisError], Err[TypeVar(T, bound= AbstractTodo), ErisError]]

from_line_spells
post_todo_spells
pre_todo_spells
to_line_spells
property todo

The raw Todo object used by this MagicTodo.

Return type

TypeVar(T, bound= AbstractTodo)

todo_spells
class AbstractTodo(*args, **kwargs)[source]

Bases: typist._core.Comparable, Protocol

Describes how any valid Todo object should look.

property contexts

A todo’s contexts.

A word is normally marked as a context by prefixing it with ‘@’.

Return type

Tuple[str, ...]

property create_date

The date this todo was created.

Return type

date

property desc

A description of this todo.

Return type

str

property done

Is this todo marked done with an ‘x’?

Return type

bool

property done_date

The date this todo was completed.

Return type

dt.date | None

property epics

A todo’s epics.

A word is normally marked as an epic by prefixing it with ‘#’.

Return type

Tuple[str, ...]

classmethod from_line(line)[source]

Constructs a new Todo object from a string.

Parameters
  • cls (Type[TypeVar(T, bound= AbstractTodo)]) –

  • line (str) –

Return type

Union[Ok[TypeVar(T, bound= AbstractTodo), ErisError], Err[TypeVar(T, bound= AbstractTodo), ErisError]]

property ident

A unique identifier for this Todo.

Return type

str

property metadata

A todo’s corresponding metadata dictionary.

A word is metadata if it is of the form KEY:VALUE.

Return type

Dict[str, str]

new(**kwargs)[source]

Creates a new Todo using the current Todo’s attrs as defaults.

Parameters
  • self (TypeVar(T, bound= AbstractTodo)) –

  • kwargs (Any) –

Return type

TypeVar(T, bound= AbstractTodo)

property priority

A todo’s priority.

Return type

Literal[‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’]

property projects

A todo’s projects.

A word is normally marked as a project by prefixing it with ‘+’.

Return type

Tuple[str, ...]

to_line()[source]

Converts a Todo object back to a string.

Return type

str