class_docstr: Manages the recording of event invocations and provides simple event routing functionality.
  There is one EventService instance in every agent-environment loop, provided by the AgentEnvironmentContext.
  
  Within the environment the richer routing functionality provided by PubSub should be utilized, rather than
  directly interacting with this class.
class_docstr_tok: ["Manages","the","recording","of","event","invocations","and","provides","simple","event","routing","functionality",".","There","is","one","EventService","instance","in","every","agent-environment","loop",",","provided","by","the","AgentEnvironmentContext",".","Within","the","environment","the","richer","routing","functionality","provided","by","PubSub","should","be","utilized",",","rather","than","directly","interacting","with","this","class","."]
docstr: Notify this service about the start of a new step. This should only be called by
  the AgentEnvironmentContext.
  
  Clears all collected events and notifies all registered scopes.
docstr_tok: ["Notify","this","service","about","the","start","of","a","new","step",".","This","should","only","be","called","by","the","AgentEnvironmentContext",".","Clears","all","collected","events","and","notifies","all","registered","scopes","."]
code: def clear_events(self) -> None:
      """
      Notify this service about the start of a new step. This should only be called by
      the AgentEnvironmentContext.
  
      Clears all collected events and notifies all registered scopes.
      """
  
      # clear events
      for topic in self.topics.values():
          topic.events.clear()
  
      # always clear the pubsub events to ensure that no events in the RewardAggregator are left
      self.clear_pubsub()
  
file_path: maze/maze/core/events/event_service.py
imports: from abc import ABC, abstractmethod
  from collections import deque
  from typing import Dict, TypeVar, Type, Set, Generator
  from maze.core.events.event_record import EventRecord
  from maze.core.events.event_topic_factory import event_topic_factory
label_desc: Use image node_id 5 for calling the EventService obj's underlying member method code with example usage: obj.clear_events() without return types