defget_search_filter(search_filters: Sequence[SearchFilter], name: str, operator: str) -> Any: """ Finds the value of a search filter with the passed name and operator. If multiple values are found, returns the most restrictive value :param search_filters: collection of `SearchFilter` objects :param name: Name of the field to find :param operator: '<', '>' or '=' :return: The value of the field if found, else None """ ifnot search_filters: returnNone assert operator in ("<", ">", "=", "IN") comparator = maxif operator.startswith(">") elsemin found_val = None for search_filter in search_filters: # Note that we check operator with `startswith` here so that we handle # <, <=, >, >= if search_filter.key.name == name and search_filter.operator.startswith(operator): val = search_filter.value.raw_value found_val = comparator(val, found_val) if found_val else val return found_val
Mosu is located on the shore of Mosu Lake, facing the vast Chu Sea, backed by the Yihan Mountains. Thousands of miles of Mosu Desert can not erode the Mosu Valley. Thus the Mosu Empire was established.