style: apply ruff format to all source files
This commit is contained in:
@@ -25,7 +25,9 @@ def parse_date_range(date_arg: str) -> tuple[str, str]:
|
||||
|
||||
from_date, to_date = parts[0].strip(), parts[1].strip()
|
||||
date_pattern = r"\d{4}-\d{2}-\d{2}"
|
||||
if not re.fullmatch(date_pattern, from_date) or not re.fullmatch(date_pattern, to_date):
|
||||
if not re.fullmatch(date_pattern, from_date) or not re.fullmatch(
|
||||
date_pattern, to_date
|
||||
):
|
||||
raise ValueError("Date range must be in format YYYY-MM-DD--YYYY-MM-DD")
|
||||
|
||||
try:
|
||||
@@ -46,7 +48,7 @@ def _run_init_config(config_path: str, force: bool) -> int:
|
||||
|
||||
if path.exists() and not force:
|
||||
print(
|
||||
f"⚠️ {path} already exists.\n" f" Use --init-config --force to overwrite.",
|
||||
f"⚠️ {path} already exists.\n Use --init-config --force to overwrite.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return 1
|
||||
@@ -90,7 +92,9 @@ def _run_init_config(config_path: str, force: bool) -> int:
|
||||
|
||||
ensure_config_dir(path.parent)
|
||||
with open(path, "w", encoding="utf-8") as fh:
|
||||
yaml.dump(data, fh, allow_unicode=True, default_flow_style=False, sort_keys=False)
|
||||
yaml.dump(
|
||||
data, fh, allow_unicode=True, default_flow_style=False, sort_keys=False
|
||||
)
|
||||
path.chmod(0o600)
|
||||
|
||||
sections_found = [s for s in data if data[s]]
|
||||
@@ -222,7 +226,9 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
"--no-time", action="store_true", help="Do not include spent time into table"
|
||||
)
|
||||
parser.add_argument("--url", help="Override Redmine URL from .env (REDMINE_URL)")
|
||||
parser.add_argument("--api-key", help="Override Redmine API key from .env (REDMINE_API_KEY)")
|
||||
parser.add_argument(
|
||||
"--api-key", help="Override Redmine API key from .env (REDMINE_API_KEY)"
|
||||
)
|
||||
parser.add_argument("--config", help="Path to .env config file")
|
||||
parser.add_argument("--verbose", action="store_true", help="Enable verbose output")
|
||||
parser.add_argument("--debug", action="store_true", help="Enable debug output")
|
||||
@@ -417,7 +423,9 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
)
|
||||
|
||||
if output_arg is None:
|
||||
print("❌ Не удалось определить путь для сохранения отчёта.", file=sys.stderr)
|
||||
print(
|
||||
"❌ Не удалось определить путь для сохранения отчёта.", file=sys.stderr
|
||||
)
|
||||
return 1
|
||||
|
||||
ret = _save_and_maybe_send(
|
||||
@@ -446,7 +454,9 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
)
|
||||
|
||||
if output_arg is None:
|
||||
print("❌ Не удалось определить путь для сохранения отчёта.", file=sys.stderr)
|
||||
print(
|
||||
"❌ Не удалось определить путь для сохранения отчёта.", file=sys.stderr
|
||||
)
|
||||
return 1
|
||||
|
||||
ret = _save_and_maybe_send(
|
||||
@@ -493,7 +503,9 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
to_str = to_date
|
||||
|
||||
try:
|
||||
save_period_to_config(args.config_path, from_str, to_str, precision, dynamic)
|
||||
save_period_to_config(
|
||||
args.config_path, from_str, to_str, precision, dynamic
|
||||
)
|
||||
except Exception as e:
|
||||
print(
|
||||
f"❌ Не удалось сохранить период в конфиг: {e}",
|
||||
|
||||
Reference in New Issue
Block a user