<commit_before>from django.conf import settings

from anonymized_activity_log.middleware import get_encryption_function

def anonymize_user(request):
    if getattr(request, 'user', None) and request.user.is_authenticated():
        user_str = str(str(request.user.pk) + settings.SECRET_KEY).encode('utf-8')
    else:
        user_str = str(str(0) + settings.SECRET_KEY).encode('utf-8')
<commit_msg>formatting<commit_after>from django.conf import settings

from anonymized_activity_log.middleware import get_encryption_function


def anonymize_user(request):
    if getattr(request, 'user', None) and request.user.is_authenticated():
        user_str = str(str(request.user.pk) + settings.SECRET_KEY).encode('utf-8')
    else:
        user_str = str(str(0) + settings.SECRET_KEY).encode('utf-8')

{'fraction_non_alphanumeric': 0.12060301507537688, 'fraction_numerical': 0.007537688442211055, 'mean_word_length': 5.037878787878788, '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': '3092408', 'n_tokens_mistral': 267, 'n_tokens_neox': 259, 'n_words': 46}