API reference
python:astx:astx.classes.ClassDefStmt
class ClassDefStmt
ClassDefStmt(name: str, bases: Iterable[Expr] | ASTNodes[Expr] = [], decorators: Iterable[Expr] | ASTNodes[Expr] = [], body: Block = CLASS_BODY_DEFAULT, visibility: VisibilityKind = VisibilityKind.public, is_abstract: bool = False, metaclass: Optional[Expr] = None, attributes: Iterable[VariableDeclaration] | ASTNodes[VariableDeclaration] = [], methods: Iterable[FunctionDef] | ASTNodes[FunctionDef] = [], loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Source: packages/astx/src/astx/classes.py:232
AST class for class definition, including attributes and methods.
Attributes
-
name — Type: str
-
bases — Type: ASTNodes[Expr]
-
decorators — Type: ASTNodes[Expr]
-
visibility — Type: VisibilityKind
-
is_abstract — Type: bool
-
metaclass — Type: Optional[Expr]
-
attributes — Type: ASTNodes[VariableDeclaration]
-
methods — Type: ASTNodes[FunctionDef]
-
kind — Type: ASTKind
-
body — Type: Block
Methods
-
__init__ — Initialize ClassDefStmt instance.
-
__str__ — Return a string that represents the object.
-
get_struct — Return the AST structure of the object.