Skip to content

Commit bba8472

Browse files
committed
style: format code with ruff
1 parent 683dca9 commit bba8472

6 files changed

Lines changed: 24 additions & 19 deletions

File tree

docs/source/conf.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,24 @@
1111
# -- Project information -----------------------------------------------------
1212
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1313

14-
project = 'todo-cli'
15-
copyright = '2025, EL HACHIMI Mohamed Aymane'
16-
author = 'EL HACHIMI Mohamed Aymane'
14+
project = "todo-cli"
15+
copyright = "2025, EL HACHIMI Mohamed Aymane"
16+
author = "EL HACHIMI Mohamed Aymane"
1717

1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2020

2121
extensions = [
2222
"sphinx.ext.autodoc",
23-
"sphinx.ext.napoleon",
23+
"sphinx.ext.napoleon",
2424
]
2525

26-
templates_path = ['_templates']
26+
templates_path = ["_templates"]
2727
exclude_patterns = []
2828

2929

30-
3130
# -- Options for HTML output -------------------------------------------------
3231
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
3332

34-
html_theme = 'alabaster'
35-
html_static_path = ['_static']
33+
html_theme = "alabaster"
34+
html_static_path = ["_static"]

tests/test_models_deadline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ def test_task_invalid_deadline_raises_error() -> None:
3737
id=1,
3838
title="Bad deadline",
3939
priority=3,
40-
deadline="31-12-2025",
40+
deadline="31-12-2025",
4141
)

tests/test_storage_behaviour.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
from todo_cli.models import Task
32
from todo_cli.storage import load_tasks, next_id, save_tasks
43

todo_cli/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ def add(
5959
- Sauvegarde la liste mise à jour.
6060
- Écrit un log de niveau INFO.
6161
"""
62-
logger.debug("Commande add appelée avec title=%s, priority=%s, deadline=%s", title, priority, deadline)
62+
logger.debug(
63+
"Commande add appelée avec title=%s, priority=%s, deadline=%s",
64+
title,
65+
priority,
66+
deadline,
67+
)
6368
tasks = load_tasks()
6469

6570
parsed_deadline: datetime | None = None
@@ -102,7 +107,7 @@ def list(
102107
Afficher la liste des tâches.
103108
104109
Args:
105-
show_done (bool):
110+
show_done (bool):
106111
- True : affiche toutes les tâches
107112
- False : affiche uniquement les tâches non terminées
108113

todo_cli/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
class Task(BaseModel):
88
"""
99
Represents a task in the todo application.
10-
1110
Attributes:
1211
id (int): Unique identifier of the task.
1312
title (str): Title of the task.
@@ -16,6 +15,7 @@ class Task(BaseModel):
1615
deadline (date | None): Optional deadline.
1716
done (bool): Whether the task is completed.
1817
"""
18+
1919
id: int
2020
title: str
2121
description: Optional[str] = ""
@@ -37,4 +37,3 @@ def parse_deadline(cls, value: object) -> datetime | None:
3737
return datetime.fromisoformat(value)
3838

3939
raise ValueError("Valeur de deadline invalide")
40-

todo_cli/storage.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ def load_tasks(path: Path = DEFAULT_DB_PATH) -> List[Task]:
1717
Returns:
1818
list[Task]: List of tasks stored in the JSON file.
1919
"""
20-
20+
2121
if not path.exists():
22-
logger.warning("Le fichier de tâches n'existe pas : %s — création implicite", path)
22+
logger.warning(
23+
"Le fichier de tâches n'existe pas : %s — création implicite", path
24+
)
2325
return []
2426

2527
try:
@@ -39,7 +41,9 @@ def load_tasks(path: Path = DEFAULT_DB_PATH) -> List[Task]:
3941
return []
4042

4143
tasks = [Task(**item) for item in raw_data]
42-
logger.debug("Chargement réussi : %s tâche(s) chargée(s) depuis %s", len(tasks), path)
44+
logger.debug(
45+
"Chargement réussi : %s tâche(s) chargée(s) depuis %s", len(tasks), path
46+
)
4347

4448
return tasks
4549

@@ -51,8 +55,7 @@ def save_tasks(tasks: List[Task], path: Path = DEFAULT_DB_PATH) -> None:
5155

5256
try:
5357
path.write_text(
54-
json.dumps(data, indent=2, ensure_ascii=False),
55-
encoding="utf-8"
58+
json.dumps(data, indent=2, ensure_ascii=False), encoding="utf-8"
5659
)
5760
except OSError as exc:
5861
logger.critical("Erreur critique : impossible d'écrire dans %s : %s", path, exc)

0 commit comments

Comments
 (0)