Skip to content

FilterOps #

Bases: object

Builds property filter expressions.

This object represents “a property access” plus optional list/aggregate qualifiers (e.g. first, len, sum) and can emit a filter.FilterExpr via comparisons such as ==, <, is_in, etc.

Returned expressions can be combined with &, |, and ~ at the filter.FilterExpr level (where supported).

__eq__(value) #

Return self==value.

__ge__(value) #

Return self>=value.

__gt__(value) #

Return self>value.

__le__(value) #

Return self<=value.

__lt__(value) #

Return self<value.

__ne__(value) #

Return self!=value.

all() #

Requires that all elements match when the underlying property is list-like.

any() #

Requires that any element matches when the underlying property is list-like.

avg() #

Averages list elements when the underlying property is numeric and list-like.

contains(value) #

Checks whether the property's string representation contains the given value.

Parameters:

Name Type Description Default
value Prop

Substring that must appear within the value.

required

Returns:

Type Description
FilterExpr

A filter expression evaluating substring search.

ends_with(value) #

Checks whether the property's string representation ends with the given value.

Parameters:

Name Type Description Default
value Prop

Suffix to check for.

required

Returns:

Type Description
FilterExpr

A filter expression evaluating suffix matching.

first() #

Selects the first element when the underlying property is list-like.

Performs fuzzy matching against the property's string value.

Uses a specified Levenshtein distance and optional prefix matching.

Parameters:

Name Type Description Default
prop_value str

String to approximately match against.

required
levenshtein_distance int

Maximum allowed Levenshtein distance.

required
prefix_match bool

Whether to require a matching prefix.

required

Returns:

Type Description
FilterExpr

A filter expression performing approximate text matching.

is_in(values) #

Checks whether the property is contained within the specified iterable of values.

Parameters:

Name Type Description Default
values list[Prop]

Iterable of property values to match against.

required

Returns:

Type Description
FilterExpr

A filter expression evaluating membership.

is_none() #

Checks whether the property value is None / missing.

Returns:

Type Description
FilterExpr

A filter expression evaluating value is None.

is_not_in(values) #

Checks whether the property is not contained within the specified iterable of values.

Parameters:

Name Type Description Default
values list[Prop]

Iterable of property values to exclude.

required

Returns:

Type Description
FilterExpr

A filter expression evaluating non-membership.

is_some() #

Checks whether the property value is present (not None).

Returns:

Type Description
FilterExpr

A filter expression evaluating value is not None.

last() #

Selects the last element when the underlying property is list-like.

len() #

Returns the list length when the underlying property is list-like.

max() #

Returns the maximum list element when the underlying property is list-like.

min() #

Returns the minimum list element when the underlying property is list-like.

not_contains(value) #

Checks whether the property's string representation does not contain the given value.

Parameters:

Name Type Description Default
value Prop

Substring that must not appear within the value.

required

Returns:

Type Description
FilterExpr

A filter expression evaluating substring exclusion.

starts_with(value) #

Checks whether the property's string representation starts with the given value.

Parameters:

Name Type Description Default
value Prop

Prefix to check for.

required

Returns:

Type Description
FilterExpr

A filter expression evaluating prefix matching.

sum() #

Sums list elements when the underlying property is numeric and list-like.