API reference
python:astx:astx.ClassDefStmt
class ClassDefStmt
ClassDefStmt(name: str, *, bases: Iterable[ClassType] | astx.ASTNodes[ClassType] = (), attributes: Iterable[astx.VariableDeclaration] | astx.ASTNodes[astx.VariableDeclaration] = (), decorators: Iterable[astx.Expr] | astx.ASTNodes[astx.Expr] = (), methods: Iterable[astx.FunctionDef] | astx.ASTNodes[astx.FunctionDef] = (), visibility: VisibilityKind = VisibilityKind.public, is_abstract: bool = False, loc: astx.SourceLocation = NO_SOURCE_LOCATION, parent: astx.ASTNodes[astx.AST] | None = None)
Source: packages/astx/src/astx/classes_ext.py:84
Declared as: python:astx:astx.classes_ext.ClassDefStmt
Explicit class definition statement.
Represent one top-level class declaration with explicit base-class references and inherited struct-like member containers.
Attributes
-
bases — Bases.; Type: astx.ASTNodes[ClassType]
-
is_abstract — Whether is abstract.; Type: bool
-
kind — Kind of value or operation.; Type: astx.ASTKind
-
loc — Type: SourceLocation
-
comment — Type: str
-
parent — Type: Optional[ASTNodes]
-
ref — Type: str
-
name — Type: str
-
attributes — Type: ASTNodes[VariableDeclaration]
-
visibility — Type: VisibilityKind
-
decorators — Type: ASTNodes[Expr]
-
methods — Type: ASTNodes[FunctionDef]
Methods
-
__init__ — Initialize one class definition statement.
-
__str__ — Render one class definition as text.
-
get_struct — Build one repr structure for a class definition.