From bd8f452bda425dd3534897496fa94b6babc43fac Mon Sep 17 00:00:00 2001 From: islean Date: Tue, 14 Jan 2025 10:27:13 +0100 Subject: [PATCH] Clean up --- cg/services/order_validation_service/utils.py | 6 +----- .../workflows/fluffy/models/sample.py | 6 +++--- .../order_validation_service/workflows/rml/models/sample.py | 6 +++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/cg/services/order_validation_service/utils.py b/cg/services/order_validation_service/utils.py index e297b4f19e..3eb65f0a02 100644 --- a/cg/services/order_validation_service/utils.py +++ b/cg/services/order_validation_service/utils.py @@ -1,6 +1,6 @@ from typing import Callable -from cg.models.orders.sample_base import ContainerEnum, ControlEnum +from cg.models.orders.sample_base import ControlEnum from cg.services.order_validation_service.constants import ElutionBuffer, ExtractionMethod from cg.services.order_validation_service.errors.case_errors import CaseError from cg.services.order_validation_service.errors.case_sample_errors import CaseSampleError @@ -59,7 +59,3 @@ def parse_extraction_method(extraction_method: str | None) -> ExtractionMethod: if extraction_method and extraction_method.startswith(ExtractionMethod.MAGNAPURE_96) else extraction_method ) - - -def set_to_none(container: ContainerEnum | None) -> None: - return None diff --git a/cg/services/order_validation_service/workflows/fluffy/models/sample.py b/cg/services/order_validation_service/workflows/fluffy/models/sample.py index e8c2ca9065..e58616bf32 100644 --- a/cg/services/order_validation_service/workflows/fluffy/models/sample.py +++ b/cg/services/order_validation_service/workflows/fluffy/models/sample.py @@ -1,15 +1,15 @@ from pydantic import BeforeValidator, Field from typing_extensions import Annotated -from cg.models.orders.sample_base import ControlEnum, PriorityEnum +from cg.models.orders.sample_base import ContainerEnum, ControlEnum, PriorityEnum from cg.services.order_validation_service.constants import IndexEnum from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_control, set_to_none +from cg.services.order_validation_service.utils import parse_control class FluffySample(Sample): concentration: float - container: Annotated[None, BeforeValidator(set_to_none)] = Field(default=None, exclude=True) + container: ContainerEnum | None = Field(default=None, exclude=True) control: Annotated[ControlEnum, BeforeValidator(parse_control)] = ControlEnum.not_control priority: PriorityEnum index: IndexEnum diff --git a/cg/services/order_validation_service/workflows/rml/models/sample.py b/cg/services/order_validation_service/workflows/rml/models/sample.py index ee38a20c7d..67f62c4ba3 100644 --- a/cg/services/order_validation_service/workflows/rml/models/sample.py +++ b/cg/services/order_validation_service/workflows/rml/models/sample.py @@ -1,15 +1,15 @@ from pydantic import BeforeValidator, Field from typing_extensions import Annotated -from cg.models.orders.sample_base import ControlEnum, PriorityEnum +from cg.models.orders.sample_base import ContainerEnum, ControlEnum, PriorityEnum from cg.services.order_validation_service.constants import IndexEnum from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_control, set_to_none +from cg.services.order_validation_service.utils import parse_control class RmlSample(Sample): concentration: float - container: Annotated[None, BeforeValidator(set_to_none)] = Field(default=None, exclude=True) + container: ContainerEnum | None = Field(default=None, exclude=True) control: Annotated[ControlEnum, BeforeValidator(parse_control)] = ControlEnum.not_control index: IndexEnum index_number: int | None = None