def read_custom_transformation_file()

in python/pipelines/pipeline_ops.py [0:0]


def read_custom_transformation_file(custom_transformation_file: str):
    """
    Reads a custom transformation file and returns the transformations as a list of dictionaries.

    Args:
        custom_transformation_file: The path to the custom transformation file.

    Returns:
        A list of dictionaries representing the custom transformations.

    Raises:
        FileNotFoundError: If the custom transformation file does not exist.
        JSONDecodeError: If the custom transformation file is not valid JSON.
    """
    
    transformations = None
    try:
        with open(custom_transformation_file, "r") as f:
            transformations = json.load(f)
    except FileNotFoundError:
        raise FileNotFoundError(f"Custom transformation file not found: {custom_transformation_file}")
    except json.JSONDecodeError:
        raise json.JSONDecodeError(f"Invalid JSON in custom transformation file: {custom_transformation_file}")
    
    return transformations