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:208
AST class for class definition, including attributes and methods.
Attributes
-
name — Name identifying this declaration.; Type: str
-
bases — Bases.; Type: ASTNodes[Expr]
-
decorators — Decorators.; Type: ASTNodes[Expr]
-
visibility — Visibility.; Type: VisibilityKind
-
is_abstract — Whether is abstract.; Type: bool
-
metaclass — Metaclass.; Type: Optional[Expr]
-
attributes — Attributes.; Type: ASTNodes[VariableDeclaration]
-
methods — Methods.; Type: ASTNodes[FunctionDef]
-
kind — Kind of value or operation.; Type: ASTKind
-
body — Statements forming the body.; Type: Block
-
loc — Type: SourceLocation
-
comment — Type: str
-
parent — Type: Optional[ASTNodes]
-
ref — Type: str
Methods
-
__init__ — Initialize ClassDefStmt instance.
-
__str__ — Return a string that represents the object.
-
get_struct — Return the AST structure of the object.