Skip to content

Commit 57b323c

Browse files
committed
Explicitly freeze qbraid schema classes
1 parent e6643e4 commit 57b323c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/bloqade/qbraid/schema.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Operation(BaseModel, frozen=True, extra="forbid"):
99
op_type: str = Field(init=False)
1010

1111

12-
class CZ(Operation):
12+
class CZ(Operation, frozen=True):
1313
"""A CZ gate operation.
1414
1515
Fields:
@@ -22,7 +22,7 @@ class CZ(Operation):
2222
participants: Tuple[Union[Tuple[int], Tuple[int, int]], ...]
2323

2424

25-
class GlobalRz(Operation):
25+
class GlobalRz(Operation, frozen=True):
2626
"""GlobalRz operation.
2727
2828
Fields:
@@ -34,7 +34,7 @@ class GlobalRz(Operation):
3434
phi: float
3535

3636

37-
class GlobalW(Operation):
37+
class GlobalW(Operation, frozen=True):
3838
"""GlobalW operation.
3939
4040
Fields:
@@ -48,7 +48,7 @@ class GlobalW(Operation):
4848
phi: float
4949

5050

51-
class LocalRz(Operation):
51+
class LocalRz(Operation, frozen=True):
5252
"""LocalRz operation.
5353
5454
Fields:
@@ -63,7 +63,7 @@ class LocalRz(Operation):
6363
phi: float
6464

6565

66-
class LocalW(Operation):
66+
class LocalW(Operation, frozen=True):
6767
"""LocalW operation.
6868
6969
Fields:
@@ -80,7 +80,7 @@ class LocalW(Operation):
8080
phi: float
8181

8282

83-
class Measurement(Operation):
83+
class Measurement(Operation, frozen=True):
8484
"""Measurement operation.
8585
8686
Fields:
@@ -106,7 +106,7 @@ class ErrorModel(BaseModel, frozen=True, extra="forbid"):
106106
error_model_type: str = Field(init=False)
107107

108108

109-
class PauliErrorModel(ErrorModel):
109+
class PauliErrorModel(ErrorModel, frozen=True):
110110
"""Pauli error model.
111111
112112
Fields:
@@ -131,7 +131,7 @@ class ErrorOperation(BaseModel, Generic[ErrorModelType], frozen=True, extra="for
131131
survival_prob: Tuple[float, ...]
132132

133133

134-
class CZError(ErrorOperation[ErrorModelType]):
134+
class CZError(ErrorOperation[ErrorModelType], frozen=True):
135135
"""CZError operation.
136136
137137
Fields:
@@ -149,7 +149,7 @@ class CZError(ErrorOperation[ErrorModelType]):
149149
single_error: ErrorModelType
150150

151151

152-
class SingleQubitError(ErrorOperation[ErrorModelType]):
152+
class SingleQubitError(ErrorOperation[ErrorModelType], frozen=True):
153153
"""SingleQubitError operation.
154154
155155
Fields:

0 commit comments

Comments
 (0)