class_docstr: Defines a container of event triggers' metadata.
class_docstr_tok: ["Defines","a","container","of","event","triggers","'","metadata","."]
docstr: If triggering events are runs, `key` corresponds to the flow name of the triggering run.
  Otherwise, `key` corresponds to the event name and a `MetaflowEvent` object is returned.
  
  Returns
  -------
  Run or MetaflowEvent
      `Run` object if triggered by a run. Otherwise returns a `MetaflowEvent`.
docstr_tok: ["If","triggering","events","are","runs",",","`","key","`","corresponds","to","the","flow","name","of","the","triggering","run",".","Otherwise",",","`","key","`","corresponds","to","the","event","name","and","a","`","MetaflowEvent","`","object","is","returned",".","Returns","--","--","--","-","Run","or","MetaflowEvent","`","Run","`","object","if","triggered","by","a","run",".","Otherwise","returns","a","`","MetaflowEvent","`","."]
code: def __getitem__(self, key):
      """
      If triggering events are runs, `key` corresponds to the flow name of the triggering run.
      Otherwise, `key` corresponds to the event name and a `MetaflowEvent` object is returned.
  
      Returns
      -------
      Run or MetaflowEvent
          `Run` object if triggered by a run. Otherwise returns a `MetaflowEvent`.
      """
      if self.runs:
          for run in self.runs:
              if run.path_components[0] == key:
                  return run
      elif self.events:
          for event in self.events:
              if event.name == key:
                  return event
      raise KeyError(key)
  
file_path: metaflow/metaflow/events.py
imports: from collections import OrderedDict, namedtuple
  from datetime import datetime
label_desc: Use image node_id 7 for calling the Trigger obj's underlying member method code with example usage: obj.__getitem__(key) and returns: run, event