<commit_before>from uuid import uuid1


def get_upload_path(instance, filename):
    """
    Construct a unique S3 path for a source and filename.
    """
    # sometimes the source is the instance; sometimes an instance is passed in
    # that has a source attribute.
    if hasattr(instance, 'source'):
        source = instance.source
    elif hasattr(instance, '_meta'):
        source = instance._meta.app_label
    else:
        source = instance

    return '{0}{1}'.format(get_upload_dir(source=source), filename)


def get_upload_dir(source):
    """
    Construct a unique S3 key for a source.
    """
    return 'data-files/{0}/{1}/'.format(source, str(uuid1()))


def get_upload_dir_validator(source):
    """
    Return regexp string that should match a path generated by get_upload_dir.
    """
    return r'^member/uploaded-data/{0}/[0-9a-f-]{{32}}/\d+/'.format(
        source._meta.app_label)<commit_msg>🔧 data-files → member-files<commit_after>from uuid import uuid1


def get_upload_path(instance, filename):
    """
    Construct a unique S3 path for a source and filename.
    """
    # sometimes the source is the instance; sometimes an instance is passed in
    # that has a source attribute.
    if hasattr(instance, 'source'):
        source = instance.source
    elif hasattr(instance, '_meta'):
        source = instance._meta.app_label
    else:
        source = instance

    return '{0}{1}'.format(get_upload_dir(source=source), filename)


def get_upload_dir(source):
    """
    Construct a unique S3 key for a source.
    """
    return 'member-files/{0}/{1}/'.format(source, str(uuid1()))


def get_upload_dir_validator(source):
    """
    Return regexp string that should match a path generated by get_upload_dir.
    """
    return r'^member/uploaded-data/{0}/[0-9a-f-]{{32}}/\d+/'.format(
        source._meta.app_label)
{'fraction_non_alphanumeric': 0.12594187298170076, 'fraction_numerical': 0.013993541442411194, 'mean_word_length': 3.131111111111111, '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': '1161410', 'n_tokens_mistral': 575, 'n_tokens_neox': 564, 'n_words': 160}