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 argparse
|
||||||
|
import dataclasses as dc
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
from dopt_sensor_anomalies import _interface
|
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:
|
def main() -> None:
|
||||||
@ -16,12 +23,12 @@ def main() -> None:
|
|||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"calib_value_x",
|
"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,
|
type=float,
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"calib_value_y",
|
"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,
|
type=float,
|
||||||
)
|
)
|
||||||
args = cast(CliArgs, parser.parse_args())
|
args = cast(CliArgs, parser.parse_args())
|
||||||
|
|||||||
@ -25,10 +25,3 @@ class SensorImages(TypedDict):
|
|||||||
class DetectionModels(TypedDict):
|
class DetectionModels(TypedDict):
|
||||||
left: Path
|
left: Path
|
||||||
right: 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