<commit_before>from direct.showbase.DirectObject import DirectObject


class InputMapper(DirectObject):

    def __init__(self, config, verbose=False):
        self.verbose = verbose

        # Setup input map
        self.input_map = {}
        with open(config) as f:
            for ln in f.readlines():
                ln = ln.strip()
                if not ln.startswith(';'):
                    ln = ln.split('=')
                    triggers = [i.strip() for i in ln[1].strip().split(',')]
                    event = ln[0].strip()

                    for trigger in triggers:
                        if trigger in self.input_map:
                            self.input_map[trigger].append(event)
                        else:
                            self.input_map[trigger] = [event]

        if self.verbose:
            import pprint
            print('Loaded input map')
            pprint.pprint(self.input_map)

        # Listen for events<commit_msg>Input Mapper: Allow blank lines.<commit_after>from direct.showbase.DirectObject import DirectObject


class InputMapper(DirectObject):

    def __init__(self, config, verbose=False):
        self.verbose = verbose

        # Setup input map
        self.input_map = {}
        with open(config) as f:
            for ln in f.readlines():
                ln = ln.strip()
                if ln and not ln.startswith(';'):
                    ln = ln.split('=')
                    triggers = [i.strip() for i in ln[1].strip().split(',')]
                    event = ln[0].strip()

                    for trigger in triggers:
                        if trigger in self.input_map:
                            self.input_map[trigger].append(event)
                        else:
                            self.input_map[trigger] = [event]

        if self.verbose:
            import pprint
            print('Loaded input map')
            pprint.pprint(self.input_map)

        # Listen for events
{'fraction_non_alphanumeric': 0.09867751780264497, 'fraction_numerical': 0.002034587995930824, 'mean_word_length': 1.3585131894484412, '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': '7418460', 'n_tokens_mistral': 542, 'n_tokens_neox': 492, 'n_words': 129}