<commit_before>class StateMachine(object):
    def __init__(self,RequiredStates,InitialState=0):
    
        self.States = RequiredStates
        self.StateCodes = dict([(v,k) for k,v in RequiredStates.iteritems()]) # This is done for speed of the rest of the class
        
        self.SwitchTo(InitialState)
        
        for StateCodes,States in self.States.iteritems():
            setattr(StateMachine,States,StateCodes)
            
    def SwitchTo(self,NewState):
        if type(NewState) is int:
            self.CurrentCode = NewState
        else:
            self.CurrentCode = self.StateCodes[NewState]
    def CurrentState(self):
        return self.States[self.CurrentCode]
    def __eq__(self,other):
        return self.CurrentCode == other
        <commit_msg>Enable Dictionaries or Lists to create the Machine<commit_after>class StateMachine(object):
    def __init__(self,RequiredStates,InitialState=0):
    
        if type(RequiredStates) is dict:
            self.States = RequiredStates
            self.StateCodes = dict([(code,state) for state,code in RequiredStates.iteritems()]) # This is done for speed of the rest of the class
        elif type(RequiredStates) is list:
            self.States = dict([(code,state) for code,state in enumerate(RequiredStates)])
            self.StateCodes = dict([(state,code) for code,state in enumerate(RequiredStates)])

        self.SwitchTo(InitialState)
        
        for StateCodes,States in self.States.iteritems():
            setattr(StateMachine,States,StateCodes)
            
    def SwitchTo(self,NewState):
        if type(NewState) is int:
            self.CurrentCode = NewState
        else:
            self.CurrentCode = self.StateCodes[NewState]
    def CurrentState(self):
        return self.States[self.CurrentCode]
    def __eq__(self,other):
        return self.CurrentCode == other
        
SM = StateMachine(['A','B'])
{'fraction_non_alphanumeric': 0.09169638308711156, 'fraction_numerical': 0.0010188487009679063, 'mean_word_length': 2.421602787456446, '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': '4783178', 'n_tokens_mistral': 540, 'n_tokens_neox': 524, 'n_words': 127}