generated from dopt-python/py311
refactor to make cli standalone script, related to #11; add type hints to cli help messages, closes #10
This commit is contained in:
parent
5dff65992e
commit
f9fab829a0
13
cli.py
13
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())
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user