devana.code_generation.printers
Subpackages
- devana.code_generation.printers.default
- devana.code_generation.printers.default.attributeprinter
- devana.code_generation.printers.default.basictypeprinter
- devana.code_generation.printers.default.classprinter
- devana.code_generation.printers.default.commentprinter
- devana.code_generation.printers.default.defaultprinter
- devana.code_generation.printers.default.enumprinter
- devana.code_generation.printers.default.externcprinter
- devana.code_generation.printers.default.fileprinter
- devana.code_generation.printers.default.functionprinter
- devana.code_generation.printers.default.functiontypeprinter
- devana.code_generation.printers.default.namespaceprinter
- devana.code_generation.printers.default.stubtypeprinter
- devana.code_generation.printers.default.templateparameterprinter
- devana.code_generation.printers.default.typedefprinter
- devana.code_generation.printers.default.typeexpressionprinter
- devana.code_generation.printers.default.unionprinter
- devana.code_generation.printers.default.usingnamespaceprinter
- devana.code_generation.printers.default.usingprinter
- devana.code_generation.printers.default.utilityprinters
- devana.code_generation.printers.default.variableprinter
devana.code_generation.printers.codeprinter
- class CodePrinter(configuration=None, is_fallback_allowed=False)[source]
Bases:
ICodePrinter
Collection of low-level printers for many types. CodePrinter will match correct printer to source object type.
- property configuration: PrinterConfiguration
- Return type
- property is_fallback_allowed: bool
Determines whether in the absence of a printer for a given type, it is possible to use a printer of its base type.
- Return type
bool
- class PrinterGroup[source]
Bases:
ICodePrinter
Collection of low-level printers for one type. Helps you find the right printer for context requirements.
devana.code_generation.printers.configuration
- class AttributeFilter(values, is_forbidden=False)[source]
Bases:
object
Filter for possible and forbidden attributes.
- is_forbidden: bool = False
- values: List[str]
- class AttributesCriteria(names=<factory>, namespaces=<factory>)[source]
Bases:
object
More specific attribute admissibility criteria.
- filter(attributes)[source]
- Return type
List
[AttributeDeclaration
]
- names: Optional[AttributeFilter]
List of allowed or forbidden attribute names.
- namespaces: Optional[AttributeFilter]
List of allowed or forbidden attribute namespaces.
- class Indent(character=IndentCharacter.SPACE, value=4, count=0)[source]
Bases:
object
Indent configuration. Value is the indent sign (space or tab) multiplier. For example value 2 mean indent 2 spaces. Count mean how many separated indent we have, for example count 3 mean 3 * value * character.
- character: IndentCharacter = 1
- count: int = 0
- value: int = 4
- class IndentCharacter(value)[source]
Bases:
Enum
Indent character to configure.
- SPACE = 1
- TAB = 2
- property character: str
- Return type
str
- class LineEndings(value)[source]
Bases:
Enum
Kind of used line endings.
- CR = 3
- CR_LF = 2
- LF = 1
- LINUX = 1
- MAC_OS = 3
- WINDOWS = 2
- property character: str
- Return type
str
- class PrinterConfiguration(line_ending=LineEndings.LF, indent=<factory>, attributes=<factory>)[source]
Bases:
object
Data structure that stores standard code printing settings e.g. newline format.
- attributes: AttributesCriteria
- line_ending: LineEndings = 1
devana.code_generation.printers.dispatcherinjectable
- class DispatcherInjectable(printer_dispatcher=None)[source]
Bases:
object
Mixin class for provide injectable ICodePrinter as internal printer for all types.
- property printer_dispatcher: ICodePrinter
- Return type
devana.code_generation.printers.formatter
- class Formatter(config)[source]
Bases:
object
A class that helps create text strings based on a known configuration.
- property line: str
Current processing line.
- Return type
str
- next_line()[source]
Format current processing line indent and newline character, next append it to text.
- property text: str
Result text.
- Return type
str
devana.code_generation.printers.icodeprinter
- class ICodePrinter[source]
Bases:
ABC
Common interface for all printers.
- property is_fallback_handler: bool
- Return type
bool
Printers module provides functionality to transform python representation of code to useful strings.