Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
islean committed Jan 14, 2025
1 parent 4b4e008 commit bd8f452
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 1 addition & 5 deletions cg/services/order_validation_service/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit bd8f452

Please sign in to comment.