Skip to content

Commit

Permalink
clean match to ugly if for python 3.9 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
awoimbee committed Sep 25, 2024
1 parent 37e91a9 commit dd86d78
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ansys/simai/core/data/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ class RawSingleFilter(TypedDict):


def to_raw_filters(filters: Optional["Filters"]) -> Optional["RawFilters"]:
match filters:
case dict():
return [{"field": k, "operator": "EQ", "value": v} for k, v in filters.items()]
case [dict(), *_]:
if isinstance(filters, dict):
return [{"field": k, "operator": "EQ", "value": v} for k, v in filters.items()]
if isinstance(filters, list) and len(filters) > 0:
if isinstance(filters[0], dict):
return filters
case [tuple() | list(), *_]:
if isinstance(filters[0], (tuple, list)):
return [{"field": fld, "operator": op, "value": val} for fld, op, val in filters]

0 comments on commit dd86d78

Please sign in to comment.