refactor: update project code

This commit is contained in:
2026-07-31 15:52:16 +03:00
parent cc811d2174
commit 9a9338cfdc
16 changed files with 90 additions and 60 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
import logging
from collections import Counter
from pathlib import Path
from typing import Dict, Iterable
from typing import Iterable
from .command import CommandError
from .entry import Entry, EntryResolver, EntryTaskNotImplementedError
@@ -26,20 +26,20 @@ class ProjectManager:
def _iter_entries(self) -> Iterable[Entry]:
return self._resolver.resolve(self._basepaht)
def run_task(self, task_name: str) -> Dict[str, int]:
def run_task(self, task_name: str) -> dict[str, int]:
counter = Counter()
for entry in self._iter_entries():
try:
entry.run_task(task_name)
counter["success"] += 1
except EntryTaskNotImplementedError:
self._logger.warn(f"{task_name} {entry}")
self._logger.warning("%s %s", task_name, entry)
counter["skipped"] += 1
except CommandError as error:
self._logger.error(f"{entry}\n{error.output}")
self._logger.error("%s\n%s", entry, error.output)
counter["failed"] += 1
except Exception:
except:
self._logger.exception(entry)
counter["failed"] += 1
self._logger.info(f"result {dict(counter)}")
self._logger.info("result %s", dict(counter))
return counter