pyccel.codegen.printing.codeprinter module#
- class pyccel.codegen.printing.codeprinter.CodePrinter(verbose)[source]#
Bases:
object
The base class for code-printing subclasses.
The base class from which code printers inherit. The sub-classes should define a language and _print_X functions.
- Parameters:
verbose (int) – The level of verbosity.
- add_import(import_obj)[source]#
Add a new import to the current context.
Add a new import to the current context. This allows the import to be recognised at the compiling/linking stage. If the source of the import is not new then any new targets are added to the Import object.
- Parameters:
import_obj (Import) – The AST node describing the import.
- doprint(expr)[source]#
Print the expression as code.
Print the expression as code.
- Parameters:
expr (Expression) – The expression to be printed.
- Returns:
The generated code.
- Return type:
str
- get_additional_imports()[source]#
Get any additional imports collected during the printing stage.
Get any additional imports collected during the printing stage. This is necessary to correctly compile the files.
- Returns:
A dictionary mapping the include strings to the import module.
- Return type:
dict[str, Import]
- language = None#
- property scope#
Return the scope associated with the object being printed