lale/schema_simplifier.py
def findRelevantFields(schema: JsonSchema) -> Optional[Set[str]]:
    """Either returns the relevant fields for the schema, or None if there was none specified"""
    if "allOf" in schema:
        fields_list: List[Optional[Set[str]]] = [
            findRelevantFields(s) for s in schema["allOf"]
        ]
        real_fields_list: List[Set[str]] = [f for f in fields_list if f is not None]
        if real_fields_list:
            return set.union(*real_fields_list)
        else:
            return None
    else:
        if "relevantToOptimizer" in schema:
            return set(schema["relevantToOptimizer"])
        else:
            return None

    # does not handle nested objects and nested relevant fields well
Either returns the relevant fields for the schema, or None if there was none specified
Either returns the relevant fields for the schema, or None if there was none specified
Either returns the relevant fields for the schema or None if there was none specified
def findRelevantFields(schema: JsonSchema) -> Optional[Set[str]]:
    if "allOf" in schema:
        fields_list: List[Optional[Set[str]]] = [
            findRelevantFields(s) for s in schema["allOf"]
        ]
        real_fields_list: List[Set[str]] = [f for f in fields_list if f is not None]
        if real_fields_list:
            return set.union(*real_fields_list)
        else:
            return None
    else:
        if "relevantToOptimizer" in schema:
            return set(schema["relevantToOptimizer"])
        else:
            return None
def findRelevantFields ( schema : JsonSchema ) -> Optional [ Set [ str ] ] : if "allOf" in schema : fields_list : List [ Optional [ Set [ str ] ] ] = [ findRelevantFields ( s ) for s in schema [ "allOf" ] ] real_fields_list : List [ Set [ str ] ] = [ f for f in fields_list if f is not None ] if real_fields_list : return set . union ( * real_fields_list ) else : return None else : if "relevantToOptimizer" in schema : return set ( schema [ "relevantToOptimizer" ] ) else : return None
Either returns the relevant fields for the schema, or None if there was none specified
Either returns the relevant fields for the schema or None if there was none specified
"""Either returns the relevant fields for the schema, or None if there was none specified""" # does not handle nested objects and nested relevant fields well
schema
JsonSchema