lale.schema_simplifier module

lale.schema_simplifier.enumValues(es: set_with_str_for_keys[Any], s: Dict[str, Any]) set_with_str_for_keys[Any][source]

Given an enumeration set and a schema, return all the consistent values of the enumeration.

lale.schema_simplifier.filterForOptimizer(schema: Dict[str, Any]) Optional[Dict[str, Any]][source]
lale.schema_simplifier.findRelevantFields(schema: Dict[str, Any]) Optional[Set[str]][source]

Either returns the relevant fields for the schema, or None if there was none specified

lale.schema_simplifier.hasAllOperatorSchemas(schemas: List[Dict[str, Any]]) bool[source]
lale.schema_simplifier.hasAnyOperatorSchemas(schemas: List[Dict[str, Any]]) bool[source]
lale.schema_simplifier.impossible() Dict[str, Any][source]
lale.schema_simplifier.liftAllOf(schemas: List[Dict[str, Any]]) Iterable[Dict[str, Any]][source]

Given a list of schemas, if any of them are allOf schemas, lift them out to the top level

lale.schema_simplifier.liftAnyOf(schemas: List[Dict[str, Any]]) Iterable[Dict[str, Any]][source]

Given a list of schemas, if any of them are anyOf schemas, lift them out to the top level

lale.schema_simplifier.narrowSimplifyAndFilter(schema: Dict[str, Any], floatAny: bool) Optional[Dict[str, Any]][source]
lale.schema_simplifier.narrowToGivenRelevantFields(schema: Dict[str, Any], relevantFields: Set[str]) Dict[str, Any][source]
lale.schema_simplifier.narrowToRelevantConstraints(schema: Dict[str, Any]) Dict[str, Any][source]
lale.schema_simplifier.narrowToRelevantFields(schema: Dict[str, Any]) Dict[str, Any][source]
class lale.schema_simplifier.set_with_str_for_keys(elems: Union[Dict[str, VV], Iterable[VV]])[source]

Bases: Generic[VV]

This mimicks a set, but uses the string representation of the elements for comparison tests. It can be used for unhashable elements, as long as the str function is injective

difference(*others)[source]
intersection(*others: set_with_str_for_keys[VV])[source]
union(*others)[source]
lale.schema_simplifier.simplify(schema: Dict[str, Any], floatAny: bool) Dict[str, Any][source]

Tries to simplify a schema into an equivalent but more compact/simpler one. If floatAny if true, then the only anyOf in the return value will be at the top level. Using this option may cause a combinatorial blowup in the size of the schema

lale.schema_simplifier.simplifyAll(schemas: List[Dict[str, Any]], floatAny: bool) Dict[str, Any][source]
lale.schema_simplifier.simplifyAny(schema: List[Dict[str, Any]], floatAny: bool) Dict[str, Any][source]
lale.schema_simplifier.simplifyNot(schema: Dict[str, Any], floatAny: bool) Dict[str, Any][source]
lale.schema_simplifier.simplifyNot_(schema: Dict[str, Any], floatAny: bool, alreadySimplified: bool = False) Dict[str, Any][source]

alreadySimplified=true implies that schema has already been simplified

lale.schema_simplifier.toAllOfList(schema: Dict[str, Any]) List[Dict[str, Any]][source]
lale.schema_simplifier.toAnyOfList(schema: Dict[str, Any]) List[Dict[str, Any]][source]