From f9fab829a0637b747b8594978c3f892f6c864737 Mon Sep 17 00:00:00 2001 From: foefl Date: Mon, 10 Nov 2025 09:05:16 +0100 Subject: [PATCH] refactor to make cli standalone script, related to #11; add type hints to cli help messages, closes #10 --- cli.py | 13 ++++++++++--- src/dopt_sensor_anomalies/types.py | 7 ------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cli.py b/cli.py index cf75eea..dfddbf1 100644 --- a/cli.py +++ b/cli.py @@ -1,8 +1,15 @@ import argparse +import dataclasses as dc from typing import cast from dopt_sensor_anomalies import _interface -from dopt_sensor_anomalies.types import CliArgs + + +@dc.dataclass() +class CliArgs: + img_path: str + calib_value_x: float + calib_value_y: float def main() -> None: @@ -16,12 +23,12 @@ def main() -> None: ) parser.add_argument( "calib_value_x", - help="calibration value in pixels per mcm for x axis", + help="calibration value in pixels per mcm for x axis, type: float", type=float, ) parser.add_argument( "calib_value_y", - help="calibration value in pixels per mcm for y axis", + help="calibration value in pixels per mcm for y axis, type: float", type=float, ) args = cast(CliArgs, parser.parse_args()) diff --git a/src/dopt_sensor_anomalies/types.py b/src/dopt_sensor_anomalies/types.py index 2622127..c0cd9cc 100644 --- a/src/dopt_sensor_anomalies/types.py +++ b/src/dopt_sensor_anomalies/types.py @@ -25,10 +25,3 @@ class SensorImages(TypedDict): class DetectionModels(TypedDict): left: Path right: Path - - -@dc.dataclass() -class CliArgs: - img_path: str - calib_value_x: float - calib_value_y: float