(file_name, **kwargs)
return exch.import_dict_str(file_src=file_src, delta=delta, callback=callback, tmpl=use_template)
Imports curves and surfaces from files in YAML format.

    .. note::

        Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.

    Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.

    :param file_name: name of the input file
    :type file_name: str
    :return: a list of rational spline geometries
    :rtype: list
    :raises GeomdlException: an error occurred reading the file
Imports curves and surfaces from files in YAML format.
Imports curves and surfaces from files in YAML format .
def import_yaml(file_name, **kwargs):
    """ Imports curves and surfaces from files in YAML format.

    .. note::

        Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.

    Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.

    :param file_name: name of the input file
    :type file_name: str
    :return: a list of rational spline geometries
    :rtype: list
    :raises GeomdlException: an error occurred reading the file
    """
    def callback(data):
        yaml = YAML()
        return yaml.load(data)

    # Check if it is possible to import 'ruamel.yaml'
    try:
        from ruamel.yaml import YAML
    except ImportError:
        raise exch.GeomdlException("Please install 'ruamel.yaml' package to use YAML format: pip install ruamel.yaml")

    # Get keyword arguments
    delta = kwargs.get('delta', -1.0)
    use_template = kwargs.get('jinja2', False)

    # Read file
    file_src = exch.read_file(file_name)

    # Import data
    return exch.import_dict_str(file_src=file_src, delta=delta, callback=callback, tmpl=use_template)
def import_yaml ( file_name , * * kwargs ) : def callback ( data ) : yaml = YAML ( ) return yaml . load ( data ) # Check if it is possible to import 'ruamel.yaml' try : from ruamel . yaml import YAML except ImportError : raise exch . GeomdlException ( "Please install 'ruamel.yaml' package to use YAML format: pip install ruamel.yaml" ) # Get keyword arguments delta = kwargs . get ( 'delta' , - 1.0 ) use_template = kwargs . get ( 'jinja2' , False ) # Read file file_src = exch . read_file ( file_name ) # Import data return exch . import_dict_str ( file_src = file_src , delta = delta , callback = callback , tmpl = use_template )