<commit_before>from pwd import getpwnam
from subprocess import PIPE, Popen, call

shells = {
    'bash': '/bin/bash',
    'zsh': '/bin/zsh',
    'tmux': '/usr/bin/tmux'
}


def try_getpwnam(name):
    try:
        return getpwnam(name)
    except KeyError:
        return None


def create_user(username, full_name, room_number, work_phone, home_phone):
    gecos = ','.join([full_name, room_number, work_phone, home_phone])
    return call(['sudo', '-n', '/usr/local/sbin/kraller_adduser', gecos, username])


def add_ssh_key(username, ssh_key):
    #TODO validate ssh keys
    s = Popen(['sudo', '-n', '-H', '-u', username, '/usr/local/bin/add_ssh_key'], stdin=PIPE)
    s.stdin.write(ssh_key + "\n")
    s.stdin.close()
    return s.wait()


def change_gecos(username, gecos):
    return subprocess.call(['sudo', '-n', 'usermod', '-c', gecos, username])


def change_shell(username, shell):
    return subprocess.call(['sudo', '-n', 'usermod', '-s', shells[shell], username])<commit_msg>Fixed two nonexistent references.  Thanks, pyflakes!<commit_after>from pwd import getpwnam
from subprocess import PIPE, Popen, call

shells = {
    'bash': '/bin/bash',
    'zsh': '/bin/zsh',
    'tmux': '/usr/bin/tmux'
}


def try_getpwnam(name):
    try:
        return getpwnam(name)
    except KeyError:
        return None


def create_user(username, full_name, room_number, work_phone, home_phone):
    gecos = ','.join([full_name, room_number, work_phone, home_phone])
    return call(['sudo', '-n', '/usr/local/sbin/kraller_adduser', gecos, username])


def add_ssh_key(username, ssh_key):
    #TODO validate ssh keys
    s = Popen(['sudo', '-n', '-H', '-u', username, '/usr/local/bin/add_ssh_key'], stdin=PIPE)
    s.stdin.write(ssh_key + "\n")
    s.stdin.close()
    return s.wait()


def change_gecos(username, gecos):
    return call(['sudo', '-n', 'usermod', '-c', gecos, username])


def change_shell(username, shell):
    return call(['sudo', '-n', 'usermod', '-s', shells[shell], username])
{'fraction_non_alphanumeric': 0.17676514772158236, 'fraction_numerical': 0.0, 'mean_word_length': 3.849514563106796, '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': '3681099', 'n_tokens_mistral': 768, 'n_tokens_neox': 730, 'n_words': 170}