1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ from __future__ import annotations
16+
1517import abc
1618from typing import Any , Dict , List , Optional , Sequence , TYPE_CHECKING
1719
@@ -286,10 +288,10 @@ def __eq__(self, other):
286288 and np .array_equal (self .zs , other .zs )
287289 )
288290
289- def __copy__ (self ) -> ' CliffordTableau' :
291+ def __copy__ (self ) -> CliffordTableau :
290292 return self .copy ()
291293
292- def copy (self , deep_copy_buffers : bool = True ) -> ' CliffordTableau' :
294+ def copy (self , deep_copy_buffers : bool = True ) -> CliffordTableau :
293295 state = CliffordTableau (self .n )
294296 state .rs = self .rs .copy ()
295297 state .xs = self .xs .copy ()
@@ -364,7 +366,7 @@ def _pauli_from_matrix(r: int, c: int) -> str:
364366
365367 return '\n ' .join ([title_row , divider , * contents ]) + '\n '
366368
367- def then (self , second : ' CliffordTableau' ) -> ' CliffordTableau' :
369+ def then (self , second : CliffordTableau ) -> CliffordTableau :
368370 """Returns a composed CliffordTableau of this tableau and the second tableau.
369371
370372 Then composed tableau is equal to (up to global phase) the composed
@@ -431,7 +433,7 @@ def then(self, second: 'CliffordTableau') -> 'CliffordTableau':
431433
432434 return merged_tableau
433435
434- def inverse (self ) -> ' CliffordTableau' :
436+ def inverse (self ) -> CliffordTableau :
435437 """Returns the inverse Clifford tableau of this tableau."""
436438 ret_table = CliffordTableau (num_qubits = self .n )
437439 # It relies on the symplectic property of Clifford tableau.
@@ -450,7 +452,7 @@ def inverse(self) -> 'CliffordTableau':
450452 ret_table .rs = ret_table .then (self ).rs
451453 return ret_table
452454
453- def __matmul__ (self , second : ' CliffordTableau' ):
455+ def __matmul__ (self , second : CliffordTableau ):
454456 if not isinstance (second , CliffordTableau ):
455457 return NotImplemented
456458 return second .then (self )
@@ -481,7 +483,7 @@ def g(x1, z1, x2, z2):
481483 self ._xs [q1 , :] ^= self ._xs [q2 , :]
482484 self ._zs [q1 , :] ^= self ._zs [q2 , :]
483485
484- def _row_to_dense_pauli (self , i : int ) -> ' cirq.DensePauliString' :
486+ def _row_to_dense_pauli (self , i : int ) -> cirq .DensePauliString :
485487 """Return a dense Pauli string for the given row in the tableau.
486488
487489 Args:
@@ -509,12 +511,12 @@ def _row_to_dense_pauli(self, i: int) -> 'cirq.DensePauliString':
509511 pauli_mask += "I"
510512 return DensePauliString (pauli_mask , coefficient = coefficient )
511513
512- def stabilizers (self ) -> List [' cirq.DensePauliString' ]:
514+ def stabilizers (self ) -> List [cirq .DensePauliString ]:
513515 """Returns the stabilizer generators of the state. These
514516 are n operators {S_1,S_2,...,S_n} such that S_i |psi> = |psi>"""
515517 return [self ._row_to_dense_pauli (i ) for i in range (self .n , 2 * self .n )]
516518
517- def destabilizers (self ) -> List [' cirq.DensePauliString' ]:
519+ def destabilizers (self ) -> List [cirq .DensePauliString ]:
518520 """Returns the destabilizer generators of the state. These
519521 are n operators {S_1,S_2,...,S_n} such that along with the stabilizer
520522 generators above generate the full Pauli group on n qubits."""
@@ -662,7 +664,7 @@ def apply_global_phase(self, coefficient: linear_dict.Scalar):
662664 pass
663665
664666 def measure (
665- self , axes : Sequence [int ], seed : ' cirq.RANDOM_STATE_OR_SEED_LIKE' = None
667+ self , axes : Sequence [int ], seed : cirq .RANDOM_STATE_OR_SEED_LIKE = None
666668 ) -> List [int ]:
667669 return [self ._measure (axis , random_state .parse_random_state (seed )) for axis in axes ]
668670
0 commit comments