Skip to content

Commit

Permalink
Fix pylint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
sanders41 committed Sep 20, 2023
1 parent 69f6be1 commit c7dcf66
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions meilisearch/models/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,29 @@ class Faceting(CamelBase):

@pydantic.field_validator("sort_facet_values_by") # type: ignore[attr-defined]
@classmethod
def validate_facet_order(cls, v: Optional[Dict[str, str]]) -> Optional[Dict[str, str]]:
if not v: # pragma: no cover
def validate_facet_order(cls, val: Optional[Dict[str, str]]) -> Optional[Dict[str, str]]:
if not val: # pragma: no cover
return None

for _, value in v.items():
for _, value in val.items():
if value not in ("alpha", "count"):
raise ValueError('facet_order must be either "alpha" or "count"')

return v
return val

else: # pragma: no cover

@pydantic.validator("sort_facet_values_by") # type: ignore[attr-defined]
@classmethod
def validate_facet_order(cls, v: Optional[Dict[str, str]]) -> Optional[Dict[str, str]]:
if not v:
def validate_facet_order(cls, val: Optional[Dict[str, str]]) -> Optional[Dict[str, str]]:
if not val:
return None

for _, value in v.items():
for _, value in val.items():
if value not in ("alpha", "count"):
raise ValueError('facet_order must be either "alpha" or "count"')

return v
return val


class Pagination(CamelBase):
Expand Down

0 comments on commit c7dcf66

Please sign in to comment.