<commit_before>try:
    from builtins import object
except ImportError:
    #python2
    pass
from functools import partial
from collections import defaultdict, OrderedDict

def listify(obj):
    return obj if isinstance(obj, list) or obj is None else [obj]


class State(object):

    def __init__(self, name, on_enter=None, on_exit=None):
        """
        Args:
            name (string): The name of the state
            on_enter (string, list): Optional callable(s) to trigger when a state 
                is entered. Can be either a string providing the name of a callable, 
                or a list of strings.
            on_exit (string, list): Optional callable(s) to trigger when a state 
                is exited. Can be either a string providing the name of a callable, 
                or a list of strings.
        """
        self.name = name
        self.on_enter = listify(on_enter) if on_enter else []<commit_msg>isinstance() can check against multiple types<commit_after>try:
    from builtins import object
except ImportError:
    #python2
    pass
from functools import partial
from collections import defaultdict, OrderedDict

def listify(obj):
    return obj if isinstance(obj, (list, type(None))) else [obj]


class State(object):

    def __init__(self, name, on_enter=None, on_exit=None):
        """
        Args:
            name (string): The name of the state
            on_enter (string, list): Optional callable(s) to trigger when a state 
                is entered. Can be either a string providing the name of a callable, 
                or a list of strings.
            on_exit (string, list): Optional callable(s) to trigger when a state 
                is exited. Can be either a string providing the name of a callable, 
                or a list of strings.
        """
        self.name = name
        self.on_enter = listify(on_enter) if on_enter else []
{'fraction_non_alphanumeric': 0.06869428421604615, 'fraction_numerical': 0.001048767697954903, 'mean_word_length': 2.3067590987868285, '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': '616217', 'n_tokens_mistral': 523, 'n_tokens_neox': 500, 'n_words': 220}