File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212# See the License for the specific language governing permissions and
1313# limitations under the License.
14+ import subprocess
1415from functools import cached_property
1516from typing import Dict , Type , Union
1617
@@ -290,3 +291,8 @@ def to_cirq_circuit(bloq: GateWithRegisters) -> cirq.Circuit:
290291@pytest .mark .notebook
291292def test_notebook ():
292293 execute_notebook ('util_bloqs' )
294+
295+
296+ def test_no_circular_import ():
297+ # There was a circular import that would only be triggered by this import incantation
298+ subprocess .check_call (['python' , '-c' , 'from qualtran.bloqs import util_bloqs' ])
Original file line number Diff line number Diff line change 1717
1818import cirq
1919
20- from qualtran .bloqs .basic_gates .rotation import _HasEps
2120from qualtran .resource_counting .symbolic_counting_utils import ceil , SymbolicInt
2221
2322if TYPE_CHECKING :
24- import sympy
25-
2623 from qualtran import Bloq
24+ from qualtran .bloqs .basic_gates .rotation import _HasEps
2725
2826
29- def _get_all_rotation_types () -> Tuple [Type [_HasEps ], ...]:
27+ def _get_all_rotation_types () -> Tuple [Type [' _HasEps' ], ...]:
3028 """Returns all classes defined in bloqs.basic_gates which have an attribute `eps`."""
31- import qualtran .bloqs .basic_gates # pylint: disable=unused-import
29+ from qualtran .bloqs .basic_gates import GlobalPhase
30+ from qualtran .bloqs .basic_gates .rotation import _HasEps
3231
33- bloqs_to_exclude = [qualtran . bloqs . basic_gates . GlobalPhase ]
32+ bloqs_to_exclude = [GlobalPhase ]
3433
3534 return tuple (
3635 v
You can’t perform that action at this time.
0 commit comments