ifgen.generation package#
Subpackages#
Submodules#
ifgen.generation.interface module#
A module defining generator interfaces.
- class ifgen.generation.interface.GenerateTask(name: str, generator: Generator, language: Language, path: Path, test_path: Path, instance: dict[str, Any], env: IfgenEnvironment)[source]#
- Bases: - NamedTuple- A container for instance-generation tasks. - boilerplate(includes: Iterable[str] = None, is_test: bool = False, use_namespace: bool = True, description: str | None = None, json: bool = False, parent_depth: int = 0) Iterator[IndentedFileWriter][source]#
- Create standard generation boilerplate and yield the file writer to use for writing the remaining content. 
 - check_custom_type(name: str) TypeLookup | None[source]#
- Check if a name refers to a custom type. 
 - property config: dict[str, Any]#
- Get the environment’s configuration data. 
 - cpp_namespace(data: str, header: bool = True, prefix: str = None) str[source]#
- Namespace a string with this task’s name. 
 - env: IfgenEnvironment#
- Alias for field number 6 
 - handle_namespace(stack: ExitStack, writer: IndentedFileWriter) None[source]#
- Write namespace boilerplate to a file. 
 - instance: dict[str, Any]#
- Alias for field number 5 
 - property is_cpp: bool#
- Determine if this task’s language is set to C++. 
 - property is_python: bool#
- Determine if this task’s language is set to Python. 
 - javadoc_header(writer: IndentedFileWriter, json: bool = False) None[source]#
- Write a standard file header. 
 - name: str#
- Alias for field number 0 
 - path: Path#
- Alias for field number 3 
 - resolve_description(description: str | None = None) str | None[source]#
- Attempt to resolve a config-driven description. 
 - source_boilerplate(includes: Iterable[str]) Iterator[IndentedFileWriter][source]#
- Create standard generation boilerplate for a source file. 
 - property source_path: Path#
- Get a source file for this task. 
 - property stream_implementation: bool#
- Determine if this instances should include a stream implementations. 
 - test_path: Path#
- Alias for field number 4 
 
- class ifgen.generation.interface.TypeLookup(name: str, final: str, generator: Generator)[source]#
- Bases: - NamedTuple- A container for type-lookup results. - final: str#
- Alias for field number 1 
 - name: str#
- Alias for field number 0 
 
ifgen.generation.json module#
A module for generating methods that store JSON strings.
- ifgen.generation.json.to_json_method(task: GenerateTask, writer: IndentedFileWriter, data: dict[str, Any], task_name: bool = True, static: bool = False, dumps_indent: int = None, definition: bool = False, inline: bool = False) None[source]#
- Create a _json() method for a given task. 
ifgen.generation.test module#
A module implementing unit-testing related generation utilities.
- ifgen.generation.test.unit_test_boilerplate(task: GenerateTask, includes: list[str] = None, main: bool = True, declare_namespace: bool = False) Iterator[IndentedFileWriter][source]#
- Handle standard unit-test boilerplate. 
- ifgen.generation.test.unit_test_main(task: GenerateTask, writer: IndentedFileWriter, description: bool = True) Iterator[None][source]#
- A method for generating main-function boilerplate for unit tests. 
- ifgen.generation.test.unit_test_method(name: str, task: GenerateTask, writer: IndentedFileWriter) Iterator[None][source]#
- Generate unit-test method boilerplate. 
- ifgen.generation.test.unit_test_method_name(name: str, task: GenerateTask) str[source]#
- Get the name of a unit test. 
Module contents#
A module implementing interfaces to facilitate code generation.
- ifgen.generation.resolve_generators(env: IfgenEnvironment) dict[Generator, list[Callable[[GenerateTask], None]]][source]#
- Populate any custom generator interfaces defined in the configuration. 
