Renders Python dataclasses out of sen type sets. Stateful (caches the loaded inja templates), so prefer reusing one instance across calls when possible.
More...
#include <python.h>
|
| static void | replaceInvalidCharacters (std::string &str) |
| | Sanitises a string so it is a valid Python identifier fragment by replacing the characters Python forbids in module/file names (., -) with underscores.
|
Renders Python dataclasses out of sen type sets. Stateful (caches the loaded inja templates), so prefer reusing one instance across calls when possible.
◆ PythonGenerator()
| sen::gen::PythonGenerator::PythonGenerator |
( |
| ) |
|
◆ ~PythonGenerator()
| sen::gen::PythonGenerator::~PythonGenerator |
( |
| ) |
|
◆ generateModule()
| std::string sen::gen::PythonGenerator::generateModule |
( |
const sen::lang::TypeSet & | typeSet | ) |
|
|
nodiscard |
Renders one Python module for the supplied type set. Imports are derived from the type set's importedSets and rendered as from <module> import * lines.
◆ replaceInvalidCharacters()
| void sen::gen::PythonGenerator::replaceInvalidCharacters |
( |
std::string & | str | ) |
|
|
static |
Sanitises a string so it is a valid Python identifier fragment by replacing the characters Python forbids in module/file names (., -) with underscores.
The documentation for this class was generated from the following file: