magodo.types module

Custom types used by this library.

class EnchantedTodo(todo, changed=False)[source]

Bases: Generic[magodo.types.T]

Return type for Todo spells.

changed

Has any spell changed this todo?

Type

bool

todo

The possibly modified todo after casting spells on it.

Type

magodo.types.T

Parameters
  • todo (TypeVar(T, bound= TodoProto)) –

  • changed (bool) –

changed = False
todo
class TodoProto(*args, **kwargs)[source]

Bases: typist._core.Comparable, Protocol, Generic[magodo.types.T]

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= TodoProto)]) –

  • line (str) –

Return type

Union[Ok[TypeVar(T, bound= TodoProto), ErisError], Err[TypeVar(T, bound= TodoProto), 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= TodoProto)) –

  • kwargs (Any) –

Return type

TypeVar(T, bound= TodoProto)

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