<commit_before>import argparse
import yaml
import pprint

PLAYER_FILE="player.yml"
from Thing import *
from Room import *
from Item import *
import Player

def status(args):
    print("I have some status")

def move(args):
    print("Moved to a place")

def act(args):
    print("Act in a way")

def look(args):
    with open('rooms.yml', 'r') as f:
        doc = yaml.load(f)
        txt = doc[player.data['room']]["desc"]
    print(txt)

parser = argparse.ArgumentParser(description='Play the Game')

# show status by default
parser.set_defaults(func=status)

subparsers = parser.add_subparsers()

moveparse = subparsers.add_parser('move', help='move somewhere')
moveparse.add_argument('args', metavar='ARG', type=int, nargs='*',
                       help='everything else')
moveparse.set_defaults(func=move)

actparse = subparsers.add_parser('act', help='act')
actparse.add_argument('args', metavar='ARG', type=int, nargs='*',
                      help='everything else')
actparse.set_defaults(func=act)

lookparse = subparsers.add_parser('look', help='look')
lookparse.add_argument('args', metavar='ARG', type=int, nargs='*',
                       help='everything else')
lookparse.set_defaults(func=look)

with open('rooms.yml', 'r') as f:
    doc = yaml.load(f)

pp = pprint.PrettyPrinter(indent=4) # I don't know why a class has to be instantiated to pretty print...
# pp.pprint(doc)

roomDictionary = {}

for roomName, dictionary in doc.items():
    roomDictionary[roomName] = Room(dictionary)

# pp.pprint(roomDictionary)

if __name__ == "__main__":
    player=Player.load(PLAYER_FILE)
    args = parser.parse_args()
    # func is set by set_defaults
    args.func(args)
    player.save(PLAYER_FILE)<commit_msg>spacing<commit_after>import argparse
import yaml
import pprint

PLAYER_FILE="player.yml"
from Thing import *
from Room import *
from Item import *
import Player

def status(args):
    print("I have some status")

def move(args):
    print("Moved to a place")

def act(args):
    print("Act in a way")

def look(args):
    with open('rooms.yml', 'r') as f:
        doc = yaml.load(f)
        txt = doc[player.data['room']]["desc"]
    print(txt)

parser = argparse.ArgumentParser(description='Play the Game')

# show status by default
parser.set_defaults(func=status)

subparsers = parser.add_subparsers()

moveparse = subparsers.add_parser('move', help='move somewhere')
moveparse.add_argument('args', metavar='ARG', type=int, nargs='*',
                       help='everything else')
moveparse.set_defaults(func=move)

actparse = subparsers.add_parser('act', help='act')
actparse.add_argument('args', metavar='ARG', type=int, nargs='*',
                      help='everything else')
actparse.set_defaults(func=act)

lookparse = subparsers.add_parser('look', help='look')
lookparse.add_argument('args', metavar='ARG', type=int, nargs='*',
                       help='everything else')
lookparse.set_defaults(func=look)

with open('rooms.yml', 'r') as f:
    doc = yaml.load(f)

pp = pprint.PrettyPrinter(indent=4) # I don't know why a class has to be instantiated to pretty print...
# pp.pprint(doc)

roomDictionary = {}

for roomName, dictionary in doc.items():
    roomDictionary[roomName] = Room(dictionary)

# pp.pprint(roomDictionary)

if __name__ == "__main__":
    player = Player.load(PLAYER_FILE)
    args = parser.parse_args()
    # func is set by set_defaults
    args.func(args)
    player.save(PLAYER_FILE)
{'fraction_non_alphanumeric': 0.14111498257839722, 'fraction_numerical': 0.0005807200929152149, 'mean_word_length': 4.134128166915052, 'pattern_counts': {'":': 2, '<': 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': '4676616', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1123, 'n_words': 270}