Skip to content

Commit

Permalink
update style to please the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusAntons committed Oct 2, 2024
1 parent a9b2d8d commit d9ad736
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def parse_standard_filters(standard_filters: MetadataFilters = None):

for filter in standard_filters.filters:
if isinstance(filter, MetadataFilters):
filters.append(f'({parse_standard_filters(filter)[1]})')
filters.append(f"({parse_standard_filters(filter)[1]})")
continue
filter_value = parse_filter_value(filter.value)
if filter_value is None and filter.operator != FilterOperator.IS_EMPTY:
Expand All @@ -127,7 +127,7 @@ def parse_standard_filters(standard_filters: MetadataFilters = None):
)
elif filter.operator == FilterOperator.IS_EMPTY:
# in Milvus, array_length(field_name) returns 0 if the field does not exist or is not an array
filters.append(f'array_length({filter.key!s}) == 0')
filters.append(f"array_length({filter.key!s}) == 0")
elif filter.operator in [
FilterOperator.EQ,
FilterOperator.GT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ def test_milvus_filter_with_nested_filters():
MetadataFilters(
filters=[
MetadataFilter(key="b", value=2, operator=FilterOperator.EQ),
MetadataFilter(key="c", value=3, operator=FilterOperator.EQ)
MetadataFilter(key="c", value=3, operator=FilterOperator.EQ),
],
condition=FilterCondition.OR
condition=FilterCondition.OR,
)
],
condition=FilterCondition.AND
condition=FilterCondition.AND,
)
expr = _to_milvus_filter(filters)
assert expr == "(a == 1 and (b == 2 or c == 3))"
Expand Down

0 comments on commit d9ad736

Please sign in to comment.