Scanner io.text.scanner.StateScanner(patterns, first_state, engine=None) ¶ Bases: Generic[S] Single-pass scanner for state transitions. engine = engine instance-attribute ¶ first_state = first_state instance-attribute ¶ Initial state of the file. patterns property ¶ scan(buf) ¶ Single-pass scan of bytes to identify states and their transitions.