From 542ada0a4bdc4e4755f1160a5f818c1c9d7754de Mon Sep 17 00:00:00 2001 From: Dhruv Ahuja <83733638+dhruv-ahuja@users.noreply.github.com> Date: Fri, 6 Sep 2024 06:31:35 +0530 Subject: [PATCH] chore: cleanup unneeded code --- src/schemas/requests.py | 26 -------------------------- src/utils/jobs.py | 1 - 2 files changed, 27 deletions(-) diff --git a/src/schemas/requests.py b/src/schemas/requests.py index 69c18cd..f1f2a3e 100644 --- a/src/schemas/requests.py +++ b/src/schemas/requests.py @@ -99,29 +99,3 @@ def parse_sort_input(query_params: list[str] | None) -> list["SortSchema"] | Non class FilterSortInput(BaseModel): filter_: Annotated[FilterInputType, BeforeValidator(FilterSchema.parse_filter_input)] = Field(None, alias="filter") sort: Annotated[SortInputType, BeforeValidator(SortSchema.parse_sort_input)] - - @staticmethod - def parse_filter_input(query_params: list[str] | None) -> list[FilterSchema] | None: - if query_params is None: - return - - filter_params = [] - valid_params = True - - for query_param in query_params: - try: - field, operation, value = query_param.split(":") - if operation not in FILTER_OPERATION.__args__: # type: ignore - valid_params = False - break - - filter_param = FilterSchema(field=field, operation=operation, value=value) # type: ignore - except Exception: - valid_params = False - - if not valid_params: - raise ValueError("Invalid input. Incorrect 'filter' query params.") - - filter_params.append(filter_param) - - return filter_params diff --git a/src/utils/jobs.py b/src/utils/jobs.py index ef5b2c3..bdca0d0 100644 --- a/src/utils/jobs.py +++ b/src/utils/jobs.py @@ -88,7 +88,6 @@ def convert_decimal(dict_item: dict | None): if dict_item is None: return None - # for k,v in list(dict_item.items()): for key, value in dict_item.items(): if isinstance(value, dict): convert_decimal(value)