Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def code_info(cls, code: Bytecode) -> PyCodeInfo[Repr]:
cfg = ControlFlowGraph.from_bytecode(code)
current = cls.empty()
run_machine(
Interpreter(code.first_lineno).abs_i_cfg(cfg), current)
glob_deps = tuple(current.globals)
instrs = current.instrs
instrs = current.pass_push_pop_inline(instrs)
return PyCodeInfo(code.name, tuple(glob_deps), code.argnames,
code.freevars, code.cellvars, code.filename,
code.first_lineno, code.argcount,
code.kwonlyargcount,
bool(code.flags & CompilerFlags.GENERATOR),
bool(code.flags & CompilerFlags.VARKEYWORDS),
bool(code.flags & CompilerFlags.VARARGS),
instrs)