Decompile
Attributes related to decompiling Python objects.
warning
"Attempting to reverse-engineer, decompile, or modify the software" goes against Nighty's ToS.
Use at your own risk! Never share scripts that use these attributes publicly.
decompile
2.0.0
def nightylib.debug.decompile(obj: Any) -> Union[Suite, PyStatement]
A powerful function that allows you to decompile code objects back to source code, potentially bypassing restrictions imposed by PyArmor. It accepts a module, a function, a code object, or a string pointing to a .py or .pyc file as input.
The source code can be found here
Example: decompile a function
from nightylib.debug import decompile
def foo(x): return x
print(str(decompile(foo)).strip())
Output
def foo(x):
return x
tip
You can also import decompile directly from the original library:
from unpyc3 import decompile