Skip to content

Commit dc19f9d

Browse files
Merge branch 'main' into classical_control_docs
2 parents c90ec8e + c50ce1e commit dc19f9d

File tree

700 files changed

+1786
-1810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

700 files changed

+1786
-1810
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ cb6940a40141dba95cba84f5acc27acbeb65b17c
2424

2525
# Format proto files (#7133)
2626
5cf0e8df8f3e097b8d496cba1c2d4bd04cb83546
27+
28+
# Sort import statements - no change in the effective code (#7195)
29+
250f12964f027c68775c5c7989f7b6000f989f06

.github/workflows/stale.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
close-pr-label: 'status/stale'
9090
exempt-issue-labels: ${{steps.converted.outputs.exempt-issue-labels}}
9191
exempt-pr-labels: ${{steps.converted.outputs.exempt-pr-labels}}
92-
stale-issue-message: >
92+
stale-issue-message: >-
9393
This issue has been automatically labeled as stale because
9494
${{env.days-before-stale}} days have passed without comments or other
9595
activity. If no further activity occurs on this issue and the
@@ -98,12 +98,13 @@ jobs:
9898
would like to restore its status, please leave a comment here; doing
9999
so will cause the staleness handler to remove the label.
100100
101+
101102
If you have questions or feedback about this process, we welcome your
102103
input. You can open a new issue to let us know (please also reference
103104
this issue there, for continuity), or reach out to the project
104105
maintainers at quantum-oss-maintainers@google.com.
105106
106-
stale-pr-message: >
107+
stale-pr-message: >-
107108
This pull request has been automatically labeled as stale because
108109
${{env.days-before-stale}} days have passed without comments or other
109110
activity. If no further activity occurs and the `status/stale` label
@@ -112,29 +113,32 @@ jobs:
112113
its active status, please leave a comment here; doing so will cause
113114
the staleness handler to remove the label.
114115
116+
115117
If you have questions or feedback about this process, we welcome your
116118
input. You can open a new issue to let us know (please also reference
117119
this issue there, for continuity), or reach out to the project
118120
maintainers at quantum-oss-maintainers@google.com.
119121
120-
close-issue-message: >
122+
close-issue-message: >-
121123
This issue has been closed due to inactivity for
122124
${{env.days-before-close}} days since the time the `status/stale`
123125
label was applied. If you believe the issue is still relevant and
124126
would like to restore its active status, please feel free to reopen
125127
it.
126128
129+
127130
If you have questions or feedback about this process, we welcome your
128131
input. You can open a new issue to let us know (please also reference
129132
this issue there, for continuity), or reach out to the project
130133
maintainers at quantum-oss-maintainers@google.com.
131134
132-
close-pr-message: >
135+
close-pr-message: >-
133136
This pull request has been closed due to inactivity for
134137
${{env.days-before-close}} days since the time the `status/stale`
135138
label was applied. If you would like to continue working on this PR,
136139
please feel free to reopen it.
137140
141+
138142
If you have questions or feedback about this process, we welcome your
139143
input. You can open a new issue to let us know (please also reference
140144
this issue there, for continuity), or reach out to the project

benchmarks/circuit_construction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
import itertools
15-
from typing import Tuple, Set, Sequence
15+
from typing import Sequence, Set, Tuple
1616

1717
import cirq
1818

benchmarks/parameter_resolution.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
# limitations under the License.
1414

1515
import random
16+
1617
import numpy as np
1718
import sympy
19+
1820
import cirq
1921

2022

benchmarks/randomized_benchmarking.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import List, Sequence
1615
import functools
16+
from typing import List, Sequence
17+
1718
import numpy as np
19+
1820
import cirq
19-
from cirq.experiments.qubit_characterizations import _single_qubit_cliffords, _find_inv_matrix
21+
from cirq.experiments.qubit_characterizations import _find_inv_matrix, _single_qubit_cliffords
2022

2123

2224
def dot(args: Sequence[np.ndarray]) -> np.ndarray:

check/format-incremental

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ for arg in "$@"; do
5757
fi
5858
done
5959

60-
typeset -a format_files
60+
declare -a format_files=()
6161
if (( only_changed == 1 )); then
6262
# Figure out which branch to compare against.
6363
if [ -z "${rev}" ]; then
@@ -82,31 +82,61 @@ if (( only_changed == 1 )); then
8282

8383
# Get the modified, added and moved python files.
8484
IFS=$'\n' read -r -d '' -a format_files < \
85-
<(git diff --name-only --diff-filter=MAR "${rev}" -- '*.py' ':(exclude)cirq-google/cirq_google/cloud/*' ':(exclude)*_pb2.py')
85+
<(git diff --name-only --diff-filter=MAR "${rev}" -- \
86+
'*.py' ':(exclude)*_pb2.py')
8687
else
8788
echo -e "Formatting all python files." >&2
8889
IFS=$'\n' read -r -d '' -a format_files < \
8990
<(git ls-files '*.py' ':(exclude)*_pb2.py')
9091
fi
9192

9293
if (( ${#format_files[@]} == 0 )); then
93-
echo -e "\033[32mNo files to format\033[0m."
94+
echo -e "\033[32mNo files to format.\033[0m"
9495
exit 0
9596
fi
9697

97-
BLACKVERSION="$(black --version)"
98+
# Exclude __init__.py files from isort targets
99+
declare -a isort_files=()
100+
for f in "${format_files[@]}"; do
101+
if [[ "${f##*/}" != __init__.py ]]; then
102+
isort_files+=("${f}")
103+
fi
104+
done
105+
106+
# Color the output if it goes to a terminal or GitHub Actions log
107+
arg_color=()
108+
if [[ -t 1 || "${CI}" == true ]]; then
109+
arg_color=("--color")
110+
fi
111+
112+
ISORTVERSION="$(isort --version-number)"
113+
114+
echo "Sorting imports with isort... (version: $ISORTVERSION)"
115+
116+
args=("${arg_color[@]}")
117+
if (( only_print == 1 )); then
118+
args+=("--check" "--diff")
119+
fi
120+
121+
ISORTSTATUS=0
122+
if (( "${#isort_files[@]}" )); then
123+
isort "${args[@]}" "${isort_files[@]}"
124+
ISORTSTATUS=$?
125+
fi
126+
127+
BLACKVERSION="$(black --version | head -1)"
98128

99129
echo "Running the black formatter... (version: $BLACKVERSION)"
100130

101-
args=("--color")
131+
args=("${arg_color[@]}")
102132
if (( only_print == 1 )); then
103133
args+=("--check" "--diff")
104134
fi
105135

106136
black "${args[@]}" "${format_files[@]}"
107137
BLACKSTATUS=$?
108138

109-
if [[ "$BLACKSTATUS" != "0" ]]; then
139+
if (( BLACKSTATUS || ISORTSTATUS )); then
110140
exit 1
111141
fi
112142
exit 0

cirq-aqt/cirq_aqt/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
"""Define version number here, read it from setup.py automatically"""
1616

17-
__version__ = "1.5.0.dev"
17+
__version__ = "1.5.0.dev0"

cirq-aqt/cirq_aqt/_version_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44

55
def test_version():
6-
assert cirq_aqt.__version__ == "1.5.0.dev"
6+
assert cirq_aqt.__version__ == "1.5.0.dev0"

cirq-aqt/cirq_aqt/aqt_sampler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@
2525
import json
2626
import time
2727
import uuid
28-
from typing import Callable, cast, Dict, List, Sequence, Tuple, Union, Literal, TypedDict
28+
from typing import Callable, cast, Dict, List, Literal, Sequence, Tuple, TypedDict, Union
2929
from urllib.parse import urljoin
3030

3131
import numpy as np
32-
from requests import post, get
32+
from requests import get, post
3333

3434
import cirq
3535
from cirq_aqt.aqt_device import AQTSimulator, get_op_string, OperationString
3636

37-
3837
_DEFAULT_HOST = "https://arnica.aqt.eu/api/v1/"
3938

4039

cirq-aqt/cirq_aqt/aqt_sampler_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from unittest import mock
1615
import json
16+
from unittest import mock
17+
1718
import numpy as np
1819
import pytest
1920
import sympy

0 commit comments

Comments
 (0)