Return a dictionary of triggers and their corresponding matches
        from the code.
329057
def collectTriggers(self, rgx, code):
        

        return {m.group(0): m for m in re.finditer(rgx, code)}
1354243
def trigger(self, target: str, trigger: str, parameters: Dict[str, Any]={}):
		
		pass
291807
def get_grp2codes(self):
        """"""
        grp2codes = cx.defaultdict(set)
        for code, ntd in self.code2nt.items():
            grp2codes[ntd.group].add(code)
        return dict(grp2codes)
185202
def triggers(self):
        
        self._triggers, value = self.get_attr_set(self._triggers, 'trigger')
        return value
673406
def trigger(self, event, *args):
        """"""
        for handler in self._event_handlers[event]:
            handler(*args)
528112
def get_alerts_for(self, trigger):
        
        assert trigger is not None
        assert isinstance(trigger.id, str), "Value must be a string"
        status, data = self.http_client.get_json(
            ALERTS_URI % trigger.id,
            params={'appid': self.API_key},
            headers={'Content-Type': 'application/json'})
        return [self.alert_parser.parse_dict(item) for item in data]
457166
def get_all_handlers(self) -> T.Dict[str, T.List[T.Callable]]:
        """"""

        events = {}
        for event, handlers in self._events.items():
            events[event] = list(handlers)
        return events
1302640
def from_json(data):
        """"""

        parsed_data = json.loads(data)
        trigger = TriggerInfo(
            parsed_data['trigger']['class'],
            parsed_data['trigger']['kind'],
        )

        # extract content type, needed to decode body
        content_type = parsed_data['content_type']

        return Event(body=Event.decode_body(parsed_data['body'], content_type),
                     content_type=content_type,
                     trigger=trigger,
                     fields=parsed_data.get('fields'),
                     headers=parsed_data.get('headers'),
                     _id=parsed_data['id'],
                     method=parsed_data['method'],
                     path=parsed_data['path'],
                     size=parsed_data['size'],
                     timestamp=datetime.datetime.utcfromtimestamp(parsed_data['timestamp']),
                     url=parsed_data['url'],
                     _type=parsed_data['type'],
                     type_version=parsed_data['type_version'],
                     version=parsed_data['version'])
1068780
def get_matches_lineno(code, fn_name):
    ""
    class Walker(ast.NodeVisitor):
        def __init__(self):
            self._hits = set()

        #pylint: disable=E0213,E1102    
        def onvisit(fn):
            def wrap(self, node):
                fn(self,node)
                super(Walker, self).generic_visit(node)
            return wrap
        
        @onvisit
        def visit_FunctionDef(self, node):
            if node.name == fn_name:
                self._hits.add(node)
            return node
        
        @property
        def hits(self):
            return list(sorted([n.lineno + 1 for n in self._hits]))
    
    walker = Walker()
    walker.visit(ast.parse(code))
    return walker.hits
871422
def map_exception_codes():
    ''''''
    werkex = inspect.getmembers(exceptions, lambda x: getattr(x, 'code', None))
    return {e.code: e for _, e in werkex}
1236945
def conditions(self, trigger_id):
        
        response = self._get(self._service_url(['triggers', trigger_id, 'conditions']))
        return  Condition.list_to_object_list(response)
688682
def mixin (cls):
    
    cls._events = {}
    cls.bind = Pyevent.bind.__func__
    cls.unbind = Pyevent.unbind.__func__
    cls.trigger = Pyevent.trigger.__func__
    return cls
1025029
def triggerLogicToStr(self):
        
        try:
            import json
        except ImportError:
            return "Cannot dump triggers/dependencies/executes (need json)"
        retval = "TRIGGERS:\n"+json.dumps(self._allTriggers, indent=3)
        retval += "\nDEPENDENCIES:\n"+json.dumps(self._allDepdcs, indent=3)
        retval += "\nTO EXECUTE:\n"+json.dumps(self._allExecutes, indent=3)
        retval += "\n"
        return retval
949386
def highlight_matches(self):
        """"""
        if self.is_code_editor and self.highlight_button.isChecked():
            text = self.search_text.currentText()
            words = self.words_button.isChecked()
            regexp = self.re_button.isChecked()
            self.editor.highlight_found_results(text, words=words,
                                                regexp=regexp)
387066
def run_triggers(step, pre_post, args=(), **kwargs):
    '''
    
    '''
    if not isinstance(step, str) or not isinstance(pre_post, str):
        return
    if trace_triggers:
        msg = 'Trigger for %s: %s' % (step, pre_post)
        sys.stderr.write(msg.center(80, '-') + '\n')
    if args is None:
        args = ()
    if not isinstance(args, tuple):
        return
    cfg = __get_config()
    if cfg is None:
        return
    if step not in cfg:
        return
    if not isinstance(cfg[step], dict):
        return
    if pre_post not in cfg[step]:
        return
    d = cfg[step][pre_post]
    l = d.get('cmdlist', [])
    if not l:
        return

    show_output = d.get('show_output', None)
    show_err = d.get('show_err', None)
    ignore_err = d.get('ignore_err', None)

    run_in_order(
        l,
        show_output=show_output,
        show_err=show_err,
        ignore_err=ignore_err,
        args=args,
        pre_post=pre_post,
        kwargs=kwargs
    )
200162
def has_ist_trigger(self):
        """"""
        triggers = self.template['spec'].get('triggers', [])
        if not triggers:
            return False
        for trigger in triggers:
            if trigger['type'] == 'ImageChange' and \
                    trigger['imageChange']['from']['kind'] == 'ImageStreamTag':
                return True
        return False
46151
def get_alerts_for_trigger(trigger_id)
      # TODO: add additional filters
      return [] unless trigger_id

      url = '/?triggerIds=' + trigger_id
      ret = http_get(url)
      val = []
      ret.each { |a| val.push(Alert.new(a)) }
      val
    end