An equivilent to the Parser class in the parse module where rather than parsing marshalled code objects we parse a raw code object. The result being the creation of a PyCode object that UnPYC can then do it’s magic on
Traverse an object either in memory or from filesystem and decompile back to source through accessing code objects rather than .pyc files
Relies on the UnPyc decompiler: http://unpyc.sourceforge.net/
not parented by this module will not be traversed stops you diving down rabbit holes with ‘from foo import *‘
Leave as None is you want to recurse
Take an obfuscated .pyc file and decompile by grabbing the bytecode and unmarshaling with the obfuscating Python runtimes own marshalling code
The opcode remapping must already have taken place
If you have access to to files/filesystem and the runtime allows you access to it’s marshaller module use this, you will get the best output
My get doc function - wraps the inspect modules getdoc but adds in indentation and triple quotes so we can drop into a code listing
Get all top level instances into a usable string form, do not show builtins etc