Skip to content

Commit b96450f

Browse files
authored
refactor: rename internal field returns into return_ (#964)
Signed-off-by: Louis Mandel <[email protected]>
1 parent eb29f82 commit b96450f

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/pdl/pdl_ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ class FunctionBlock(LeafBlock):
378378
function: Optional[dict[str, PdlTypeType]]
379379
"""Functions parameters with their types.
380380
"""
381-
returns: "BlockType" = Field(..., alias="return")
381+
return_: "BlockType" = Field(..., alias="return")
382382
"""Body of the function.
383383
"""
384384
signature: Optional[Json] = None

src/pdl/pdl_ast_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def iter_block_children(f: Callable[[BlockType], None], block: BlockType) -> Non
3838
f(blocks)
3939
match block:
4040
case FunctionBlock():
41-
f(block.returns)
41+
f(block.return_)
4242
case CallBlock():
4343
if block.pdl__trace is not None:
4444
f(block.pdl__trace)
@@ -124,7 +124,7 @@ def map_block_children(f: MappedFunctions, block: BlockType) -> BlockType:
124124
block = block.model_copy(update={"defs": defs})
125125
match block:
126126
case FunctionBlock():
127-
block.returns = f.f_block(block.returns)
127+
block.return_ = f.f_block(block.return_)
128128
case CallBlock():
129129
block.call = f.f_expr(block.call)
130130
block.args = f.f_expr(block.args)

src/pdl/pdl_dumper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def block_to_dict( # noqa: C901
245245
d["function"] = None
246246
else:
247247
d["function"] = {x: type_to_dict(t) for x, t in block.function.items()}
248-
d["return"] = block_to_dict(block.returns, json_compatible)
248+
d["return"] = block_to_dict(block.return_, json_compatible)
249249
# if block.scope is not None:
250250
# d["scope"] = scope_to_dict(block.scope, json_compatible)
251251
case CallBlock():

src/pdl/pdl_interpreter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ def process_call(
18591859
)
18601860
if "pdl_context" in args:
18611861
args["pdl_context"] = deserialize(args["pdl_context"])
1862-
f_body = closure.returns
1862+
f_body = closure.return_
18631863
f_scope = (
18641864
(closure.pdl__scope or PdlDict({}))
18651865
| PdlDict({"pdl_context": scope.data["pdl_context"]})

src/pdl/pdl_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def parse_dict(
104104
# block.fallback = set_block_location(block.fallback, append(loc, "fallback"))
105105
# match block:
106106
# case FunctionBlock():
107-
# block.returns = set_blocks_location(block.returns, append(loc, "return"))
107+
# block.return_ = set_blocks_location(block.return_, append(loc, "return"))
108108
# case CallBlock():
109109
# block.args = {x: set_expr_location(expr) for x, expr in block.args.items()}
110110
# case ModelBlock():

0 commit comments

Comments
 (0)