classes
¶
Module for classes definitions/declarations.
Classes:
-
ClassDeclStmt
–AST class for class declaration.
-
ClassDefStmt
–AST class for class definition, including attributes and methods.
ClassDeclStmt
¶
ClassDeclStmt(name: str, bases: Iterable[Expr] | ASTNodes = [], decorators: Iterable[Expr] | ASTNodes = [], visibility: VisibilityKind = public, is_abstract: bool = False, metaclass: Optional[Expr] = None, attributes: Iterable[VariableDeclaration] | ASTNodes = [], methods: Iterable[Function] | ASTNodes = [], loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: StatementType
AST class for class declaration.
Methods:
-
get_struct
–Return the AST structure of the object.
-
to_json
–Return an json string that represents the object.
-
to_yaml
–Return an yaml string that represents the object.
Source code in src/astx/classes.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/classes.py
144 145 146 147 148 149 150 151 152 |
|
to_json
¶
Return an json string that represents the object.
Source code in src/astx/base.py
265 266 267 |
|
to_yaml
¶
Return an yaml string that represents the object.
Source code in src/astx/base.py
259 260 261 262 263 |
|
ClassDefStmt
¶
ClassDefStmt(name: str, bases: Iterable[Expr] | ASTNodes = [], decorators: Iterable[Expr] | ASTNodes = [], body: Block = CLASS_BODY_DEFAULT, visibility: VisibilityKind = public, is_abstract: bool = False, metaclass: Optional[Expr] = None, attributes: Iterable[VariableDeclaration] | ASTNodes = [], methods: Iterable[Function] | ASTNodes = [], loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: ClassDeclStmt
AST class for class definition, including attributes and methods.
Methods:
-
get_struct
–Return the AST structure of the object.
-
to_json
–Return an json string that represents the object.
-
to_yaml
–Return an yaml string that represents the object.
Source code in src/astx/classes.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/classes.py
209 210 211 212 213 214 215 216 217 218 219 220 |
|
to_json
¶
Return an json string that represents the object.
Source code in src/astx/base.py
265 266 267 |
|
to_yaml
¶
Return an yaml string that represents the object.
Source code in src/astx/base.py
259 260 261 262 263 |
|