pydoto-cli

Simple ToDo-like application, that just works. Add any tasks without closing your terminal.
git clone https://git.nfu.su/pydoto-cli.git
Log | Files | Refs | README

commit 228ff8ba2308be3394cfcc71e173cef5ce86b318
parent 8ee3bb31a2b9e16271d17191cf2d1d811f925182
Author: Pr0fiTX <uventik999@gmail.com>
Date:   Fri,  4 Jul 2025 14:12:57 +0300

[REF]: Comments Refactoring

Diffstat:
Mpydoto.py | 2+-
Mtaskprinter.py | 2++
Mtasksmanage.py | 14+++++++++++++-
3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/pydoto.py b/pydoto.py @@ -34,7 +34,7 @@ def main(): tm.Task.print_id_all() return else: - # Execute witheout any flags + # Execute without any flags # Prints only ACTIVE tasks tm.Task.print_active() return diff --git a/taskprinter.py b/taskprinter.py @@ -6,6 +6,7 @@ class TaskPrinter: @classmethod def mark_choser(cls, task) -> str: + """Returns pretty thing:3""" match task.status.value: case "active": return cls.ACTIVE_M @@ -54,6 +55,7 @@ class TaskPrinter: @classmethod def task_out(cls, task, sta=0, id=0, nam=0, des=0, exp=0): + """Task output template, out tasks ONLY via this function!""" print(f"{cls.mark_choser(task)}" if sta else "", f"| \"{task.creation_date}\" |" if id else "", f"{task.name}" if nam else "", diff --git a/tasksmanage.py b/tasksmanage.py @@ -23,6 +23,7 @@ class Task: self.status = TaskStatus.ACTIVE def to_dict(self) -> dict: + """Class -> Dictionary; For future save into .json""" return { "name": self.name, "description": self.description, @@ -40,6 +41,7 @@ class Task: @classmethod def mark_done(cls, task_id): + """Set task.status = COMPLETED""" tasks = cls.db_load() for task in tasks: @@ -55,6 +57,7 @@ class Task: @classmethod def mark_deleted(cls, task_id): + """task.status = DELETED""" tasks = cls.db_load() for task in tasks: @@ -68,6 +71,7 @@ class Task: @classmethod def update_expiration_statuses(cls): + """Load from .json -> Update exp. statuses -> Save to .json""" tasks = [] tasks_new = [] @@ -83,7 +87,7 @@ class Task: @classmethod def from_dict(cls, data): - """Convert ONE dict -> Task""" + """Convert ONE Dict -> Class""" expiration_date = datetime.fromisoformat(data['expiration_date']) if data['expiration_date'] else None task = cls(data['name'], data['description'], expiration_date) task.creation_date = datetime.fromisoformat(data['creation_date']) @@ -93,6 +97,7 @@ class Task: @classmethod def db_load(cls) -> list: + """Load tasks from .json into list (AS CLASSES)""" if not os.path.exists(DB_NAME): print(f"!> File {DB_NAME} doesn't exist") @@ -113,6 +118,7 @@ class Task: @classmethod def db_dump(cls, data): + """Save tasks from list -> .json""" data_dict = [] for task in data: @@ -127,6 +133,7 @@ class Task: @classmethod def print_active(cls): + """Print only ACTIVE to stdout""" cls.update_expiration_statuses() tasks = cls.db_load() if not cls.check_for_emptiness(tasks): @@ -134,6 +141,7 @@ class Task: @classmethod def print_id(cls): + """Print only NOT DELETED with ID column""" cls.update_expiration_statuses() tasks = cls.db_load() if not cls.check_for_emptiness(tasks): @@ -141,6 +149,7 @@ class Task: @classmethod def print_id_all(cls): + """Print ALL TASKS with ID column""" cls.update_expiration_statuses() tasks = cls.db_load() if not cls.check_for_emptiness(tasks): @@ -148,6 +157,7 @@ class Task: @classmethod def print_tasks(cls): + """Print only NOT DELETED from .json""" cls.update_expiration_statuses() tasks = cls.db_load() if not cls.check_for_emptiness(tasks): @@ -155,6 +165,7 @@ class Task: @classmethod def print_tasks_all(cls): + """Prints ALL TASKS from .json""" cls.update_expiration_statuses() tasks = cls.db_load() if not cls.check_for_emptiness(tasks): @@ -162,6 +173,7 @@ class Task: @staticmethod def check_for_emptiness(tasks) -> bool: + """Is .json empty?""" if not tasks: print("!> You don't have any tasks") return True