corrupy.minimize — Python code minification¶
The minimize module implements tools the minification of python code.
- corrupy.minimize.minimize(code, remove_docs=True, obfuscate_globals=False, obfuscate_builtins=False, obfuscate_imports=False)¶
Minifies python code. code is a string of python code to be minified. The resulting minified python code is returned as a string as well.
If remove_docs is True, docstrings will automatically be stripped.
If obfuscate_globals is True, variable names in the global scope are not preserved.
If obfuscate_builtins is True, builtin functions can be rebound to compress the code.
If obfuscate_imports is True, imports might be renamed.
Utilities¶
- class corrupy.minimize.DocstringRemover¶
An ast.NodeTransformer that removes docstrings.
- class corrupy.minimize.DenseSourceGenerator¶
A codegen.SourceGenerator that generates very compact python code.