From 2691bcd3cbe5c3f4b2ddfc0936e213d8edbef490 Mon Sep 17 00:00:00 2001 From: oqyude Date: Sun, 25 Oct 2026 05:11:04 +0300 Subject: [PATCH] =?UTF-8?q?D6:=20=D0=B2=D1=8B=D0=BD=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20=D0=BF=D1=83=D1=82=D1=8C=20=D1=8D=D0=BA=D1=81=D0=BF?= =?UTF-8?q?=D0=BE=D1=80=D1=82=D0=B0=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D1=82=D1=83=20EXPORTS=5FDIR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 не изменился). --- infrastructure/cli/commands/export_xlsx.py | 8 +++++++- infrastructure/cli/paths.py | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/infrastructure/cli/commands/export_xlsx.py b/infrastructure/cli/commands/export_xlsx.py index 2d30c93..693a916 100644 --- a/infrastructure/cli/commands/export_xlsx.py +++ b/infrastructure/cli/commands/export_xlsx.py @@ -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() diff --git a/infrastructure/cli/paths.py b/infrastructure/cli/paths.py index 28a67ef..1d31c7d 100644 --- a/infrastructure/cli/paths.py +++ b/infrastructure/cli/paths.py @@ -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")