<commit_before>import Sofa

import os.path

def listToStr(x):
    """ concatenate lists for use with data.
    """
    return ' '.join(map(str, x))

def strToListFloat(s):
    """ Convert a string to a list of float
    """
    return map(float,s.split())

def getNode(rootNode, path):
    """ Return node at path or None if not found
    """
    currentNode = rootNode
    pathComponents = path.split('/')
    for c in pathComponents:
        if len(c)==0: # for leading '/' and in case of '//'
            continue
        currentNode = currentNode.getChild(c)
        if currentNode is None:
            print "SofaPython.Tools.findNode: can't find node at", path
            return None
    return currentNode

def meshLoader(parentNode, filename, name=None, **args):
    """ Insert the correct MeshLoader based on the filename extension
    """
    ext = os.path.splitext(filename)[1]
    if name is None:
        _name="loader_"+os.path.splitext(os.path.basename(filename))[0]
    else:
        _name=name
    if ext == ".obj":
        return parentNode.createObject('MeshObjLoader', filename=filename, triangulate="1", name=_name, **args)
    elif ext == ".vtu" or ext == ".vtk":
        return parentNode.createObject('MeshVTKLoader', filename=filename, triangulate="1", name=_name, **args)
    else:
        print "ERROR SofaPython.Tools.meshLoader: unknown mesh extension:", ext
        return None<commit_msg>remove the triangulate option from here<commit_after>import Sofa

import os.path

def listToStr(x):
    """ concatenate lists for use with data.
    """
    return ' '.join(map(str, x))

def strToListFloat(s):
    """ Convert a string to a list of float
    """
    return map(float,s.split())

def getNode(rootNode, path):
    """ Return node at path or None if not found
    """
    currentNode = rootNode
    pathComponents = path.split('/')
    for c in pathComponents:
        if len(c)==0: # for leading '/' and in case of '//'
            continue
        currentNode = currentNode.getChild(c)
        if currentNode is None:
            print "SofaPython.Tools.findNode: can't find node at", path
            return None
    return currentNode

def meshLoader(parentNode, filename, name=None, **args):
    """ Insert the correct MeshLoader based on the filename extension
    """
    ext = os.path.splitext(filename)[1]
    if name is None:
        _name="loader_"+os.path.splitext(os.path.basename(filename))[0]
    else:
        _name=name
    if ext == ".obj":
        return parentNode.createObject('MeshObjLoader', filename=filename, name=_name, **args)
    elif ext == ".vtu" or ext == ".vtk":
        return parentNode.createObject('MeshVTKLoader', filename=filename, name=_name, **args)
    else:
        print "ERROR SofaPython.Tools.meshLoader: unknown mesh extension:", ext
        return None
{'fraction_non_alphanumeric': 0.12217514124293785, 'fraction_numerical': 0.002824858757062147, 'mean_word_length': 2.8808219178082193, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1561377', 'n_tokens_mistral': 848, 'n_tokens_neox': 842, 'n_words': 256}