99# Any modifications or derivative works of this code must retain this
1010# copyright notice, and modified files need to carry a notice indicating
1111# that they have been altered from the originals.
12-
1312"""Check if a property reached a fixed point."""
14-
15- from __future__ import annotations
16-
1713from copy import deepcopy
14+ from typing import TYPE_CHECKING
15+
16+ if TYPE_CHECKING :
17+ from qiskit .dagcircuit import DAGCircuit
1818
19- from qiskit .dagcircuit import DAGCircuit
2019from qiskit .transpiler .basepasses import AnalysisPass
2120
2221
@@ -29,23 +28,20 @@ class FixedPoint(AnalysisPass):
2928 """
3029
3130 def __init__ (self , property_to_check : str ) -> None :
32- """Initialize a ``FixedPoint`` pass.
33-
31+ """
3432 Args:
3533 property_to_check: The property to check if a fixed point was reached.
3634 """
3735 super ().__init__ ()
3836 self ._property = property_to_check
3937
4038 def run (self , dag : DAGCircuit ) -> None :
41- """Run the FixedPoint pass on * dag* ."""
39+ """Run the FixedPoint pass on `` dag`` ."""
4240 current_value = self .property_set [self ._property ]
4341 fixed_point_previous_property = f"_fixed_point_previous_{ self ._property } "
44-
4542 if self .property_set [fixed_point_previous_property ] is None :
4643 self .property_set [f"{ self ._property } _fixed_point" ] = False
4744 else :
4845 fixed_point_reached = self .property_set [fixed_point_previous_property ] == current_value
4946 self .property_set [f"{ self ._property } _fixed_point" ] = fixed_point_reached
50-
5147 self .property_set [fixed_point_previous_property ] = deepcopy (current_value )
0 commit comments