packages
¶
Define ASTx for more broader scope.
Classes:
-
AliasExpr
–Represents an alias in an import statement.
-
ImportExpr
–Represents an import operation as an expression.
-
ImportFromExpr
–Represents a 'from ... import ...' operation as an expression.
-
ImportFromStmt
–Represents an import-from statement.
-
ImportStmt
–Represents an import statement.
-
Module
–AST main expression class.
-
Package
–AST class for Package.
-
Program
–AST class for Program.
-
Target
–Define the Architecture target for the program.
AliasExpr
¶
AliasExpr(name: str, asname: str = '', loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: Expr
Represents an alias in an import statement.
Methods:
-
get_struct
–Return the AST structure of the alias.
-
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/packages.py
167 168 169 170 171 172 173 174 175 176 177 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the alias.
Source code in src/astx/packages.py
186 187 188 189 190 191 192 193 |
|
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 |
|
ImportExpr
¶
ImportExpr(names: list[AliasExpr], loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: Expr
Represents an import operation as an expression.
Methods:
-
get_struct
–Return the AST structure of the import expression.
-
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/packages.py
281 282 283 284 285 286 287 288 289 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the import expression.
Source code in src/astx/packages.py
296 297 298 299 300 301 302 |
|
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 |
|
ImportFromExpr
¶
ImportFromExpr(names: list[AliasExpr], module: str = '', level: int = 0, loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: Expr
Represents a 'from ... import ...' operation as an expression.
Methods:
-
get_struct
–Return the AST structure of the import-from expression.
-
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/packages.py
314 315 316 317 318 319 320 321 322 323 324 325 326 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the import-from expression.
Source code in src/astx/packages.py
338 339 340 341 342 343 344 345 346 347 348 349 350 |
|
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 |
|
ImportFromStmt
¶
ImportFromStmt(names: list[AliasExpr], module: str = '', level: int = 0, loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: StatementType
Represents an import-from statement.
Methods:
-
get_struct
–Return the AST structure of the import-from statement.
-
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/packages.py
236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the import-from statement.
Source code in src/astx/packages.py
259 260 261 262 263 264 265 266 267 268 269 270 271 |
|
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 |
|
ImportStmt
¶
ImportStmt(names: list[AliasExpr], loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: StatementType
Represents an import statement.
Methods:
-
get_struct
–Return the AST structure of the import statement.
-
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/packages.py
203 204 205 206 207 208 209 210 211 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the import statement.
Source code in src/astx/packages.py
218 219 220 221 222 223 224 |
|
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 |
|
Module
¶
Module(name: str = 'main', loc: SourceLocation = NO_SOURCE_LOCATION)
Bases: Block
AST main expression class.
Methods:
-
append
–Append a new node to the stack.
-
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.
Attributes:
Source code in src/astx/packages.py
53 54 55 56 57 58 59 60 |
|
append
¶
append(value: ASTType) -> None
Append a new node to the stack.
Source code in src/astx/base.py
305 306 307 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/packages.py
71 72 73 74 75 76 77 78 79 80 81 |
|
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 |
|
Package
¶
Package(name: str = 'main', modules: list[Module] = [], packages: list[Package] = [], loc: SourceLocation = NO_SOURCE_LOCATION)
Bases: ASTNodes
AST class for Package.
Methods:
-
append
–Append a new node to the stack.
-
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/packages.py
93 94 95 96 97 98 99 100 101 102 103 104 |
|
append
¶
append(value: ASTType) -> None
Append a new node to the stack.
Source code in src/astx/base.py
305 306 307 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/packages.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
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 |
|
Program
¶
Program(name: str = 'main', target: Target = Target('', ''), modules: list[Module] = [], packages: list[Package] = [], loc: SourceLocation = NO_SOURCE_LOCATION)
Bases: Package
AST class for Program.
Methods:
-
append
–Append a new node to the stack.
-
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/packages.py
140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
append
¶
append(value: ASTType) -> None
Append a new node to the stack.
Source code in src/astx/base.py
305 306 307 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/packages.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
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 |
|
Target
¶
Bases: Expr
Define the Architecture target for the program.
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/packages.py
33 34 35 36 37 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/packages.py
39 40 41 42 43 |
|
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 |
|