Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An extended RZZ pass for unbounded parameters #2072

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions qiskit_ibm_runtime/transpiler/passes/basis/fold_rzz_angle.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

"""Pass to wrap Rzz gate angle in calibrated range of 0-pi/2."""

from typing import Tuple, Optional, Union
from typing import Tuple, Optional, Union, List
from math import pi
from operator import mod

Expand Down Expand Up @@ -46,7 +46,7 @@ class FoldRzzAngle(TransformationPass):
with angle of arbitrary real numbers.
"""

def __init__(self, target: Optional[Union[Target, list[str]]] = None):
def __init__(self, target: Optional[Union[Target, List[str]]] = None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you prefer, you can use from __future__ import annotations at the top of the import statements and then the new style will work for type hints. Doing this causes the type hints to be converted into strings instead of being evaluated as objects (so it doesn't make the list[...] syntax actually work on Python 3.9; if you try to use it outside of an annotation, there will be an error).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind, do you have a preference?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are inconsistent enough in this repo that I don't think it matters much in individual PRs like this, it would be more effective to have a PR that unifies across the repo and then we start being strict. My preference is to eventually settle on the new-style, in which case this would be Target | list[str] | None.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong preference though I do think it is nice to avoid the typing imports when possible. I mainly wanted to point the option out since I saw the commit message "old style typing required by CI".

"""
Args:
target - either a target or only a list of basis gates, either way it can be checked
Expand Down
Loading