pyccel.ast.utilities module#
Module containing utility functions which are used in the syntactic, semantic, and code-generation stages of Pyccel. These include functions for handling imports, checking whether an operation is compatible with the target language, and collecting code into loops. Most of these functions are used in multiple places in the code and are not specific to any one stage, so they are collected together in this module to avoid circular imports.
- class pyccel.ast.utilities.LoopCollection(body, length, modified_vars)#
Bases:
tuple- body#
Alias for field number 0
- length#
Alias for field number 1
- modified_vars#
Alias for field number 2
- pyccel.ast.utilities.builtin_import(expr)[source]View on GitHub#
Return a Pyccel-extension function/object from an import of a recognised module.
Examine an Import object which imports something which is recognised by Pyccel internally. The object(s) imported are then returned for use in the code.
- Parameters:
expr (Import) – The expression which imports the module.
- Returns:
A list of 2-tuples. The first element is the name of the imported object, the second element is the object itself.
- Return type:
list
- pyccel.ast.utilities.split_positional_keyword_arguments(*args)[source]View on GitHub#
Create a list of positional arguments and a dictionary of keyword arguments