mt_metadata.helper_functions ============================ .. py:module:: mt_metadata.helper_functions .. autoapi-nested-parse:: This module has some general helper functions that it isn't yet clear where they should live. These may not be needed at all after the pydantic upgrade is fully integrated. Functions --------- .. autoapisummary:: mt_metadata.helper_functions.validate_setter_input mt_metadata.helper_functions.cast_to_class_if_dict Module Contents --------------- .. py:function:: validate_setter_input(value, expected_class) Takes a setter's input and makes it a list if it not. Then asserts that every list element is of permissible type (dict or expected class) :param value: The input to the setter. :type value: Union[Dict, Base] :param expected_class: Some mt_metadata class that we want the setter work with :type expected_class: Base :returns: **value** -- List of elements for the setter all of type expected_class or dict. :rtype: list .. py:function:: cast_to_class_if_dict(obj, cls) :param obj: Either an mt_metadata object or its dict representaiton :type obj: Union[Dict, MetadataBase] :param cls: Some mt_metadata object that we want to get back :type cls: MetadataBase :rtype: either the input or the input dict cast to an mt_metadata object.