D6: вынести путь экспорта в константу EXPORTS_DIR

- infrastructure/cli/paths.py: добавлена константа EXPORTS_DIR = Path("exports")
- infrastructure/cli/commands/export_xlsx.py: литерал "exports/forecast.xlsx"
  заменён на DEFAULT_EXPORT_PATH = str(EXPORTS_DIR / "forecast.xlsx")

Строка дефолта в help/аргументе остаётся ровно "exports/forecast.xlsx"
(проверено: cf export-xlsx --help не изменился).
This commit is contained in:
oqyude committed 2026-10-25 05:17:32 +03:00
1 parent af01efc41a
commit 2691bcd3cb
2 files changed
+10 -1

No files matched your search

+7 -1
View File
@@ -3,14 +3,20 @@
import typer
from infrastructure.cli.i18n import t
from infrastructure.cli.paths import EXPORTS_DIR
from infrastructure.cli.services import console, load_model
from infrastructure.repositories import ExcelRepository, ExcelRepositoryError
_repo = ExcelRepository()
# Значение по умолчанию остаётся ровно "exports/forecast.xlsx" (строка в help
# и в аргументе CLI не меняется) — собирается из EXPORTS_DIR во избежание
# дублирования литерала пути.
DEFAULT_EXPORT_PATH: str = str(EXPORTS_DIR / "forecast.xlsx")
def export_xlsx(
path: str = typer.Argument("exports/forecast.xlsx", help=t("cmd.export.arg.path")),
path: str = typer.Argument(DEFAULT_EXPORT_PATH, help=t("cmd.export.arg.path")),
) -> None:
"""Экспорт модели в Excel"""
model = load_model()
+3
View File
@@ -4,3 +4,6 @@ from pathlib import Path
DATA_DIR: Path = Path("data")
MODEL_PATH: Path = DATA_DIR / "model.json"
# Каталог для экспортируемых .xlsx (по умолчанию — "./exports" относительно CWD).
EXPORTS_DIR: Path = Path("exports")