<commit_before>from google.appengine.api import users
from model import User

def create_user(google_user):
    user = User(
        google_user=google_user
    )
    user.put()
    return user

def get_or_create_current_user():
    google_user = users.get_current_user()
    user = get_user_model_for(google_user)
    if not user and users.is_current_user_admin():
        user = create_user(google_user)
    return user

def get_user_model_for(google_user=None):
    return User.all().filter('google_user =', google_user).get()

def get_user_model_by_id_or_nick(id_or_nick):
    if id_or_nick.isdigit():
        return User.get_by_id(int(id_or_nick))
    else:
        return User.all().filter('nickname_lower = ', id_or_nick.lower()).get()<commit_msg>Be more explicit in get_or_create_user<commit_after>from google.appengine.api import users
from model import User

def create_user(google_user):
    user = User(
        google_user=google_user
    )
    user.put()
    return user

def get_or_create_current_user():
    google_user = users.get_current_user()
    user = get_user_model_for(google_user)
    if not user and google_user and users.is_current_user_admin():
        user = create_user(google_user)
    return user

def get_user_model_for(google_user=None):
    return User.all().filter('google_user =', google_user).get()

def get_user_model_by_id_or_nick(id_or_nick):
    if id_or_nick.isdigit():
        return User.get_by_id(int(id_or_nick))
    else:
        return User.all().filter('nickname_lower = ', id_or_nick.lower()).get()
{'fraction_non_alphanumeric': 0.10071013557133635, 'fraction_numerical': 0.0, 'mean_word_length': 4.149501661129568, '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': '5571294', 'n_tokens_mistral': 529, 'n_tokens_neox': 528, 'n_words': 97}