meta.decompile - decompile code objects into ast nodes

Decompiler module.

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

meta.decompiler.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.decompiler.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.decompiler.decompile_pyc(bin_pyc, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

decompile apython pyc or pyo binary file.

Parameters
  • bin_pyc – input file objects

  • output – output file objects