class_docstr: A tracker wrapper that caches the state creation of the tracker.
class_docstr_tok: ["A","tracker","wrapper","that","caches","the","state","creation","of","the","tracker","."]
docstr: Generates and caches the past states of this tracker based on the history.
  
  Args:
      domain: a :class:`rasa.shared.core.domain.Domain`
      omit_unset_slots: If `True` do not include the initial values of slots.
  
  Returns:
      A list of states
docstr_tok: ["Generates","and","caches","the","past","states","of","this","tracker","based","on","the","history",".","Args",":","domain",":","a",":","class",":","`","rasa.shared.core.domain.Domain","`","omit_unset_slots",":","If","`","True","`","do","not","include","the","initial","values","of","slots",".","Returns",":","A","list","of","states"]
code: def past_states_for_hashing(
      self, domain: Domain, omit_unset_slots: bool = False
  ) -> Deque[FrozenState]:
      """Generates and caches the past states of this tracker based on the history.
  
      Args:
          domain: a :class:`rasa.shared.core.domain.Domain`
          omit_unset_slots: If `True` do not include the initial values of slots.
  
      Returns:
          A list of states
      """
      if domain != self.domain:
          raise ValueError(
              "TrackerWithCachedStates cannot be used with a domain "
              "that is different from the one it was created with."
          )
  
      if omit_unset_slots:
          # the tracker caches states with omit_unset_slots=False
          # Retrieving them from cache with omit_unset_slots=True is not possible as
          # this information is lost after a position in the event stream is turned
          # into a state
          states = super().past_states(
              domain, omit_unset_slots=omit_unset_slots
          )
          states_for_hashing = deque(
              self.freeze_current_state(s) for s in states
          )
      else:
          # if don't have it cached, we use the domain to calculate the states
          # from the events
          # note: we ignore omit_unset_slots here as the cache was generated
          # with the default value
          states_for_hashing = self._states_for_hashing
          if not states_for_hashing:
              states = super().past_states(domain)
              states_for_hashing = deque(
                  self.freeze_current_state(s) for s in states
              )
  
          self._states_for_hashing = states_for_hashing
  
      return states_for_hashing
  
imports: from collections import defaultdict, namedtuple, deque
  import copy
  import logging
  import random
  from contextlib import contextmanager
  from tqdm import tqdm
  from typing import Optional, List, Text, Set, Dict, Tuple, Deque, DefaultDict, Any, Iterable, Generator
  from rasa.shared.constants import DOCS_URL_STORIES
  from rasa.shared.core.constants import SHOULD_NOT_BE_SET
  from rasa.shared.core.domain import Domain, State
  from rasa.shared.core.events import ActionExecuted, UserUttered, ActionReverted, UserUtteranceReverted, Restarted, Event, SlotSet, ActiveLoop
  from rasa.shared.core.trackers import DialogueStateTracker, FrozenState
  from rasa.shared.core.slots import Slot
  from rasa.shared.core.training_data.structures import StoryGraph, STORY_START, StoryStep, RuleStep, GENERATED_CHECKPOINT_PREFIX
  from rasa.shared.utils.io import is_logging_disabled
  import rasa.shared.utils.io
label_desc: Use image node_id 3 for calling the TrackerWithCachedStates obj's underlying member method code with example usage: obj.past_states_for_hashing(domain, omit_unset_slots) and returns: states_for_hashing