meta.decompile - decompile code objects into ast nodes

Decompiler module.

This module can decompile arbitrary code objects into a python ast.


Decompile a function into ast.FunctionDef node.

Parameters:func – python function (can not be a built-in)
Returns:ast.FunctionDef instance.
meta.decompile.compile_func(ast_node, filename, globals, **defaults)[source]

Compile a function from an ast.FunctionDef instance.

  • ast_node – ast.FunctionDef instance
  • filename – path where function source can be found.
  • globals – will be used as func_globals

A python function object

meta.decompile.decompile_pyc(bin_pyc, output=<open file '<stdout>', mode 'w' at 0x23f078>)[source]

decompile apython pyc or pyo binary file.

  • bin_pyc – input file objects
  • output – output file objects

Previous topic

meta.asttools - operate on python ast nodes

This Page