pyccel.ast.typingext module#
Module containing objects from the typing module understood by pyccel
- class pyccel.ast.typingext.TypingAny[source]#
Bases:
TypedAstNode
Class representing a call to the typing.Any construct.
Class representing a call to the typing.Any construct. This object will never be constructed. It exists to recognise the import.
- class pyccel.ast.typingext.TypingFinal(arg)[source]#
Bases:
TypedAstNode
Class representing a call to the typing.Final construct.
Class representing a call to the typing.Final construct. A “call” to this object looks like an IndexedElement. This is because types are involved.
- Parameters:
arg (SyntacticTypeAnnotation) – The annotation which is coerced to be constant.
- property arg#
Get the argument describing the type annotation for an object.
Get the argument describing the type annotation for an object.
- name = 'Final'#
- class pyccel.ast.typingext.TypingOverload[source]#
Bases:
TypedAstNode
Class representing a call to the typing.overload decorator.
Class representing a call to the typing.overload decorator. This object will never be constructed. It exists to recognise the import.
- class pyccel.ast.typingext.TypingTypeAlias[source]#
Bases:
TypedAstNode
Class representing a call to the typing.TypeAlias construct.
Class representing a call to the typing.TypeAlias construct. This object is only used for type annotations. It is useful for creating a PyccelFunctionDef but instances should not be created.
- class pyccel.ast.typingext.TypingTypeVar(name, *constraints, bound=None, covariant=False, contravariant=False, infer_variance=False, default=None)[source]#
Bases:
TypedAstNode
Class representing a call to the typing.TypeVar construct.
Class representing a call to the typing.TypeVar construct. This object is a type annotation.
- Parameters:
name (str) – The name which will be used to identify the TypeVar.
*constraints (PyccelAstNode) – The possible annotations that this TypeVar can represent.
bound (PyccelAstNode) – The superclass from which the type must inherit. See PEP 484.
covariant (bool) – Indicates if the TypeVar can represent superclasses of the constraints. See PEP 484.
contravariant (bool) – Indicates if the TypeVar can represent subclasses of the constraints. See PEP 484.
infer_variance (bool) – Indicates if the variance (see covariant/contravariant) should be inferred from use. See PEP 695.
default (TypedAstNode) – The type that should be chosen if the type cannot be deduced from the call. This can sometimes be the case for parametrised classes. See PEP 696.
- name = 'TypeVar'#
- property name_str#
The name that is printed to represent the TypeVar.
The name that is printed to represent the TypeVar.
- property type_list#
Get the list of types which this TypeVar can take.
Get the list of types which this TypeVar can take (stored in a tuple).