Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/examples/alias_sampling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ program:
- input_params:
- L
local_variables:
- R=ceiling(log_2(L))
R: ceiling(log_2(L))
name: usp
ports:
- direction: input
Expand Down Expand Up @@ -33,7 +33,7 @@ program:
- L
- mu
local_variables:
- R=ceiling(log_2(L))
R: ceiling(log_2(L))
name: qrom
ports:
- direction: input
Expand Down Expand Up @@ -168,7 +168,7 @@ program:
- qrom.mu
- compare.mu
local_variables:
- R=ceiling(log_2(L))
R: ceiling(log_2(L))
name: alias_sampling
ports:
- direction: input
Expand Down
2 changes: 1 addition & 1 deletion src/qref/schema_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class RoutineV1(BaseModel):
resources: Annotated[list[ResourceV1], _name_sorter] = Field(default_factory=list)
connections: Annotated[list[ConnectionV1], _source_sorter] = Field(default_factory=list)
input_params: list[_OptionallyMultiNamespacedName] = Field(default_factory=list)
local_variables: list[str] = Field(default_factory=list)
local_variables: dict[str, str] = Field(default_factory=dict)
linked_params: Annotated[list[ParamLinkV1], _source_sorter] = Field(default_factory=list)
meta: dict[str, Any] = Field(default_factory=dict)

Expand Down
11 changes: 10 additions & 1 deletion tests/qref/data/invalid_yaml_programs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,13 @@
description: "Target of a paramater link is not namespaced"
error_path: "$.program.linked_params[0].targets[0]"
error_message: "'N' does not match '^([A-Za-z_][A-Za-z0-9_]*\\\\.)+[A-Za-z_][A-Za-z0-9_]*$'"

- input:
version: v1
program:
name: "root"
input_params:
- N
local_variables: ["R = N+1"]
description: Routine uses old format for local_variables
error_path: "$.program.local_variables"
error_message: "['R = N+1'] is not of type 'object'"
18 changes: 18 additions & 0 deletions tests/qref/data/valid_programs/example_5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
description: Program with local variables
input:
program:
input_params:
- N
- M
name: root
ports:
- direction: input
name: in_0
size: N
- direction: output
name: out_0
size: 2
local_variables:
L: ceil(N/2)
R: M+2
version: v1