Skip to content

Explorer

hoodiney edited this page Mar 6, 2023 · 1 revision

Explorer

Explain some code gadgets in tango/core/explorer.py

class BaseExplorerContext(BaseDecorator)

self._start

_start is changed when the original input has caused a new state, its caps at the end of the new-state-causing input.

self._stop

_stop continues to add up while the instructions inside the input are iterated.

input_gen()

If self._sman._last_state.last_input is None, it will return the current input sliced by self._start and self._stop. Otherwise, it returns the concatenation of last_input and the sliced current input (by self._start and self._stop).

update_state()

Calls _generator.update_state and _strategy.update_state

update_transition()

Calls _generator.update_transition and _strategy.update_transition

___aiter___(self, input, orig)

Used as an async iter function to make the object an generator. It will iterate over the instructions inside the input. Everytime it updates the explorer, and checks if a state change has happened after the execution of an instruction (by the loader). If a state change happens within an input sequence, the input is split, where the first part is used as the transition and the second part continues to build up state for any following transition.