Skip to content

Commit

Permalink
Add default values for CVar and QVar data_types
Browse files Browse the repository at this point in the history
  • Loading branch information
qartik committed Oct 13, 2023
1 parent 6fe9f66 commit 69782b2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions phir/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,25 @@ class Data(BaseModel, abc.ABC):
class VarDefine(Data, abc.ABC):
"""Defining Variables."""

data_type: str | type
data: str
variable: str
size: int
size: int | None


class CVarDefine(VarDefine):
"""Defining Classical Variables."""

data: Literal["cvar_define"]
size: int | None
data_type: str = "i64"


class QVarDefine(VarDefine):
"""Defining Quantum Variables."""

data: Literal["qvar_define"]
size: int = Field(gt=0)
data_type: str | None = "qubits"


class ExportVar(Data):
Expand Down Expand Up @@ -119,15 +122,13 @@ class SeqBlock(Block):
"""A generic sequence block."""

block: Literal["sequence"]

ops: list[OpType | BlockType]


class IfBlock(Block):
"""If/else block."""

block: Literal["if"]

condition: COp
true_branch: list[OpType]
false_branch: list[OpType] | None = None
Expand Down

0 comments on commit 69782b2

Please sign in to comment.