<commit_before>import os
from django.conf import settings
from uw_sws.dao import SWS_DAO
from userservice.user import UserService
from myuw.models import User
from uw_pws import PWS


def get_netid_of_current_user():
    return UserService().get_user()


def get_user_model():
    user_netid = get_netid_of_current_user()
    try:
        user = User.objects.get(uwnetid=user_netid)
    except User.DoesNotExist:
        user = User(uwnetid=user_netid)

    if not user.uwregid:
        user_regid = PWS().get_person_by_netid(user_netid).uwregid
        user.uwregid = user_regid
        user.save()

    return user


def is_using_file_dao():
    return SWS_DAO().get_implementation().is_mock()

<commit_msg>get_user_model explicit get or create<commit_after>import os
from django.conf import settings
from uw_sws.dao import SWS_DAO
from userservice.user import UserService
from myuw.models import User
from uw_pws import PWS


def get_netid_of_current_user():
    return UserService().get_user()


def get_user_model():
    user_netid = get_netid_of_current_user()
    try:
        user = User.objects.get(uwnetid=user_netid, uwregid=None)
    except User.DoesNotExist:
        user_regid = PWS().get_person_by_netid(user_netid).uwregid
        try:
            user = User.objects.get(uwnetid=user_netid, uwregid=user_regid)
        except User.DoesNotExist:
            user = User(uwnetid=user_netid, uwregid=user_regid)
            user.save()

    return user


def is_using_file_dao():
    return SWS_DAO().get_implementation().is_mock()


{'fraction_non_alphanumeric': 0.08338720103425985, 'fraction_numerical': 0.0, 'mean_word_length': 3.7195121951219514, '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': '5790902', 'n_tokens_mistral': 550, 'n_tokens_neox': 548, 'n_words': 109}