iterables
¶
Provide small facade nodes for iterable constructs that are not yet present in upstream ASTx but are needed by semantic analysis and lowering.
Classes:
DictComprehension
¶
DictComprehension(
key: Expr,
value: Expr,
generators: ASTNodes[ComprehensionClause]
| Iterable[ComprehensionClause] = (),
loc: SourceLocation = NO_SOURCE_LOCATION,
parent: ASTNodes | None = None,
)
Bases: Comprehension
Represent {key: value for ...} until upstream ASTx exposes a
canonical dictionary-comprehension expression node.
attributes:
key:
type: astx.Expr
value:
type: astx.Expr
Methods:
-
get_struct– -
to_json– -
to_yaml–
Source code in packages/astx/src/astx/iterables.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/iterables.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
to_json
¶
Source code in packages/astx/src/astx/base.py
400 401 402 403 404 405 406 407 408 409 | |
to_yaml
¶
Source code in packages/astx/src/astx/base.py
387 388 389 390 391 392 393 394 395 396 397 398 | |
ForInLoopStmt
¶
ForInLoopStmt(
target: AST,
iterable: AST,
body: Block,
loc: SourceLocation = NO_SOURCE_LOCATION,
parent: ASTNodes | None = None,
)
Bases: StatementType
Model source forms equivalent to for target in iterable: body while
preserving ASTx-compatible target, iterable, and body child nodes.
attributes:
target:
type: astx.AST
iterable:
type: astx.AST
body:
type: astx.Block
Methods:
-
get_struct– -
to_json– -
to_yaml–
Source code in packages/astx/src/astx/iterables.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/iterables.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
to_json
¶
Source code in packages/astx/src/astx/base.py
400 401 402 403 404 405 406 407 408 409 | |
to_yaml
¶
Source code in packages/astx/src/astx/base.py
387 388 389 390 391 392 393 394 395 396 397 398 | |