diff --git a/Makefile b/Makefile index b3a6294..815840e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -format: black flake8 pylint ruff +format: black ruff +lint: flake8 pylint black: black ./lib || true @@ -10,7 +11,7 @@ flake8: pylint: pylint ./lib || true - pylint --disable=E0401,W0621,R0913,R0917 ./tests || true + pylint ./tests || true ruff: ruff check --fix ./lib || true diff --git a/lib/models/aerosurfaces.py b/lib/models/aerosurfaces.py index aec87f0..68d8e41 100644 --- a/lib/models/aerosurfaces.py +++ b/lib/models/aerosurfaces.py @@ -1,13 +1,13 @@ from enum import Enum from typing import Optional, Tuple, List, Union -from pydantic import BaseModel +from pydantic import BaseModel, Field class Parachute(BaseModel): name: str - cd_s: float - sampling_rate: int - lag: float + cd_s: float = Field(..., ge=0, description="Must be non-negative") + sampling_rate: float = Field(..., gt=0, description="Must be positive") + lag: float = Field(..., ge=0, description="Must be non-negative") trigger: Union[str, float] noise: Tuple[float, float, float] diff --git a/pyproject.toml b/pyproject.toml index 570738d..a341da2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,11 @@ disable = """ broad-exception-caught, raise-missing-from, too-many-instance-attributes, + redefined-outer-name, + import-error, + too-many-arguments, + redefined-outer-name, + too-many-positional-arguments, """ [tool.ruff] diff --git a/tests/test_routes/test_rockets_route.py b/tests/test_routes/test_rockets_route.py index 2a3afb6..8583e4b 100644 --- a/tests/test_routes/test_rockets_route.py +++ b/tests/test_routes/test_rockets_route.py @@ -162,7 +162,7 @@ def stub_parachute(): parachute = Parachute( name='parachute', cd_s=0, - sampling_rate=0, + sampling_rate=1, lag=0, trigger='trigger', noise=(0, 0, 0),