<commit_before>"""
Some small file related utilities
"""

import string
import unicodedata

validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits)


def sanitize_filename(filename):
    cleanedFilename = unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore').lower()
    return ''.join(c for c in cleanedFilename if c in validFilenameChars).replace(' ', '_')
    <commit_msg>update of sanitize_name function<commit_after>"""
Some small file related utilities
"""
import os
from django.template.defaultfilters import slugify


def sanitize_filename(uncleaned_filename):
    fileName, fileExtension = os.path.splitext(uncleaned_filename)
    cleanedFilename = slugify(fileName)
    return (cleanedFilename + fileExtension).replace('-', '_')
{'fraction_non_alphanumeric': 0.12109375, 'fraction_numerical': 0.0, 'mean_word_length': 5.866071428571429, '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': '6861064', 'n_tokens_mistral': 230, 'n_tokens_neox': 222, 'n_words': 55}