class_docstr: Event aggregation object.
      
class_docstr_tok: ["Event","aggregation","object","."]
docstr: Return all events collected at the current env step matching one or more given event types. The event
  types are specified by the interface member function object itself.
  
  Event calls are recorded as EventRecord, an object providing access to the passed arguments of the event
  method.
  
  :param event_spec:  Specifies the event type by the interface member function. Can either be a single event
                      type specification or a list of specifications.
  :return:            An iterable to the event objects.
docstr_tok: ["Return","all","events","collected","at","the","current","env","step","matching","one","or","more","given","event","types",".","The","event","types","are","specified","by","the","interface","member","function","object","itself",".","Event","calls","are","recorded","as","EventRecord",",","an","object","providing","access","to","the","passed","arguments","of","the","event","method",".",":","param","event_spec",":","Specifies","the","event","type","by","the","interface","member","function",".","Can","either","be","a","single","event","type","specification","or","a","list","of","specifications",".",":","return",":","An","iterable","to","the","event","objects","."]
code: def query_events(
      self, event_spec: Union[Callable, Iterable[Callable]]
  ) -> Iterable:
      """Return all events collected at the current env step matching one or more given event types. The event
      types are specified by the interface member function object itself.
  
      Event calls are recorded as EventRecord, an object providing access to the passed arguments of the event
      method.
  
      :param event_spec:  Specifies the event type by the interface member function. Can either be a single event
                          type specification or a list of specifications.
      :return:            An iterable to the event objects.
      """
  
      # normalize event specification, convert to a list with a single item if necessary
      if not isinstance(event_spec, Iterable):
          event_spec = [event_spec]
  
      for ev in event_spec:
          assert (
              self._get_class_that_defined_method(ev)
              in self.get_interfaces()
          ), (
              f"Event {ev} queried, but class not subscribed. Check your get_interfaces() implementation "
              f"{self.get_interfaces()}."
          )
  
      return self.events.query_events(event_spec)
  
file_path: maze/maze/core/events/pubsub.py
imports: import inspect
  from abc import ABC, abstractmethod
  from typing import Callable, List, Iterable, Dict, Union, Type, TypeVar
  from maze.core.events.event_collection import EventCollection
  from maze.core.events.event_service import EventScope, EventRecord, EventService
label_desc: Use image node_id 5 for calling the Subscriber obj's underlying member method code with example usage: obj.query_events(event_spec) and returns: self