PyMod is a library I wrote in the course of writing a Brainfuck to Python compiler. It allows programmatic generation of python programs/modules. Methods of the Program class are:
Adds an import to the module. Takes arguments where moduleName
is the name of a module or feature, and futureImport
is a boolean
stating if the first argument is a module or feature. (defaults to False
)
Adds a line to the program. Takes argument line
which is the line to add.
Outputs the full python code of the program. Takes 1 optional argument headers
which are comments/a docstring in a list to go at the
top of the file before any imports.