<commit_before>try:
    import ultrajson as json
except ImportError:
    import json


class Controller(object):
    users = {}
    cached_details = {}
    detail_keys = [None] * 10

    @staticmethod
    def send_message(user, msg):
        if user in Controller.users:
            if Controller.cached_details.get(user):
                Controller.users[user](Controller.cached_details.get(user))
            Controller.users[user](msg)
        else:
            data = json.loads(msg)
            if 'display' in data.keys():
                current = Controller.cached_details.get(user, dict())
                for key in data['display']:
                    current[key].update(data['display'][key]
                Controller.cached_details[user] = current

    @staticmethod
    def connect_user(user, handle_function):
        Controller.users[user] = handle_function

    @staticmethod
    def disconnect_user(user):
        del Controller.users[user]

    @staticmethod
    def store_legend(legend_data):
        Controller.detail_keys[2] = ['Traps'] + legend_data['traps']
        Controller.detail_keys[3] = ['Objects'] + legend_data['objects']
        Controller.detail_keys[5] = ['Monsters'] + legend_data['monsters']
<commit_msg>Missing parentheses<commit_after>try:
    import ultrajson as json
except ImportError:
    import json


class Controller(object):
    users = {}
    cached_details = {}
    detail_keys = [None] * 10

    @staticmethod
    def send_message(user, msg):
        if user in Controller.users:
            if Controller.cached_details.get(user):
                Controller.users[user](Controller.cached_details.get(user))
            Controller.users[user](msg)
        else:
            data = json.loads(msg)
            if 'display' in data.keys():
                current = Controller.cached_details.get(user, dict())
                for key in data['display']:
                    current[key].update(data['display'][key])
                Controller.cached_details[user] = current

    @staticmethod
    def connect_user(user, handle_function):
        Controller.users[user] = handle_function

    @staticmethod
    def disconnect_user(user):
        del Controller.users[user]

    @staticmethod
    def store_legend(legend_data):
        Controller.detail_keys[2] = ['Traps'] + legend_data['traps']
        Controller.detail_keys[3] = ['Objects'] + legend_data['objects']
        Controller.detail_keys[5] = ['Monsters'] + legend_data['monsters']

{'fraction_non_alphanumeric': 0.11351784997994384, 'fraction_numerical': 0.004011231448054553, 'mean_word_length': 2.5730659025787967, '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': '1030036', 'n_tokens_mistral': 712, 'n_tokens_neox': 677, 'n_words': 137}