<commit_before>import os
import subprocess
import errno

def cmd_pwd(*args):
    return subprocess.check_output(*args)

def cmd_ls(*args):
    return subprocess.check_output(*args)

def cmd_cd(*args):
    if args[0][1] == '~':
        args[0][1] = os.path.expanduser(args[0][1])
    os.chdir(args[0][1])
    return cmd_pwd()

def cmd_uname(*args):
    return subprocess.check_output(*args)

def cmd_mkdir(*args):
    try:
        if args[0][1][0] == '~':
            args[0][1] = os.path.expanduser(args[0][1])
	os.makedirs(args[0][1])
        return "Directory {0} created".format(args[0][1])
    except OSError as exception:
        if exception.errno != errno.EEXIST:
	    raise

def cmd_rmdir(*args):
    try:
        if args[0][1][0] == '~':
            args[0][1] = os.path.expanduser(args[0][1])
	os.removedirs(args[0][1])
        return "Directory {0} removed".format(args[0][1])
    except OSError as exception:
        if exception.errno != errno.EEXIST:
	    raise

def cmd_pipe(*args):
    p1 = subprocess.Popen(args[0][0], stdout=subprocess.PIPE)
    p2 = subprocess.Popen(args[0][1], stdin=p1.stdout, stdout=subprocess.PIPE)
    output = p2.communicate()[0]
    return output
 
cmds = {
    'pwd' : cmd_pwd,
    'ls'  : cmd_ls,
    'cd'  : cmd_cd,
    'mkdir': cmd_mkdir,
    'rmdir': cmd_rmdir,
    'uname' : cmd_uname,
    'pipe': cmd_pipe
}

if __name__ == '__main__':
    a = cmd_mkdir("~/ue/mhacks")
    print a<commit_msg>Add command for getting disk space<commit_after>import os
import subprocess
import errno

def cmd_pwd(*args):
    return subprocess.check_output(*args)

def cmd_ls(*args):
    return subprocess.check_output(*args)

def cmd_cd(*args):
    if args[0][1] == '~':
        args[0][1] = os.path.expanduser(args[0][1])
    os.chdir(args[0][1])
    return cmd_pwd()

def cmd_uname(*args):
    return subprocess.check_output(*args)

def cmd_df(*args):
    return subprocess.check_output(*args)

def cmd_mkdir(*args):
    try:
        if args[0][1][0] == '~':
            args[0][1] = os.path.expanduser(args[0][1])
	os.makedirs(args[0][1])
        return "Directory {0} created".format(args[0][1])
    except OSError as exception:
        if exception.errno != errno.EEXIST:
	    raise

def cmd_rmdir(*args):
    try:
        if args[0][1][0] == '~':
            args[0][1] = os.path.expanduser(args[0][1])
	os.removedirs(args[0][1])
        return "Directory {0} removed".format(args[0][1])
    except OSError as exception:
        if exception.errno != errno.EEXIST:
	    raise

def cmd_pipe(*args):
    p1 = subprocess.Popen(args[0][0], stdout=subprocess.PIPE)
    p2 = subprocess.Popen(args[0][1], stdin=p1.stdout, stdout=subprocess.PIPE)
    output = p2.communicate()[0]
    return output
 
cmds = {
    'pwd' : cmd_pwd,
    'ls'  : cmd_ls,
    'cd'  : cmd_cd,
    'mkdir': cmd_mkdir,
    'rmdir': cmd_rmdir,
    'uname' : cmd_uname,
    'df': cmd_df,
    'pipe': cmd_pipe
}

if __name__ == '__main__':
    a = cmd_mkdir("~/ue/mhacks")
    print a
{'fraction_non_alphanumeric': 0.1708542713567839, 'fraction_numerical': 0.02747068676716918, 'mean_word_length': 3.1820728291316525, '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': '3895042', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1155, 'n_words': 214}