meta.decompile - decompile code objects into ast nodes

Decompiler module.

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

meta.decompile.decompile_func(func)[source]

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.

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

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.

Parameters:
  • bin_pyc – input file objects
  • output – output file objects

Previous topic

meta.asttools - operate on python ast nodes

This Page