How to use the nml.parse function in nml

To help you get started, we’ve selected a few nml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neurokernel / neurokernel / neurokernel / neuroml / utils.py View on Github external
"""
    Load a Neurokernel NeuroML document.

    Parameters
    ----------
    file : str or file
        Input file name or handle.

    Returns
    -------
    nk_doc : neurokernel.neuroml.NeurokernelDoc
        Neurokernel NeuroML document root.
    """

    try:        
        nk_doc = parse(file)
    except:
        try:
            nk_doc = parseString(file.read())
        except:
            raise RuntimeError('cannot load file')

    return nk_doc