astx.base
astx.base
Source: packages/astx/src/astx/base.py
title: AST classes and functions.Functions
is_using_jupyter_notebook() -> bool
title: Check if it is executed in a jupyter notebook.
returns:
type: boolClasses
SourceLocation
No docstring available.
ASTKind(Enum)
title: The expression kind class used for downcasting.ASTMeta(type)
No docstring available.
AST
title: AST main expression class.
attributes:
loc:
type: SourceLocation
kind:
type: ASTKind
comment:
type: str
parent:
type: Optional[ASTNodes]
ref:
type: strMethods
get_struct(self, simplified: bool=False) -> ReprStruct
title: Return a structure that represents the node object.
parameters:
simplified:
type: bool
returns:
type: ReprStructto_yaml(self, simplified: bool=False) -> str
title: Return an yaml string that represents the object.
parameters:
simplified:
type: bool
returns:
type: strto_json(self, simplified: bool=False) -> str
title: Return an json string that represents the object.
parameters:
simplified:
type: bool
returns:
type: strASTNodes(Generic[ASTType], AST)
title: AST with a list of nodes, supporting type-specific elements.
attributes:
loc:
type: SourceLocation
kind:
type: ASTKind
comment:
type: str
parent:
type: Optional[ASTNodes]
ref:
type: str
name:
type: str
nodes:
type: list[ASTType]
position:
type: intMethods
append(self, value: ASTType) -> None
title: Append a new node to the stack.
parameters:
value:
type: ASTTypeget_struct(self, simplified: bool=False) -> ReprStruct
title: Return a string that represents the object.
parameters:
simplified:
type: bool
returns:
type: ReprStructExpr(AST)
title: AST main expression class.
attributes:
loc:
type: SourceLocation
kind:
type: ASTKind
comment:
type: str
parent:
type: Optional[ASTNodes]
ref:
type: str
nbytes:
type: intExprType(Expr)
title: ExprType expression class.
attributes:
loc:
type: SourceLocation
kind:
type: ASTKind
comment:
type: str
parent:
type: Optional[ASTNodes]
ref:
type: str
nbytes:
type: intMethods
get_struct(self, simplified: bool=False) -> ReprStruct
title: Return a structure that represents the node object.
parameters:
simplified:
type: bool
returns:
type: ReprStructUndefined(Expr)
title: Undefined expression class.
attributes:
loc:
type: SourceLocation
kind:
type: ASTKind
comment:
type: str
parent:
type: Optional[ASTNodes]
ref:
type: str
nbytes:
type: intMethods
get_struct(self, simplified: bool=False) -> ReprStruct
title: Return a simple structure that represents the object.
parameters:
simplified:
type: bool
returns:
type: ReprStructDataType(ExprType)
title: AST main expression class.
attributes:
loc:
type: SourceLocation
kind:
type: ASTKind
comment:
type: str
parent:
type: Optional[ASTNodes]
ref:
type: str
nbytes:
type: int
type_:
type: ExprType
name:
type: str
_tmp_id:
type: ClassVar[int]Methods
get_struct(self, simplified: bool=False) -> ReprStruct
title: Return a simple structure that represents the object.
parameters:
simplified:
type: bool
returns:
type: ReprStructOperatorType(DataType)
title: AST main expression class.
attributes:
loc:
type: SourceLocation
kind:
type: ASTKind
comment:
type: str
parent:
type: Optional[ASTNodes]
ref:
type: str
nbytes:
type: int
type_:
type: ExprType
name:
type: str
_tmp_id:
type: ClassVar[int]StatementType(AST)
title: AST main expression class.
attributes:
loc:
type: SourceLocation
kind:
type: ASTKind
comment:
type: str
parent:
type: Optional[ASTNodes]
ref:
type: strParenthesizedExpr(DataType)
title: AST class for explicitly grouped expressions (parentheses retained).
attributes:
loc:
type: SourceLocation
comment:
type: str
parent:
type: Optional[ASTNodes]
ref:
type: str
nbytes:
type: int
name:
type: str
_tmp_id:
type: ClassVar[int]
type_:
type: DataType
kind:
type: ASTKind
value:
type: ExprMethods
get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the AST structure of the object.
parameters:
simplified:
type: bool
returns:
type: ReprStruct