<commit_before>from urlparse import urlparse
from addons.osfstorage import settings as osfstorage_settings
from framework.auth.core import Auth

def create_test_file(node, user, filename='test_file', create_guid=True):
    osfstorage = node.get_addon('osfstorage')
    root_node = osfstorage.get_root()
    test_file = root_node.append_file(filename)

    if create_guid:
        test_file.get_guid(create=True)

    test_file.create_version(user, {
        'object': '06d80e',
        'service': 'cloud',
        osfstorage_settings.WATERBUTLER_RESOURCE: 'osf',
    }, {
        'size': 1337,
        'contentType': 'img/png'
    }).save()

    root_node.add_log(
        'osf_storage_file_added',
        auth=Auth(user),
        params={
            'node': root_node._id,
            'project': root_node.parent_id,
            'path': test_file.materialized_path,
            'params_file':  '/project/{}/files/osfstorage/{}/'.format(root_node._id, test_file._id)
        },
    )
    root_node.save()

    return test_file

def urlparse_drop_netloc(url):
    url = urlparse(url)
    if url[4]:
        return url[2] + '?' + url[4]
    return url[2]<commit_msg>fix test<commit_after>from urlparse import urlparse
from addons.osfstorage import settings as osfstorage_settings
from framework.auth.core import Auth

def create_test_file(node, user, filename='test_file', create_guid=True):
    osfstorage = node.get_addon('osfstorage')
    root_node = osfstorage.get_root()
    test_file = root_node.append_file(filename)

    if create_guid:
        test_file.get_guid(create=True)

    test_file.create_version(user, {
        'object': '06d80e',
        'service': 'cloud',
        osfstorage_settings.WATERBUTLER_RESOURCE: 'osf',
    }, {
        'size': 1337,
        'contentType': 'img/png'
    }).save()

    node.add_log(
        'osf_storage_file_added',
        auth=Auth(user),
        params={
            'node': node._id,
            'project': node.parent_id,
            'path': test_file.materialized_path,
            'params_file':  '/project/{}/files/osfstorage/{}/'.format(node._id, test_file._id)
        },
    )
    node.save()

    return test_file

def urlparse_drop_netloc(url):
    url = urlparse(url)
    if url[4]:
        return url[2] + '?' + url[4]
    return url[2]
{'fraction_non_alphanumeric': 0.12771503040834056, 'fraction_numerical': 0.010425716768027803, 'mean_word_length': 2.8003300330033003, 'pattern_counts': {'":': 0, '<': 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': '3902880', 'n_tokens_mistral': 791, 'n_tokens_neox': 770, 'n_words': 134}