validate_filter#

scikitplot.corpus.validate_filter(expression)[source]#

Return expression checked and frozen to the JSON-able form.

Parameters:
expressionFilter or mapping

A filter expression, or its JSON form.

Returns:
Filter

A new tree of the nine built-in operators holding only JSON scalars and naming only filterable fields: filter_from_dict(filter_to_dict( expression)). Nothing reachable from it can be mutated afterwards.

Raises:
TypeError

If expression is neither a Filter nor a mapping, or holds a node that is not one of the nine operators.

ValueError

As filter_from_dict and filter_to_dict.

Parameters:

expression (Any)

Return type:

Filter