<commit_before>import inspect
import os


class DelegatorMixin(object):
    def __init__(self):
        super(DelegatorMixin, self).__init__()
        self.delegates = set([])
        self.ordering = []
        
    def __getattr__(self, name):
        for delegate in self.ordering:
            try:
                return getattr(delegate, name)
            except:
                pass
        raise AttributeError(name)
            
    def add_delegate(self, delegate):
        if not delegate in self.delegates:
            self.delegates.add(delegate)
            self.ordering.append(delegate)
            
          
class Trigger(object):
    Null=0
    Start=1
    Stop=2
    Pause=3
    Cue=4
    Indicate=5
    Rest=6
    Up=7
    Right=8
    Down=9
    Left=10
    Complete=11
    UsageDefined=12
    UsageDefined1=13
    UsageDefined2=14
        
        
class switch(object):
    def __init__(self, value):
        self.value = value
        self.fall = False
            
    def __iter__(self):
        """Return the match method once, then stop"""
        yield self.match
        raise StopIteration
           
    def match(self, *args):
        """Indicate whether or not to enter a case suite"""
        if self.fall or not args:
            return True
        elif self.value in args:
            self.fall = True
            return True
        else:
            return False
              
              
class Resource(object):
    def __init__(self, path=None):
        if path == None:
            #os.path.dirname(inspect.getabsfile(unlock.Resource))
            self.path = os.path.dirname(inspect.getfile(Resource))+'/resource/'
        else:                
            self.path = path
        self.resources = []
        
    def reset_path(self, path):
        self.path = path
        
    def add_resource(self, resource):
        self.resources.append(resource)
            
            <commit_msg>Added a new Trigger type; there has got to be a better way to do this<commit_after>import inspect
import os


class DelegatorMixin(object):
    def __init__(self):
        super(DelegatorMixin, self).__init__()
        self.delegates = set([])
        self.ordering = []
        
    def __getattr__(self, name):
        for delegate in self.ordering:
            try:
                return getattr(delegate, name)
            except:
                pass
        raise AttributeError(name)
            
    def add_delegate(self, delegate):
        if not delegate in self.delegates:
            self.delegates.add(delegate)
            self.ordering.append(delegate)
            
          
class Trigger(object):
    Null=0
    Start=1
    Stop=2
    Pause=3
    Cue=4
    Indicate=5
    Rest=6
    Up=7
    Right=8
    Down=9
    Left=10
    Repeat=11
    Complete=12
    UsageDefined=13
    UsageDefined1=14
    UsageDefined2=15
        
        
class switch(object):
    def __init__(self, value):
        self.value = value
        self.fall = False
            
    def __iter__(self):
        """Return the match method once, then stop"""
        yield self.match
        raise StopIteration
           
    def match(self, *args):
        """Indicate whether or not to enter a case suite"""
        if self.fall or not args:
            return True
        elif self.value in args:
            self.fall = True
            return True
        else:
            return False
              
              
class Resource(object):
    def __init__(self, path=None):
        if path == None:
            #os.path.dirname(inspect.getabsfile(unlock.Resource))
            self.path = os.path.dirname(inspect.getfile(Resource))+'/resource/'
        else:                
            self.path = path
        self.resources = []
        
    def reset_path(self, path):
        self.path = path
        
    def add_resource(self, resource):
        self.resources.append(resource)
            
            
{'fraction_non_alphanumeric': 0.0840080971659919, 'fraction_numerical': 0.011639676113360324, 'mean_word_length': 1.5226547543075941, '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': '4495357', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1095, 'n_words': 278}