

def create_new_file(obj, source, destination, destination_node):
    if (not source['materialized'].startswith('/')):
        source['materialized'] = ('/' + destination['materialized'])
    if (not destination['materialized'].startswith('/')):
        destination['materialized'] = ('/' + destination['materialized'])
    if (not source['path'].endswith('/')):
        data = dict(destination)
        new_file = FileNode.resolve_class(destination['provider'], FileNode.FILE).get_or_create(destination_node, destination['path'])
        if (destination['provider'] != 'osfstorage'):
            new_file.update(revision=None, data=data)
    else:
        new_file = find_and_create_file_from_metadata(destination.get('children', []), source, destination, destination_node, obj)
        if (not new_file):
            if (source['provider'] == 'box'):
                new_path = obj.referent.path
            else:
                new_path = obj.referent.materialized_path.replace(source['materialized'], destination['materialized'])
            new_file = FileNode.resolve_class(destination['provider'], FileNode.FILE).get_or_create(destination_node, new_path)
            new_file.name = new_path.split('/')[(- 1)]
            new_file.materialized_path = new_path
            new_file.save()
    return new_file

dataset/ETHPy150Open CenterForOpenScience/osf.io/website/project/views/comment.py create_new_file/VarMisuse@40/55 `source`->`destination`