Pytype’s high-level workflow to analyse a single file1 is:
Loop over opcodes, updating state[^run-instruction]
state = run_instruction(op, state)
run_programto infer type signatures for all classes, methods and functions.
run_instruction is the central dispatch point for opcode analysis. For every
OP, we have a corresponding
looks this method up, calls it with the current state and the opcode, and uses
the return value as the new state.
TIP: If you want to get a feel for how pytype works, an excellent
starting point is to look at some of the
byte_* methods and see how they
mirror the workings of the python interpreter at a type level, popping arguments
off the stack, manipulating
globals dictionaries, and creating
objects for classes, methods and functions.