From d8a8a4d54330f9953058a6cf24a1dfadad5e81fd Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 Sep 2024 18:27:58 -0700 Subject: [PATCH 01/10] Rename check script build-changed-protos --> protos-up-to-date Pick a name that says what does the script do. --- .github/workflows/ci.yml | 2 +- check/{build-changed-protos => protos-up-to-date} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename check/{build-changed-protos => protos-up-to-date} (98%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db3e21ff135..c7e1e325c8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -252,7 +252,7 @@ jobs: run: | pip install -r dev_tools/requirements/deps/protos.txt - name: Build protos - run: check/build-changed-protos + run: check/protos-up-to-date coverage: name: Coverage check runs-on: ubuntu-20.04 diff --git a/check/build-changed-protos b/check/protos-up-to-date similarity index 98% rename from check/build-changed-protos rename to check/protos-up-to-date index df58599498b..f6f2d7d3847 100755 --- a/check/build-changed-protos +++ b/check/protos-up-to-date @@ -7,7 +7,7 @@ # file will be built. # # Usage: -# check/build-changed-protos [BASE_REVISION] +# check/protos-up-to-date [BASE_REVISION] # # You can specify a base git revision to compare against (i.e. to use when # determining whether or not a line is considered to have "changed"). For From 312b32a34723e7dfc5e6defa033d4307e6d4b61a Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 Sep 2024 18:42:08 -0700 Subject: [PATCH 02/10] Excise unused code for getting base revision Require that the script runs in a pristine worktree. --- check/protos-up-to-date | 54 ++++++++--------------------------------- 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/check/protos-up-to-date b/check/protos-up-to-date index f6f2d7d3847..e5e79c09a2d 100755 --- a/check/protos-up-to-date +++ b/check/protos-up-to-date @@ -1,28 +1,9 @@ #!/usr/bin/env bash ################################################################################ -# Runs bazel build for proto files in cirq/google/api/* that have changed. +# Verifies that Python files generated from protobuf definitions are up to date. # -# If any BUILD file for the proto has changed, all targets in that BUILD -# file will be built. -# -# Usage: -# check/protos-up-to-date [BASE_REVISION] -# -# You can specify a base git revision to compare against (i.e. to use when -# determining whether or not a line is considered to have "changed"). For -# example, you can compare against 'origin/main' or 'HEAD~1'. -# -# If you don't specify a base revision, the following defaults will be tried, in -# order, until one exists: -# -# 1. upstream/main -# 2. origin/main -# 3. main -# -# If none exists, the script fails. -# -# See build-protos for building all protos. +# See dev_tools/build-protos.sh for building all protos. ################################################################################ # Get the working directory to the repo root. @@ -30,29 +11,14 @@ thisdir="$(dirname "${BASH_SOURCE[0]}")" || exit $? topdir="$(git -C "${thisdir}" rev-parse --show-toplevel)" || exit $? cd "${topdir}" || exit $? -# Figure out which revision to compare against. -if [ -n "$1" ] && [[ $1 != -* ]]; then - if ! git rev-parse --verify --quiet --no-revs "$1^{commit}"; then - echo -e "\033[31mNo revision '$1'.\033[0m" >&2 - exit 1 - fi - rev=$1 -elif [ "$(git cat-file -t upstream/main 2> /dev/null)" == "commit" ]; then - rev=upstream/main -elif [ "$(git cat-file -t origin/main 2> /dev/null)" == "commit" ]; then - rev=origin/main -elif [ "$(git cat-file -t main 2> /dev/null)" == "commit" ]; then - rev=main -else - echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/main' or 'HEAD~1').\033[0m" >&2 - exit 1 -fi -base="$(git merge-base "${rev}" HEAD)" -if [ "$(git rev-parse "${rev}")" == "${base}" ]; then - echo -e "Comparing against revision '${rev}'." >&2 -else - echo -e "Comparing against revision '${rev}' (merge base ${base})." >&2 - rev="${base}" +git_status="$(git status --short)" +if [[ -n "${git_status}" ]]; then + echo "$0 requires a pristine worktree, but 'git status --short' shows" + echo + echo "${git_status}" + echo + echo "Please commit or undo these changes to try again." + exit 2 fi # All the protos. From 41afe75d52265f1957cfa31a1ca3f57c5df485f1 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 Sep 2024 19:08:05 -0700 Subject: [PATCH 03/10] Exit with error status if dev_tools/build-protos.sh changes content --- check/protos-up-to-date | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/check/protos-up-to-date b/check/protos-up-to-date index e5e79c09a2d..5e05483a7f1 100755 --- a/check/protos-up-to-date +++ b/check/protos-up-to-date @@ -21,20 +21,27 @@ if [[ -n "${git_status}" ]]; then exit 2 fi -# All the protos. +echo "Removing generated Python files. If this script does not restore them" +echo "use git restore "*_pb2.py*" to get them back." + +git rm --quiet "cirq-google/*_pb2.py*" +# restore deleted files in git index +git reset --quiet + echo "Building protos in $PWD" dev_tools/build-protos.sh -# Filenames with spaces will be ugly (each part will be listed separately) -# but the error logic will still work. -uncommitted=$(git status --porcelain 2>/dev/null | grep -E "^[?][?] cirq-google" | cut -d " " -f 3) +git_status="$(git status --short)" -if [[ -n "$uncommitted" ]]; then - echo -e "\033[31mERROR: Uncommitted generated files found! Please generate and commit these files using dev_tools/build-protos.sh:\033[0m" - for generated in $uncommitted - do - echo -e "\033[31m ${generated}\033[0m" - done +if [[ -n "${git_status}" ]]; then + echo -e "\033[31mERROR: dev_tools/build-protos.sh changed generated files!\033[0m" + echo -e "\033[31mPlease generate and commit these files using dev_tools/build-protos.sh\033[0m" + echo + echo "Note in addition to changed files, there may be new files or orphaned old files." + echo + echo "Output of 'git status':" + echo + git status exit 1 fi From 87f38c81737618df70325281fc094f535bc2f160 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 Sep 2024 19:16:51 -0700 Subject: [PATCH 04/10] Improve messaging from the script --- check/protos-up-to-date | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/check/protos-up-to-date b/check/protos-up-to-date index 5e05483a7f1..40fdca7af1b 100755 --- a/check/protos-up-to-date +++ b/check/protos-up-to-date @@ -13,34 +13,34 @@ cd "${topdir}" || exit $? git_status="$(git status --short)" if [[ -n "${git_status}" ]]; then - echo "$0 requires a pristine worktree, but 'git status --short' shows" + echo "$0 requires a pristine worktree, but 'git status' shows" + echo "some changes or untracked files." echo - echo "${git_status}" - echo - echo "Please commit or undo these changes to try again." + echo "Please commit or clean these up to try again." exit 2 fi -echo "Removing generated Python files. If this script does not restore them" -echo "use git restore "*_pb2.py*" to get them back." +echo "Removing generated Python files. If not restored by this script, use" +echo 'git restore "*_pb2.py*" to get them back' +echo git rm --quiet "cirq-google/*_pb2.py*" # restore deleted files in git index git reset --quiet echo "Building protos in $PWD" +echo dev_tools/build-protos.sh git_status="$(git status --short)" if [[ -n "${git_status}" ]]; then - echo -e "\033[31mERROR: dev_tools/build-protos.sh changed generated files!\033[0m" - echo -e "\033[31mPlease generate and commit these files using dev_tools/build-protos.sh\033[0m" echo - echo "Note in addition to changed files, there may be new files or orphaned old files." + echo -e "\033[31mERROR: dev_tools/build-protos.sh changed generated files!\033[0m" + echo -e "\033[31mPlease update and commit these files using dev_tools/build-protos.sh\033[0m" echo - echo "Output of 'git status':" + echo "Output of 'git status' (note there may be untracked new files or deleted old ones):" echo git status exit 1 From 792d66d6d4480f428243abcd6b8eaf4cc03c6958 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 Sep 2024 22:20:02 -0700 Subject: [PATCH 05/10] Rebuild protos Executed dev_tools/build-protos.sh --- .../cirq_google/api/v1/operations_pb2.pyi | 70 ++-- cirq-google/cirq_google/api/v1/params_pb2.pyi | 53 +-- .../cirq_google/api/v1/program_pb2.pyi | 48 +-- cirq-google/cirq_google/api/v2/device_pb2.pyi | 95 ++--- .../cirq_google/api/v2/metrics_pb2.pyi | 27 +- .../cirq_google/api/v2/program_pb2.pyi | 340 ++++++++++-------- cirq-google/cirq_google/api/v2/result_pb2.pyi | 53 +-- 7 files changed, 374 insertions(+), 312 deletions(-) diff --git a/cirq-google/cirq_google/api/v1/operations_pb2.pyi b/cirq-google/cirq_google/api/v1/operations_pb2.pyi index b763296114a..7e758fa5e66 100644 --- a/cirq-google/cirq_google/api/v1/operations_pb2.pyi +++ b/cirq-google/cirq_google/api/v1/operations_pb2.pyi @@ -2,21 +2,17 @@ @generated by mypy-protobuf. Do not edit manually! isort:skip_file """ + import builtins import collections.abc import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.message -import sys - -if sys.version_info >= (3, 8): - import typing as typing_extensions -else: - import typing_extensions +import typing DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -@typing_extensions.final +@typing.final class Qubit(google.protobuf.message.Message): """Identifies a qubit.""" @@ -34,11 +30,11 @@ class Qubit(google.protobuf.message.Message): row: builtins.int = ..., col: builtins.int = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["col", b"col", "row", b"row"]) -> None: ... + def ClearField(self, field_name: typing.Literal["col", b"col", "row", b"row"]) -> None: ... global___Qubit = Qubit -@typing_extensions.final +@typing.final class ParameterizedFloat(google.protobuf.message.Message): """A number specified as a constant plus an optional parameter lookup.""" @@ -58,13 +54,13 @@ class ParameterizedFloat(google.protobuf.message.Message): raw: builtins.float = ..., parameter_key: builtins.str = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["parameter_key", b"parameter_key", "raw", b"raw", "value", b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["parameter_key", b"parameter_key", "raw", b"raw", "value", b"value"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["value", b"value"]) -> typing_extensions.Literal["raw", "parameter_key"] | None: ... + def HasField(self, field_name: typing.Literal["parameter_key", b"parameter_key", "raw", b"raw", "value", b"value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["parameter_key", b"parameter_key", "raw", b"raw", "value", b"value"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["value", b"value"]) -> typing.Literal["raw", "parameter_key"] | None: ... global___ParameterizedFloat = ParameterizedFloat -@typing_extensions.final +@typing.final class ExpW(google.protobuf.message.Message): """A single-qubit rotation around an axis on the XY equator of the Bloch sphere. @@ -83,6 +79,7 @@ class ExpW(google.protobuf.message.Message): @property def target(self) -> global___Qubit: """The qubit to rotate.""" + @property def axis_half_turns(self) -> global___ParameterizedFloat: """The angle of the rotation axis' facing in the XY plane, expressed in @@ -93,12 +90,14 @@ class ExpW(google.protobuf.message.Message): - 1.5 is negative-ward along Y. Note that this is periodic with period 2. """ + @property def half_turns(self) -> global___ParameterizedFloat: """The amount to rotate by expressed in units of pi / 2, i.e. the t in exp(i pi W(theta) t / 2). Note that this is periodic with period 4 (or 2 when ignoring global phase). """ + def __init__( self, *, @@ -106,12 +105,12 @@ class ExpW(google.protobuf.message.Message): axis_half_turns: global___ParameterizedFloat | None = ..., half_turns: global___ParameterizedFloat | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["axis_half_turns", b"axis_half_turns", "half_turns", b"half_turns", "target", b"target"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["axis_half_turns", b"axis_half_turns", "half_turns", b"half_turns", "target", b"target"]) -> None: ... + def HasField(self, field_name: typing.Literal["axis_half_turns", b"axis_half_turns", "half_turns", b"half_turns", "target", b"target"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["axis_half_turns", b"axis_half_turns", "half_turns", b"half_turns", "target", b"target"]) -> None: ... global___ExpW = ExpW -@typing_extensions.final +@typing.final class ExpZ(google.protobuf.message.Message): """A single-qubit rotation around the Z axis of the Bloch sphere. @@ -126,24 +125,26 @@ class ExpZ(google.protobuf.message.Message): @property def target(self) -> global___Qubit: """The qubit to rotate.""" + @property def half_turns(self) -> global___ParameterizedFloat: """The amount of the rotation in radians, i.e. the t in exp(i * pi * Z * t / 2). Note that this is periodic with period 4 (or 2 when ignoring global phase). """ + def __init__( self, *, target: global___Qubit | None = ..., half_turns: global___ParameterizedFloat | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["half_turns", b"half_turns", "target", b"target"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["half_turns", b"half_turns", "target", b"target"]) -> None: ... + def HasField(self, field_name: typing.Literal["half_turns", b"half_turns", "target", b"target"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["half_turns", b"half_turns", "target", b"target"]) -> None: ... global___ExpZ = ExpZ -@typing_extensions.final +@typing.final class Exp11(google.protobuf.message.Message): """A two qubit rotation which acts to phase only the |11> state. @@ -159,15 +160,18 @@ class Exp11(google.protobuf.message.Message): @property def target1(self) -> global___Qubit: """The first qubit to interact.""" + @property def target2(self) -> global___Qubit: """The other qubit to interact.""" + @property def half_turns(self) -> global___ParameterizedFloat: """The amount of the rotation in units of pi, i.e. the t in exp(i * pi * |11><11| * t). Note that this is periodic with period 2 (including global phase). """ + def __init__( self, *, @@ -175,12 +179,12 @@ class Exp11(google.protobuf.message.Message): target2: global___Qubit | None = ..., half_turns: global___ParameterizedFloat | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["half_turns", b"half_turns", "target1", b"target1", "target2", b"target2"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["half_turns", b"half_turns", "target1", b"target1", "target2", b"target2"]) -> None: ... + def HasField(self, field_name: typing.Literal["half_turns", b"half_turns", "target1", b"target1", "target2", b"target2"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["half_turns", b"half_turns", "target1", b"target1", "target2", b"target2"]) -> None: ... global___Exp11 = Exp11 -@typing_extensions.final +@typing.final class Measurement(google.protobuf.message.Message): """A multi-qubit measurement in the computational basis (|0>, |1>).""" @@ -189,13 +193,14 @@ class Measurement(google.protobuf.message.Message): TARGETS_FIELD_NUMBER: builtins.int KEY_FIELD_NUMBER: builtins.int INVERT_MASK_FIELD_NUMBER: builtins.int - @property - def targets(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Qubit]: - """The qubits to measure.""" key: builtins.str """The key that this measurement's bit will be grouped under. Measurement keys must be unique across the circuit. """ + @property + def targets(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Qubit]: + """The qubits to measure.""" + @property def invert_mask(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bool]: """If not empty, a list of booleans describing whether the results should @@ -203,6 +208,7 @@ class Measurement(google.protobuf.message.Message): match the length of the qubits, and the interpretation of whether to invert or not matches component-wise this list and the qubits' list. """ + def __init__( self, *, @@ -210,11 +216,11 @@ class Measurement(google.protobuf.message.Message): key: builtins.str = ..., invert_mask: collections.abc.Iterable[builtins.bool] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["invert_mask", b"invert_mask", "key", b"key", "targets", b"targets"]) -> None: ... + def ClearField(self, field_name: typing.Literal["invert_mask", b"invert_mask", "key", b"key", "targets", b"targets"]) -> None: ... global___Measurement = Measurement -@typing_extensions.final +@typing.final class Operation(google.protobuf.message.Message): """An operation to apply: either a gate or a measurement.""" @@ -233,15 +239,19 @@ class Operation(google.protobuf.message.Message): @property def exp_w(self) -> global___ExpW: """A single-qubit rotation around an axis on the XY equator.""" + @property def exp_z(self) -> global___ExpZ: """A single-qubit rotation around the Z axis.""" + @property def exp_11(self) -> global___Exp11: """An operation that interacts two qubits, phasing only the 11 state.""" + @property def measurement(self) -> global___Measurement: """Measures a qubit and indicates where to store the result.""" + def __init__( self, *, @@ -251,8 +261,8 @@ class Operation(google.protobuf.message.Message): exp_11: global___Exp11 | None = ..., measurement: global___Measurement | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["exp_11", b"exp_11", "exp_w", b"exp_w", "exp_z", b"exp_z", "measurement", b"measurement", "operation", b"operation"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["exp_11", b"exp_11", "exp_w", b"exp_w", "exp_z", b"exp_z", "incremental_delay_picoseconds", b"incremental_delay_picoseconds", "measurement", b"measurement", "operation", b"operation"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["operation", b"operation"]) -> typing_extensions.Literal["exp_w", "exp_z", "exp_11", "measurement"] | None: ... + def HasField(self, field_name: typing.Literal["exp_11", b"exp_11", "exp_w", b"exp_w", "exp_z", b"exp_z", "measurement", b"measurement", "operation", b"operation"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["exp_11", b"exp_11", "exp_w", b"exp_w", "exp_z", b"exp_z", "incremental_delay_picoseconds", b"incremental_delay_picoseconds", "measurement", b"measurement", "operation", b"operation"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["operation", b"operation"]) -> typing.Literal["exp_w", "exp_z", "exp_11", "measurement"] | None: ... global___Operation = Operation diff --git a/cirq-google/cirq_google/api/v1/params_pb2.pyi b/cirq-google/cirq_google/api/v1/params_pb2.pyi index e57b8abd105..c3eb2f4a519 100644 --- a/cirq-google/cirq_google/api/v1/params_pb2.pyi +++ b/cirq-google/cirq_google/api/v1/params_pb2.pyi @@ -2,21 +2,17 @@ @generated by mypy-protobuf. Do not edit manually! isort:skip_file """ + import builtins import collections.abc import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.message -import sys - -if sys.version_info >= (3, 8): - import typing as typing_extensions -else: - import typing_extensions +import typing DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -@typing_extensions.final +@typing.final class ParameterSweep(google.protobuf.message.Message): """Specifies how to repeatedly sample a circuit, with or without sweeping over varying parameter-dicts. @@ -39,18 +35,19 @@ class ParameterSweep(google.protobuf.message.Message): no parameterization is assumed (and the program must have no ParameterizedFloat's with keys. """ + def __init__( self, *, repetitions: builtins.int = ..., sweep: global___ProductSweep | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["sweep", b"sweep"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["repetitions", b"repetitions", "sweep", b"sweep"]) -> None: ... + def HasField(self, field_name: typing.Literal["sweep", b"sweep"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["repetitions", b"repetitions", "sweep", b"sweep"]) -> None: ... global___ParameterSweep = ParameterSweep -@typing_extensions.final +@typing.final class ProductSweep(google.protobuf.message.Message): """A cartesian product of parameter sweeps.""" @@ -73,16 +70,17 @@ class ProductSweep(google.protobuf.message.Message): "a": 1.0, "b": 2.0 "a": 1.0, "b": 3.0 """ + def __init__( self, *, factors: collections.abc.Iterable[global___ZipSweep] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["factors", b"factors"]) -> None: ... + def ClearField(self, field_name: typing.Literal["factors", b"factors"]) -> None: ... global___ProductSweep = ProductSweep -@typing_extensions.final +@typing.final class ZipSweep(google.protobuf.message.Message): """A pairwise-joining of parameter sweeps.""" @@ -103,16 +101,17 @@ class ZipSweep(google.protobuf.message.Message): "a": 0.0, "b": 2.0 "a": 1.0, "b": 3.0 """ + def __init__( self, *, sweeps: collections.abc.Iterable[global___SingleSweep] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["sweeps", b"sweeps"]) -> None: ... + def ClearField(self, field_name: typing.Literal["sweeps", b"sweeps"]) -> None: ... global___ZipSweep = ZipSweep -@typing_extensions.final +@typing.final class SingleSweep(google.protobuf.message.Message): """A set of values to try for a particular parameter.""" @@ -126,9 +125,11 @@ class SingleSweep(google.protobuf.message.Message): @property def points(self) -> global___Points: """An explicit list of points to try.""" + @property def linspace(self) -> global___Linspace: """Uniformly-spaced sampling over a range.""" + def __init__( self, *, @@ -136,13 +137,13 @@ class SingleSweep(google.protobuf.message.Message): points: global___Points | None = ..., linspace: global___Linspace | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["linspace", b"linspace", "points", b"points", "sweep", b"sweep"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["linspace", b"linspace", "parameter_key", b"parameter_key", "points", b"points", "sweep", b"sweep"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["sweep", b"sweep"]) -> typing_extensions.Literal["points", "linspace"] | None: ... + def HasField(self, field_name: typing.Literal["linspace", b"linspace", "points", b"points", "sweep", b"sweep"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["linspace", b"linspace", "parameter_key", b"parameter_key", "points", b"points", "sweep", b"sweep"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["sweep", b"sweep"]) -> typing.Literal["points", "linspace"] | None: ... global___SingleSweep = SingleSweep -@typing_extensions.final +@typing.final class Points(google.protobuf.message.Message): """A list of explicit values.""" @@ -152,16 +153,17 @@ class Points(google.protobuf.message.Message): @property def points(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.float]: """The values.""" + def __init__( self, *, points: collections.abc.Iterable[builtins.float] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["points", b"points"]) -> None: ... + def ClearField(self, field_name: typing.Literal["points", b"points"]) -> None: ... global___Points = Points -@typing_extensions.final +@typing.final class Linspace(google.protobuf.message.Message): """A range of evenly-spaced values. @@ -191,17 +193,17 @@ class Linspace(google.protobuf.message.Message): last_point: builtins.float = ..., num_points: builtins.int = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["first_point", b"first_point", "last_point", b"last_point", "num_points", b"num_points"]) -> None: ... + def ClearField(self, field_name: typing.Literal["first_point", b"first_point", "last_point", b"last_point", "num_points", b"num_points"]) -> None: ... global___Linspace = Linspace -@typing_extensions.final +@typing.final class ParameterDict(google.protobuf.message.Message): """A point sampled during a parameter sweep.""" DESCRIPTOR: google.protobuf.descriptor.Descriptor - @typing_extensions.final + @typing.final class AssignmentsEntry(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -215,17 +217,18 @@ class ParameterDict(google.protobuf.message.Message): key: builtins.str = ..., value: builtins.float = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> None: ... + def ClearField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> None: ... ASSIGNMENTS_FIELD_NUMBER: builtins.int @property def assignments(self) -> google.protobuf.internal.containers.ScalarMap[builtins.str, builtins.float]: """Maps parameter names to values.""" + def __init__( self, *, assignments: collections.abc.Mapping[builtins.str, builtins.float] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["assignments", b"assignments"]) -> None: ... + def ClearField(self, field_name: typing.Literal["assignments", b"assignments"]) -> None: ... global___ParameterDict = ParameterDict diff --git a/cirq-google/cirq_google/api/v1/program_pb2.pyi b/cirq-google/cirq_google/api/v1/program_pb2.pyi index 8f624e72fce..0ca09ed24d4 100644 --- a/cirq-google/cirq_google/api/v1/program_pb2.pyi +++ b/cirq-google/cirq_google/api/v1/program_pb2.pyi @@ -2,6 +2,7 @@ @generated by mypy-protobuf. Do not edit manually! isort:skip_file """ + import builtins import cirq_google.api.v1.operations_pb2 import cirq_google.api.v1.params_pb2 @@ -9,16 +10,11 @@ import collections.abc import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.message -import sys - -if sys.version_info >= (3, 8): - import typing as typing_extensions -else: - import typing_extensions +import typing DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -@typing_extensions.final +@typing.final class Program(google.protobuf.message.Message): """A quantum program. This includes a quantum circuit and also a set of circuit parameters over which the circuit should be run. @@ -31,22 +27,24 @@ class Program(google.protobuf.message.Message): @property def operations(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[cirq_google.api.v1.operations_pb2.Operation]: """Gates and measurements that make up the circuit.""" + @property def parameter_sweeps(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[cirq_google.api.v1.params_pb2.ParameterSweep]: """The circuit parameters for the operations above will be evaluated for each parameter in parameter sweeps. """ + def __init__( self, *, operations: collections.abc.Iterable[cirq_google.api.v1.operations_pb2.Operation] | None = ..., parameter_sweeps: collections.abc.Iterable[cirq_google.api.v1.params_pb2.ParameterSweep] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["operations", b"operations", "parameter_sweeps", b"parameter_sweeps"]) -> None: ... + def ClearField(self, field_name: typing.Literal["operations", b"operations", "parameter_sweeps", b"parameter_sweeps"]) -> None: ... global___Program = Program -@typing_extensions.final +@typing.final class RunContext(google.protobuf.message.Message): """The context for running a quantum program.""" @@ -56,16 +54,17 @@ class RunContext(google.protobuf.message.Message): @property def parameter_sweeps(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[cirq_google.api.v1.params_pb2.ParameterSweep]: """The parameters for operations in a program.""" + def __init__( self, *, parameter_sweeps: collections.abc.Iterable[cirq_google.api.v1.params_pb2.ParameterSweep] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["parameter_sweeps", b"parameter_sweeps"]) -> None: ... + def ClearField(self, field_name: typing.Literal["parameter_sweeps", b"parameter_sweeps"]) -> None: ... global___RunContext = RunContext -@typing_extensions.final +@typing.final class ParameterizedResult(google.protobuf.message.Message): """The parameters used to generate result along with the results for this set of parameters. @@ -75,9 +74,6 @@ class ParameterizedResult(google.protobuf.message.Message): PARAMS_FIELD_NUMBER: builtins.int MEASUREMENT_RESULTS_FIELD_NUMBER: builtins.int - @property - def params(self) -> cirq_google.api.v1.params_pb2.ParameterDict: - """The parameter dict that was used when generating these results.""" measurement_results: builtins.bytes """The measurement results. This is a packed representation of all of the measurements for fixed set of parameters (specified by params above) @@ -120,18 +116,22 @@ class ParameterizedResult(google.protobuf.message.Message): bytes is the first bit of the bit string, the second-least significant bit of the bytes is the second bit of the bit string, etc. """ + @property + def params(self) -> cirq_google.api.v1.params_pb2.ParameterDict: + """The parameter dict that was used when generating these results.""" + def __init__( self, *, params: cirq_google.api.v1.params_pb2.ParameterDict | None = ..., measurement_results: builtins.bytes = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["params", b"params"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["measurement_results", b"measurement_results", "params", b"params"]) -> None: ... + def HasField(self, field_name: typing.Literal["params", b"params"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["measurement_results", b"measurement_results", "params", b"params"]) -> None: ... global___ParameterizedResult = ParameterizedResult -@typing_extensions.final +@typing.final class MeasurementKey(google.protobuf.message.Message): """A message which represents a measurement key, along with the qubits upon which the measurement acts. This measurement is in the computational @@ -147,17 +147,18 @@ class MeasurementKey(google.protobuf.message.Message): @property def qubits(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[cirq_google.api.v1.operations_pb2.Qubit]: """The qubits upon which this measurement is performed.""" + def __init__( self, *, key: builtins.str = ..., qubits: collections.abc.Iterable[cirq_google.api.v1.operations_pb2.Qubit] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "qubits", b"qubits"]) -> None: ... + def ClearField(self, field_name: typing.Literal["key", b"key", "qubits", b"qubits"]) -> None: ... global___MeasurementKey = MeasurementKey -@typing_extensions.final +@typing.final class SweepResult(google.protobuf.message.Message): """The measurement results for a particular ParameterSweep.""" @@ -178,12 +179,14 @@ class SweepResult(google.protobuf.message.Message): measurements in the list of operations for the Program. The measurement keys are all unique. """ + @property def parameterized_results(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ParameterizedResult]: """The results along with the parameters that generated these results. These represent the expanded parameters defined int he ParameterSweep which this SweepResult corresponds to. """ + def __init__( self, *, @@ -191,11 +194,11 @@ class SweepResult(google.protobuf.message.Message): measurement_keys: collections.abc.Iterable[global___MeasurementKey] | None = ..., parameterized_results: collections.abc.Iterable[global___ParameterizedResult] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["measurement_keys", b"measurement_keys", "parameterized_results", b"parameterized_results", "repetitions", b"repetitions"]) -> None: ... + def ClearField(self, field_name: typing.Literal["measurement_keys", b"measurement_keys", "parameterized_results", b"parameterized_results", "repetitions", b"repetitions"]) -> None: ... global___SweepResult = SweepResult -@typing_extensions.final +@typing.final class Result(google.protobuf.message.Message): """The overall results of running a Program.""" @@ -208,11 +211,12 @@ class Result(google.protobuf.message.Message): as the parameter_sweeps repeated field in the Program that generated these results. """ + def __init__( self, *, sweep_results: collections.abc.Iterable[global___SweepResult] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["sweep_results", b"sweep_results"]) -> None: ... + def ClearField(self, field_name: typing.Literal["sweep_results", b"sweep_results"]) -> None: ... global___Result = Result diff --git a/cirq-google/cirq_google/api/v2/device_pb2.pyi b/cirq-google/cirq_google/api/v2/device_pb2.pyi index 40a833175ff..92785321f29 100644 --- a/cirq-google/cirq_google/api/v2/device_pb2.pyi +++ b/cirq-google/cirq_google/api/v2/device_pb2.pyi @@ -2,6 +2,7 @@ @generated by mypy-protobuf. Do not edit manually! isort:skip_file """ + import builtins import collections.abc import google.protobuf.descriptor @@ -18,7 +19,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -@typing_extensions.final +@typing.final class DeviceSpecification(google.protobuf.message.Message): """This contains information about a device that includes the qubits on the device, supported gates, connections, and timing. @@ -33,16 +34,23 @@ class DeviceSpecification(google.protobuf.message.Message): VALID_QUBITS_FIELD_NUMBER: builtins.int VALID_TARGETS_FIELD_NUMBER: builtins.int DEVELOPER_RECOMMENDATIONS_FIELD_NUMBER: builtins.int + developer_recommendations: builtins.str + """Additional recommendations, caveats, and soft requirements that + are advice to users of the device, specified in English text + For instance, "All Z gates are converted to VirtualZ gates". + """ @property def valid_gate_sets(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___GateSet]: """A list of allowed gatesets for programs submitted to this processor Language.gate_set should be one of these values to be valid. """ + @property def valid_gates(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___GateSpecification]: """The device gateset. Contains the list of gates allowed in programs submitted to this processor. """ + @property def valid_qubits(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: """A list of allowed ids for qubits within the Program. @@ -52,14 +60,11 @@ class DeviceSpecification(google.protobuf.message.Message): Single-qubit gates can be applied to all qubits. Measurement and wait gates can be applied to all subset of qubits. """ + @property def valid_targets(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___TargetSet]: """A list of targets that gates can use.""" - developer_recommendations: builtins.str - """Additional recommendations, caveats, and soft requirements that - are advice to users of the device, specified in English text - For instance, "All Z gates are converted to VirtualZ gates". - """ + def __init__( self, *, @@ -69,11 +74,11 @@ class DeviceSpecification(google.protobuf.message.Message): valid_targets: collections.abc.Iterable[global___TargetSet] | None = ..., developer_recommendations: builtins.str = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["developer_recommendations", b"developer_recommendations", "valid_gate_sets", b"valid_gate_sets", "valid_gates", b"valid_gates", "valid_qubits", b"valid_qubits", "valid_targets", b"valid_targets"]) -> None: ... + def ClearField(self, field_name: typing.Literal["developer_recommendations", b"developer_recommendations", "valid_gate_sets", b"valid_gate_sets", "valid_gates", b"valid_gates", "valid_qubits", b"valid_qubits", "valid_targets", b"valid_targets"]) -> None: ... global___DeviceSpecification = DeviceSpecification -@typing_extensions.final +@typing.final class GateSpecification(google.protobuf.message.Message): """This contains information about a single device gate. Replaces `GateDefinition`. @@ -81,7 +86,7 @@ class GateSpecification(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor - @typing_extensions.final + @typing.final class Sycamore(google.protobuf.message.Message): """Gate types available to Google devices. Future gates may have parameter constraints that are frequently updated. @@ -95,7 +100,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class SqrtISwap(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -103,7 +108,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class SqrtISwapInv(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -111,7 +116,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class CZ(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -119,7 +124,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class PhasedXZ(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -127,7 +132,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class VirtualZPow(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -135,7 +140,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class PhysicalZPow(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -143,7 +148,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class CouplerPulse(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -151,7 +156,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class Measurement(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -159,7 +164,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class Wait(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -167,7 +172,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class FSimViaModel(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -175,7 +180,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class CZPowGate(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -183,7 +188,7 @@ class GateSpecification(google.protobuf.message.Message): self, ) -> None: ... - @typing_extensions.final + @typing.final class InternalGate(google.protobuf.message.Message): """This gate gets mapped to the internal representation corresponding to . @@ -257,13 +262,13 @@ class GateSpecification(google.protobuf.message.Message): cz_pow_gate: global___GateSpecification.CZPowGate | None = ..., internal_gate: global___GateSpecification.InternalGate | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["coupler_pulse", b"coupler_pulse", "cz", b"cz", "cz_pow_gate", b"cz_pow_gate", "fsim_via_model", b"fsim_via_model", "gate", b"gate", "internal_gate", b"internal_gate", "meas", b"meas", "phased_xz", b"phased_xz", "physical_zpow", b"physical_zpow", "sqrt_iswap", b"sqrt_iswap", "sqrt_iswap_inv", b"sqrt_iswap_inv", "syc", b"syc", "virtual_zpow", b"virtual_zpow", "wait", b"wait"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["coupler_pulse", b"coupler_pulse", "cz", b"cz", "cz_pow_gate", b"cz_pow_gate", "fsim_via_model", b"fsim_via_model", "gate", b"gate", "gate_duration_picos", b"gate_duration_picos", "internal_gate", b"internal_gate", "meas", b"meas", "phased_xz", b"phased_xz", "physical_zpow", b"physical_zpow", "sqrt_iswap", b"sqrt_iswap", "sqrt_iswap_inv", b"sqrt_iswap_inv", "syc", b"syc", "virtual_zpow", b"virtual_zpow", "wait", b"wait"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["gate", b"gate"]) -> typing_extensions.Literal["syc", "sqrt_iswap", "sqrt_iswap_inv", "cz", "phased_xz", "virtual_zpow", "physical_zpow", "coupler_pulse", "meas", "wait", "fsim_via_model", "cz_pow_gate", "internal_gate"] | None: ... + def HasField(self, field_name: typing.Literal["coupler_pulse", b"coupler_pulse", "cz", b"cz", "cz_pow_gate", b"cz_pow_gate", "fsim_via_model", b"fsim_via_model", "gate", b"gate", "internal_gate", b"internal_gate", "meas", b"meas", "phased_xz", b"phased_xz", "physical_zpow", b"physical_zpow", "sqrt_iswap", b"sqrt_iswap", "sqrt_iswap_inv", b"sqrt_iswap_inv", "syc", b"syc", "virtual_zpow", b"virtual_zpow", "wait", b"wait"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["coupler_pulse", b"coupler_pulse", "cz", b"cz", "cz_pow_gate", b"cz_pow_gate", "fsim_via_model", b"fsim_via_model", "gate", b"gate", "gate_duration_picos", b"gate_duration_picos", "internal_gate", b"internal_gate", "meas", b"meas", "phased_xz", b"phased_xz", "physical_zpow", b"physical_zpow", "sqrt_iswap", b"sqrt_iswap", "sqrt_iswap_inv", b"sqrt_iswap_inv", "syc", b"syc", "virtual_zpow", b"virtual_zpow", "wait", b"wait"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["gate", b"gate"]) -> typing.Literal["syc", "sqrt_iswap", "sqrt_iswap_inv", "cz", "phased_xz", "virtual_zpow", "physical_zpow", "coupler_pulse", "meas", "wait", "fsim_via_model", "cz_pow_gate", "internal_gate"] | None: ... global___GateSpecification = GateSpecification -@typing_extensions.final +@typing.final class GateSet(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -274,17 +279,18 @@ class GateSet(google.protobuf.message.Message): @property def valid_gates(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___GateDefinition]: """A list of valid gates permitted by this gate set""" + def __init__( self, *, name: builtins.str = ..., valid_gates: collections.abc.Iterable[global___GateDefinition] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "valid_gates", b"valid_gates"]) -> None: ... + def ClearField(self, field_name: typing.Literal["name", b"name", "valid_gates", b"valid_gates"]) -> None: ... global___GateSet = GateSet -@typing_extensions.final +@typing.final class GateDefinition(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -297,21 +303,23 @@ class GateDefinition(google.protobuf.message.Message): """The name for the gate. This must match the Gate.id in your program.""" number_of_qubits: builtins.int """If unset or set to zero, any number of qubits is allowed.""" + gate_duration_picos: builtins.int + """This defines the approximate amount of time for each gate, + specified as an integer number of picoseconds. + """ @property def valid_args(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ArgDefinition]: """The name of the arguments that should be specified for an operation of this gate """ - gate_duration_picos: builtins.int - """This defines the approximate amount of time for each gate, - specified as an integer number of picoseconds. - """ + @property def valid_targets(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: """Valid targets that this gate can use. Values in this list correspond to the name of the TargetSet If unset, all combinations with number_of_qubits target are allowed. """ + def __init__( self, *, @@ -321,11 +329,11 @@ class GateDefinition(google.protobuf.message.Message): gate_duration_picos: builtins.int = ..., valid_targets: collections.abc.Iterable[builtins.str] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["gate_duration_picos", b"gate_duration_picos", "id", b"id", "number_of_qubits", b"number_of_qubits", "valid_args", b"valid_args", "valid_targets", b"valid_targets"]) -> None: ... + def ClearField(self, field_name: typing.Literal["gate_duration_picos", b"gate_duration_picos", "id", b"id", "number_of_qubits", b"number_of_qubits", "valid_args", b"valid_args", "valid_targets", b"valid_targets"]) -> None: ... global___GateDefinition = GateDefinition -@typing_extensions.final +@typing.final class ArgDefinition(google.protobuf.message.Message): """A description of an argument to an operation.""" @@ -335,7 +343,7 @@ class ArgDefinition(google.protobuf.message.Message): ValueType = typing.NewType("ValueType", builtins.int) V: typing_extensions.TypeAlias = ValueType - class _ArgTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[ArgDefinition._ArgType.ValueType], builtins.type): # noqa: F821 + class _ArgTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[ArgDefinition._ArgType.ValueType], builtins.type): DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor UNSPECIFIED: ArgDefinition._ArgType.ValueType # 0 FLOAT: ArgDefinition._ArgType.ValueType # 1 @@ -368,6 +376,7 @@ class ArgDefinition(google.protobuf.message.Message): """This should only be populated for type FLOAT. If not set, all float values are allowed. """ + def __init__( self, *, @@ -375,11 +384,11 @@ class ArgDefinition(google.protobuf.message.Message): type: global___ArgDefinition.ArgType.ValueType = ..., allowed_ranges: collections.abc.Iterable[global___ArgumentRange] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["allowed_ranges", b"allowed_ranges", "name", b"name", "type", b"type"]) -> None: ... + def ClearField(self, field_name: typing.Literal["allowed_ranges", b"allowed_ranges", "name", b"name", "type", b"type"]) -> None: ... global___ArgDefinition = ArgDefinition -@typing_extensions.final +@typing.final class ArgumentRange(google.protobuf.message.Message): """Minimum value is inclusive and maximum value is exclusive. If minimum and maximum values are the same, only a single value is allowed. @@ -397,11 +406,11 @@ class ArgumentRange(google.protobuf.message.Message): minimum_value: builtins.float = ..., maximum_value: builtins.float = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["maximum_value", b"maximum_value", "minimum_value", b"minimum_value"]) -> None: ... + def ClearField(self, field_name: typing.Literal["maximum_value", b"maximum_value", "minimum_value", b"minimum_value"]) -> None: ... global___ArgumentRange = ArgumentRange -@typing_extensions.final +@typing.final class TargetSet(google.protobuf.message.Message): """A list of targets that are valid for a set of gates. For instance, all qubit pairs that can be acted on by a 2-qubit gate @@ -413,7 +422,7 @@ class TargetSet(google.protobuf.message.Message): ValueType = typing.NewType("ValueType", builtins.int) V: typing_extensions.TypeAlias = ValueType - class _TargetOrderingEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[TargetSet._TargetOrdering.ValueType], builtins.type): # noqa: F821 + class _TargetOrderingEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[TargetSet._TargetOrdering.ValueType], builtins.type): DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor UNSPECIFIED: TargetSet._TargetOrdering.ValueType # 0 SYMMETRIC: TargetSet._TargetOrdering.ValueType # 1 @@ -471,6 +480,7 @@ class TargetSet(google.protobuf.message.Message): @property def targets(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Target]: """A list of targets that are valid""" + def __init__( self, *, @@ -478,11 +488,11 @@ class TargetSet(google.protobuf.message.Message): target_ordering: global___TargetSet.TargetOrdering.ValueType = ..., targets: collections.abc.Iterable[global___Target] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "target_ordering", b"target_ordering", "targets", b"targets"]) -> None: ... + def ClearField(self, field_name: typing.Literal["name", b"name", "target_ordering", b"target_ordering", "targets", b"targets"]) -> None: ... global___TargetSet = TargetSet -@typing_extensions.final +@typing.final class Target(google.protobuf.message.Message): """A description of a valid target of a multi-qubit gate operation For most Google devices, this will be a pair of qubit ids. @@ -494,11 +504,12 @@ class Target(google.protobuf.message.Message): @property def ids(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: """A list of qubit ids that form a valid gate target.""" + def __init__( self, *, ids: collections.abc.Iterable[builtins.str] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["ids", b"ids"]) -> None: ... + def ClearField(self, field_name: typing.Literal["ids", b"ids"]) -> None: ... global___Target = Target diff --git a/cirq-google/cirq_google/api/v2/metrics_pb2.pyi b/cirq-google/cirq_google/api/v2/metrics_pb2.pyi index 4ee320dbb49..b32fcdd2c12 100644 --- a/cirq-google/cirq_google/api/v2/metrics_pb2.pyi +++ b/cirq-google/cirq_google/api/v2/metrics_pb2.pyi @@ -2,21 +2,17 @@ @generated by mypy-protobuf. Do not edit manually! isort:skip_file """ + import builtins import collections.abc import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.message -import sys - -if sys.version_info >= (3, 8): - import typing as typing_extensions -else: - import typing_extensions +import typing DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -@typing_extensions.final +@typing.final class MetricsSnapshot(google.protobuf.message.Message): """A snapshot of the performance metrics for a quantum processor at a particular time. @@ -34,17 +30,18 @@ class MetricsSnapshot(google.protobuf.message.Message): @property def metrics(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Metric]: """All of the metrics collected during this snapshot.""" + def __init__( self, *, timestamp_ms: builtins.int = ..., metrics: collections.abc.Iterable[global___Metric] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["metrics", b"metrics", "timestamp_ms", b"timestamp_ms"]) -> None: ... + def ClearField(self, field_name: typing.Literal["metrics", b"metrics", "timestamp_ms", b"timestamp_ms"]) -> None: ... global___MetricsSnapshot = MetricsSnapshot -@typing_extensions.final +@typing.final class Metric(google.protobuf.message.Message): """The actual metrics.""" @@ -63,11 +60,13 @@ class Metric(google.protobuf.message.Message): strings like `q0_1`), but may also be empty when the metric applies globally. """ + @property def values(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Value]: """The values of this Metrics. Repeated to support multivalued metrics like tomography. """ + def __init__( self, *, @@ -75,11 +74,11 @@ class Metric(google.protobuf.message.Message): targets: collections.abc.Iterable[builtins.str] | None = ..., values: collections.abc.Iterable[global___Value] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "targets", b"targets", "values", b"values"]) -> None: ... + def ClearField(self, field_name: typing.Literal["name", b"name", "targets", b"targets", "values", b"values"]) -> None: ... global___Metric = Metric -@typing_extensions.final +@typing.final class Value(google.protobuf.message.Message): """A generic metric value.""" @@ -101,8 +100,8 @@ class Value(google.protobuf.message.Message): int64_val: builtins.int = ..., str_val: builtins.str = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["double_val", b"double_val", "int32_val", b"int32_val", "int64_val", b"int64_val", "str_val", b"str_val", "val", b"val"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["double_val", b"double_val", "int32_val", b"int32_val", "int64_val", b"int64_val", "str_val", b"str_val", "val", b"val"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["val", b"val"]) -> typing_extensions.Literal["double_val", "int32_val", "int64_val", "str_val"] | None: ... + def HasField(self, field_name: typing.Literal["double_val", b"double_val", "int32_val", b"int32_val", "int64_val", b"int64_val", "str_val", b"str_val", "val", b"val"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["double_val", b"double_val", "int32_val", b"int32_val", "int64_val", b"int64_val", "str_val", b"str_val", "val", b"val"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["val", b"val"]) -> typing.Literal["double_val", "int32_val", "int64_val", "str_val"] | None: ... global___Value = Value diff --git a/cirq-google/cirq_google/api/v2/program_pb2.pyi b/cirq-google/cirq_google/api/v2/program_pb2.pyi index abc56d9adbf..3125e02ba00 100644 --- a/cirq-google/cirq_google/api/v2/program_pb2.pyi +++ b/cirq-google/cirq_google/api/v2/program_pb2.pyi @@ -2,6 +2,7 @@ @generated by mypy-protobuf. Do not edit manually! isort:skip_file """ + import builtins import collections.abc import google.protobuf.descriptor @@ -18,7 +19,7 @@ else: DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -@typing_extensions.final +@typing.final class Program(google.protobuf.message.Message): """A quantum program.""" @@ -31,22 +32,26 @@ class Program(google.protobuf.message.Message): @property def language(self) -> global___Language: """The language in which the program is written.""" + @property def circuit(self) -> global___Circuit: """A circuit is an abstract representation as a series of moments, each moment having a set of gates that act on disjoint qubits. Circuits don't have absolute times for their operations (gates acting on qubits). """ + @property def schedule(self) -> global___Schedule: """Schedules are a list of operations (gates acting on qubits) that specify absolute start times for the operations. """ + @property def constants(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Constant]: """List to store global constants, such as strings used in many places. constants are referred to their index in this list, starting at zero. """ + def __init__( self, *, @@ -55,13 +60,13 @@ class Program(google.protobuf.message.Message): schedule: global___Schedule | None = ..., constants: collections.abc.Iterable[global___Constant] | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["circuit", b"circuit", "language", b"language", "program", b"program", "schedule", b"schedule"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["circuit", b"circuit", "constants", b"constants", "language", b"language", "program", b"program", "schedule", b"schedule"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["program", b"program"]) -> typing_extensions.Literal["circuit", "schedule"] | None: ... + def HasField(self, field_name: typing.Literal["circuit", b"circuit", "language", b"language", "program", b"program", "schedule", b"schedule"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["circuit", b"circuit", "constants", b"constants", "language", b"language", "program", b"program", "schedule", b"schedule"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["program", b"program"]) -> typing.Literal["circuit", "schedule"] | None: ... global___Program = Program -@typing_extensions.final +@typing.final class Constant(google.protobuf.message.Message): """Constants, such as long strings, that are used throughout the circuit. These constants can be stored here to save space. @@ -77,9 +82,11 @@ class Constant(google.protobuf.message.Message): @property def circuit_value(self) -> global___Circuit: """Sub Circuit used for CircuitOperations""" + @property def qubit(self) -> global___Qubit: """Qubits used within the circuit (only populated in v2.5+)""" + def __init__( self, *, @@ -87,13 +94,13 @@ class Constant(google.protobuf.message.Message): circuit_value: global___Circuit | None = ..., qubit: global___Qubit | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["circuit_value", b"circuit_value", "const_value", b"const_value", "qubit", b"qubit", "string_value", b"string_value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["circuit_value", b"circuit_value", "const_value", b"const_value", "qubit", b"qubit", "string_value", b"string_value"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["const_value", b"const_value"]) -> typing_extensions.Literal["string_value", "circuit_value", "qubit"] | None: ... + def HasField(self, field_name: typing.Literal["circuit_value", b"circuit_value", "const_value", b"const_value", "qubit", b"qubit", "string_value", b"string_value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["circuit_value", b"circuit_value", "const_value", b"const_value", "qubit", b"qubit", "string_value", b"string_value"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["const_value", b"const_value"]) -> typing.Literal["string_value", "circuit_value", "qubit"] | None: ... global___Constant = Constant -@typing_extensions.final +@typing.final class Circuit(google.protobuf.message.Message): """The quantum circuit, specified as a series of moments (abstract slices of times with gates acting on disjoint sets of qubits). @@ -105,7 +112,7 @@ class Circuit(google.protobuf.message.Message): ValueType = typing.NewType("ValueType", builtins.int) V: typing_extensions.TypeAlias = ValueType - class _SchedulingStrategyEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[Circuit._SchedulingStrategy.ValueType], builtins.type): # noqa: F821 + class _SchedulingStrategyEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[Circuit._SchedulingStrategy.ValueType], builtins.type): DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor SCHEDULING_STRATEGY_UNSPECIFIED: Circuit._SchedulingStrategy.ValueType # 0 """The scheduling strategy is unspecified.""" @@ -134,17 +141,18 @@ class Circuit(google.protobuf.message.Message): """The moments of the circuit, with the first element corresponding to the first set of operations to apply, etc. """ + def __init__( self, *, scheduling_strategy: global___Circuit.SchedulingStrategy.ValueType = ..., moments: collections.abc.Iterable[global___Moment] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["moments", b"moments", "scheduling_strategy", b"scheduling_strategy"]) -> None: ... + def ClearField(self, field_name: typing.Literal["moments", b"moments", "scheduling_strategy", b"scheduling_strategy"]) -> None: ... global___Circuit = Circuit -@typing_extensions.final +@typing.final class Moment(google.protobuf.message.Message): """A moment is a collection of operations and circuit operations that operate on a disjoint set of qubits. Conceptually, a moment represents operations @@ -160,22 +168,24 @@ class Moment(google.protobuf.message.Message): """All of the gate operations in the moment. Each operation and circuit operation must act on different qubits. """ + @property def circuit_operations(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___CircuitOperation]: """All of the circuit operations in the moment. Each operation and circuit operation must act on different qubits. """ + def __init__( self, *, operations: collections.abc.Iterable[global___Operation] | None = ..., circuit_operations: collections.abc.Iterable[global___CircuitOperation] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["circuit_operations", b"circuit_operations", "operations", b"operations"]) -> None: ... + def ClearField(self, field_name: typing.Literal["circuit_operations", b"circuit_operations", "operations", b"operations"]) -> None: ... global___Moment = Moment -@typing_extensions.final +@typing.final class Schedule(google.protobuf.message.Message): """The quantum circuit, specified as a series of operations at specific start times. @@ -187,16 +197,17 @@ class Schedule(google.protobuf.message.Message): @property def scheduled_operations(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ScheduledOperation]: """A list of all the operations and their absolute start times.""" + def __init__( self, *, scheduled_operations: collections.abc.Iterable[global___ScheduledOperation] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["scheduled_operations", b"scheduled_operations"]) -> None: ... + def ClearField(self, field_name: typing.Literal["scheduled_operations", b"scheduled_operations"]) -> None: ... global___Schedule = Schedule -@typing_extensions.final +@typing.final class ScheduledOperation(google.protobuf.message.Message): """An operation occurring at a specific start time.""" @@ -204,27 +215,28 @@ class ScheduledOperation(google.protobuf.message.Message): OPERATION_FIELD_NUMBER: builtins.int START_TIME_PICOS_FIELD_NUMBER: builtins.int - @property - def operation(self) -> global___Operation: - """Which operation is to be scheduled.""" start_time_picos: builtins.int """The start time of the operation, with zero representing the absolute start of the circuit. This must be consistent with the moment structure and must be positive. """ + @property + def operation(self) -> global___Operation: + """Which operation is to be scheduled.""" + def __init__( self, *, operation: global___Operation | None = ..., start_time_picos: builtins.int = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["operation", b"operation"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["operation", b"operation", "start_time_picos", b"start_time_picos"]) -> None: ... + def HasField(self, field_name: typing.Literal["operation", b"operation"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["operation", b"operation", "start_time_picos", b"start_time_picos"]) -> None: ... global___ScheduledOperation = ScheduledOperation -@typing_extensions.final +@typing.final class Language(google.protobuf.message.Message): """The language in which the program is expressed.""" @@ -256,11 +268,11 @@ class Language(google.protobuf.message.Message): gate_set: builtins.str = ..., arg_function_language: builtins.str = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["arg_function_language", b"arg_function_language", "gate_set", b"gate_set"]) -> None: ... + def ClearField(self, field_name: typing.Literal["arg_function_language", b"arg_function_language", "gate_set", b"gate_set"]) -> None: ... global___Language = Language -@typing_extensions.final +@typing.final class FloatArg(google.protobuf.message.Message): """Argument that is constrained to a float or symbolic expression""" @@ -280,13 +292,13 @@ class FloatArg(google.protobuf.message.Message): symbol: builtins.str = ..., func: global___ArgFunction | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["arg", b"arg", "float_value", b"float_value", "func", b"func", "symbol", b"symbol"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["arg", b"arg", "float_value", b"float_value", "func", b"func", "symbol", b"symbol"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["arg", b"arg"]) -> typing_extensions.Literal["float_value", "symbol", "func"] | None: ... + def HasField(self, field_name: typing.Literal["arg", b"arg", "float_value", b"float_value", "func", b"func", "symbol", b"symbol"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["arg", b"arg", "float_value", b"float_value", "func", b"func", "symbol", b"symbol"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["arg", b"arg"]) -> typing.Literal["float_value", "symbol", "func"] | None: ... global___FloatArg = FloatArg -@typing_extensions.final +@typing.final class XPowGate(google.protobuf.message.Message): """Representation of cirq.XPowGate""" @@ -300,12 +312,12 @@ class XPowGate(google.protobuf.message.Message): *, exponent: global___FloatArg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> None: ... + def HasField(self, field_name: typing.Literal["exponent", b"exponent"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["exponent", b"exponent"]) -> None: ... global___XPowGate = XPowGate -@typing_extensions.final +@typing.final class YPowGate(google.protobuf.message.Message): """Representation of cirq.YPowGate""" @@ -319,12 +331,12 @@ class YPowGate(google.protobuf.message.Message): *, exponent: global___FloatArg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> None: ... + def HasField(self, field_name: typing.Literal["exponent", b"exponent"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["exponent", b"exponent"]) -> None: ... global___YPowGate = YPowGate -@typing_extensions.final +@typing.final class ZPowGate(google.protobuf.message.Message): """Representation of cirq.ZPowGate""" @@ -332,24 +344,24 @@ class ZPowGate(google.protobuf.message.Message): EXPONENT_FIELD_NUMBER: builtins.int IS_PHYSICAL_Z_FIELD_NUMBER: builtins.int - @property - def exponent(self) -> global___FloatArg: ... is_physical_z: builtins.bool """If true, this is equivalent to: cirq.ZPowGate(...).with_tags(cirq.google.PhysicalZTag) """ + @property + def exponent(self) -> global___FloatArg: ... def __init__( self, *, exponent: global___FloatArg | None = ..., is_physical_z: builtins.bool = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["exponent", b"exponent", "is_physical_z", b"is_physical_z"]) -> None: ... + def HasField(self, field_name: typing.Literal["exponent", b"exponent"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["exponent", b"exponent", "is_physical_z", b"is_physical_z"]) -> None: ... global___ZPowGate = ZPowGate -@typing_extensions.final +@typing.final class PhasedXPowGate(google.protobuf.message.Message): """Representation of cirq.PhasedXPowGate""" @@ -367,12 +379,12 @@ class PhasedXPowGate(google.protobuf.message.Message): phase_exponent: global___FloatArg | None = ..., exponent: global___FloatArg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["exponent", b"exponent", "phase_exponent", b"phase_exponent"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["exponent", b"exponent", "phase_exponent", b"phase_exponent"]) -> None: ... + def HasField(self, field_name: typing.Literal["exponent", b"exponent", "phase_exponent", b"phase_exponent"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["exponent", b"exponent", "phase_exponent", b"phase_exponent"]) -> None: ... global___PhasedXPowGate = PhasedXPowGate -@typing_extensions.final +@typing.final class PhasedXZGate(google.protobuf.message.Message): """Representation of cirq.PhasedXZGate""" @@ -394,12 +406,12 @@ class PhasedXZGate(google.protobuf.message.Message): z_exponent: global___FloatArg | None = ..., axis_phase_exponent: global___FloatArg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["axis_phase_exponent", b"axis_phase_exponent", "x_exponent", b"x_exponent", "z_exponent", b"z_exponent"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["axis_phase_exponent", b"axis_phase_exponent", "x_exponent", b"x_exponent", "z_exponent", b"z_exponent"]) -> None: ... + def HasField(self, field_name: typing.Literal["axis_phase_exponent", b"axis_phase_exponent", "x_exponent", b"x_exponent", "z_exponent", b"z_exponent"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["axis_phase_exponent", b"axis_phase_exponent", "x_exponent", b"x_exponent", "z_exponent", b"z_exponent"]) -> None: ... global___PhasedXZGate = PhasedXZGate -@typing_extensions.final +@typing.final class CZPowGate(google.protobuf.message.Message): """Representation of cirq.CZPowGate""" @@ -413,12 +425,12 @@ class CZPowGate(google.protobuf.message.Message): *, exponent: global___FloatArg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> None: ... + def HasField(self, field_name: typing.Literal["exponent", b"exponent"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["exponent", b"exponent"]) -> None: ... global___CZPowGate = CZPowGate -@typing_extensions.final +@typing.final class FSimGate(google.protobuf.message.Message): """Representation of cirq.FSimGate""" @@ -427,15 +439,15 @@ class FSimGate(google.protobuf.message.Message): THETA_FIELD_NUMBER: builtins.int PHI_FIELD_NUMBER: builtins.int TRANSLATE_VIA_MODEL_FIELD_NUMBER: builtins.int - @property - def theta(self) -> global___FloatArg: ... - @property - def phi(self) -> global___FloatArg: ... translate_via_model: builtins.bool """If true, this is equivalent to: cirq.FSimGate(...).with_tags(cirq_google.FSimViaModelTag()). This field controls how we translate the gate implementation. """ + @property + def theta(self) -> global___FloatArg: ... + @property + def phi(self) -> global___FloatArg: ... def __init__( self, *, @@ -443,12 +455,12 @@ class FSimGate(google.protobuf.message.Message): phi: global___FloatArg | None = ..., translate_via_model: builtins.bool = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["phi", b"phi", "theta", b"theta"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["phi", b"phi", "theta", b"theta", "translate_via_model", b"translate_via_model"]) -> None: ... + def HasField(self, field_name: typing.Literal["phi", b"phi", "theta", b"theta"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["phi", b"phi", "theta", b"theta", "translate_via_model", b"translate_via_model"]) -> None: ... global___FSimGate = FSimGate -@typing_extensions.final +@typing.final class ISwapPowGate(google.protobuf.message.Message): """Representation of cirq.ISwapPowGate""" @@ -462,12 +474,12 @@ class ISwapPowGate(google.protobuf.message.Message): *, exponent: global___FloatArg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> None: ... + def HasField(self, field_name: typing.Literal["exponent", b"exponent"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["exponent", b"exponent"]) -> None: ... global___ISwapPowGate = ISwapPowGate -@typing_extensions.final +@typing.final class MeasurementGate(google.protobuf.message.Message): """Representation of cirq.MeasurementGate i.e. cirq.measure @@ -487,12 +499,12 @@ class MeasurementGate(google.protobuf.message.Message): key: global___Arg | None = ..., invert_mask: global___Arg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["invert_mask", b"invert_mask", "key", b"key"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["invert_mask", b"invert_mask", "key", b"key"]) -> None: ... + def HasField(self, field_name: typing.Literal["invert_mask", b"invert_mask", "key", b"key"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["invert_mask", b"invert_mask", "key", b"key"]) -> None: ... global___MeasurementGate = MeasurementGate -@typing_extensions.final +@typing.final class WaitGate(google.protobuf.message.Message): """Representation of cirq.WAitGate""" @@ -504,23 +516,24 @@ class WaitGate(google.protobuf.message.Message): """Duration of the waiting period, serialized to the number of nanoseconds """ + def __init__( self, *, duration_nanos: global___FloatArg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["duration_nanos", b"duration_nanos"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["duration_nanos", b"duration_nanos"]) -> None: ... + def HasField(self, field_name: typing.Literal["duration_nanos", b"duration_nanos"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["duration_nanos", b"duration_nanos"]) -> None: ... global___WaitGate = WaitGate -@typing_extensions.final +@typing.final class Operation(google.protobuf.message.Message): """An operation acts on a set of qubits.""" DESCRIPTOR: google.protobuf.descriptor.Descriptor - @typing_extensions.final + @typing.final class ArgsEntry(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -535,8 +548,8 @@ class Operation(google.protobuf.message.Message): key: builtins.str = ..., value: global___Arg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["value", b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> None: ... + def HasField(self, field_name: typing.Literal["value", b"value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> None: ... GATE_FIELD_NUMBER: builtins.int XPOWGATE_FIELD_NUMBER: builtins.int @@ -559,11 +572,14 @@ class Operation(google.protobuf.message.Message): QUBIT_CONSTANT_INDEX_FIELD_NUMBER: builtins.int TOKEN_VALUE_FIELD_NUMBER: builtins.int TOKEN_CONSTANT_INDEX_FIELD_NUMBER: builtins.int + token_value: builtins.str + token_constant_index: builtins.int @property def gate(self) -> global___Gate: """Which gate this operation corresponds to. Populated pre-v2.5+. """ + @property def xpowgate(self) -> global___XPowGate: ... @property @@ -599,6 +615,7 @@ class Operation(google.protobuf.message.Message): """Map from the argument name to the Argument needed to fully specify the gate. Only populated pre-v2.5+. """ + @property def qubits(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Qubit]: """Which qubits the operation acts on. @@ -608,10 +625,9 @@ class Operation(google.protobuf.message.Message): constant messages. Note that qubit_constant_index will only be populated in v2.5+ """ + @property def qubit_constant_index(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: ... - token_value: builtins.str - token_constant_index: builtins.int def __init__( self, *, @@ -637,16 +653,16 @@ class Operation(google.protobuf.message.Message): token_value: builtins.str = ..., token_constant_index: builtins.int = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate", b"gate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "singlequbitcliffordgate", b"singlequbitcliffordgate", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["args", b"args", "couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate", b"gate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "qubit_constant_index", b"qubit_constant_index", "qubits", b"qubits", "singlequbitcliffordgate", b"singlequbitcliffordgate", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> None: ... + def HasField(self, field_name: typing.Literal["couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate", b"gate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "singlequbitcliffordgate", b"singlequbitcliffordgate", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["args", b"args", "couplerpulsegate", b"couplerpulsegate", "czpowgate", b"czpowgate", "fsimgate", b"fsimgate", "gate", b"gate", "gate_value", b"gate_value", "hpowgate", b"hpowgate", "identitygate", b"identitygate", "internalgate", b"internalgate", "iswappowgate", b"iswappowgate", "measurementgate", b"measurementgate", "phasedxpowgate", b"phasedxpowgate", "phasedxzgate", b"phasedxzgate", "qubit_constant_index", b"qubit_constant_index", "qubits", b"qubits", "singlequbitcliffordgate", b"singlequbitcliffordgate", "token", b"token", "token_constant_index", b"token_constant_index", "token_value", b"token_value", "waitgate", b"waitgate", "xpowgate", b"xpowgate", "ypowgate", b"ypowgate", "zpowgate", b"zpowgate"]) -> None: ... @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["gate_value", b"gate_value"]) -> typing_extensions.Literal["xpowgate", "ypowgate", "zpowgate", "phasedxpowgate", "phasedxzgate", "czpowgate", "fsimgate", "iswappowgate", "measurementgate", "waitgate", "internalgate", "couplerpulsegate", "identitygate", "hpowgate", "singlequbitcliffordgate"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["gate_value", b"gate_value"]) -> typing.Literal["xpowgate", "ypowgate", "zpowgate", "phasedxpowgate", "phasedxzgate", "czpowgate", "fsimgate", "iswappowgate", "measurementgate", "waitgate", "internalgate", "couplerpulsegate", "identitygate", "hpowgate", "singlequbitcliffordgate"] | None: ... @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["token", b"token"]) -> typing_extensions.Literal["token_value", "token_constant_index"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["token", b"token"]) -> typing.Literal["token_value", "token_constant_index"] | None: ... global___Operation = Operation -@typing_extensions.final +@typing.final class Gate(google.protobuf.message.Message): """The instruction identifying the action taken on the quantum computer.""" @@ -664,11 +680,11 @@ class Gate(google.protobuf.message.Message): *, id: builtins.str = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["id", b"id"]) -> None: ... + def ClearField(self, field_name: typing.Literal["id", b"id"]) -> None: ... global___Gate = Gate -@typing_extensions.final +@typing.final class Qubit(google.protobuf.message.Message): """An identifier for a qubit.""" @@ -687,11 +703,11 @@ class Qubit(google.protobuf.message.Message): *, id: builtins.str = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["id", b"id"]) -> None: ... + def ClearField(self, field_name: typing.Literal["id", b"id"]) -> None: ... global___Qubit = Qubit -@typing_extensions.final +@typing.final class Arg(google.protobuf.message.Message): """Arguments needed to specify a gate.""" @@ -701,12 +717,12 @@ class Arg(google.protobuf.message.Message): SYMBOL_FIELD_NUMBER: builtins.int FUNC_FIELD_NUMBER: builtins.int CONSTANT_INDEX_FIELD_NUMBER: builtins.int + symbol: builtins.str + constant_index: builtins.int @property def arg_value(self) -> global___ArgValue: ... - symbol: builtins.str @property def func(self) -> global___ArgFunction: ... - constant_index: builtins.int def __init__( self, *, @@ -715,13 +731,13 @@ class Arg(google.protobuf.message.Message): func: global___ArgFunction | None = ..., constant_index: builtins.int = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["arg", b"arg", "arg_value", b"arg_value", "constant_index", b"constant_index", "func", b"func", "symbol", b"symbol"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["arg", b"arg", "arg_value", b"arg_value", "constant_index", b"constant_index", "func", b"func", "symbol", b"symbol"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["arg", b"arg"]) -> typing_extensions.Literal["arg_value", "symbol", "func", "constant_index"] | None: ... + def HasField(self, field_name: typing.Literal["arg", b"arg", "arg_value", b"arg_value", "constant_index", b"constant_index", "func", b"func", "symbol", b"symbol"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["arg", b"arg", "arg_value", b"arg_value", "constant_index", b"constant_index", "func", b"func", "symbol", b"symbol"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["arg", b"arg"]) -> typing.Literal["arg_value", "symbol", "func", "constant_index"] | None: ... global___Arg = Arg -@typing_extensions.final +@typing.final class ArgValue(google.protobuf.message.Message): """Value that can be passed as an argument to a gate.""" @@ -735,11 +751,11 @@ class ArgValue(google.protobuf.message.Message): DOUBLE_VALUES_FIELD_NUMBER: builtins.int STRING_VALUES_FIELD_NUMBER: builtins.int float_value: builtins.float - @property - def bool_values(self) -> global___RepeatedBoolean: ... string_value: builtins.str double_value: builtins.float @property + def bool_values(self) -> global___RepeatedBoolean: ... + @property def int64_values(self) -> global___RepeatedInt64: ... @property def double_values(self) -> global___RepeatedDouble: ... @@ -756,13 +772,13 @@ class ArgValue(google.protobuf.message.Message): double_values: global___RepeatedDouble | None = ..., string_values: global___RepeatedString | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["arg_value", b"arg_value"]) -> typing_extensions.Literal["float_value", "bool_values", "string_value", "double_value", "int64_values", "double_values", "string_values"] | None: ... + def HasField(self, field_name: typing.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["arg_value", b"arg_value", "bool_values", b"bool_values", "double_value", b"double_value", "double_values", b"double_values", "float_value", b"float_value", "int64_values", b"int64_values", "string_value", b"string_value", "string_values", b"string_values"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["arg_value", b"arg_value"]) -> typing.Literal["float_value", "bool_values", "string_value", "double_value", "int64_values", "double_values", "string_values"] | None: ... global___ArgValue = ArgValue -@typing_extensions.final +@typing.final class RepeatedInt64(google.protobuf.message.Message): """A repeated int value.""" @@ -776,11 +792,11 @@ class RepeatedInt64(google.protobuf.message.Message): *, values: collections.abc.Iterable[builtins.int] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["values", b"values"]) -> None: ... + def ClearField(self, field_name: typing.Literal["values", b"values"]) -> None: ... global___RepeatedInt64 = RepeatedInt64 -@typing_extensions.final +@typing.final class RepeatedDouble(google.protobuf.message.Message): """A repeated double value.""" @@ -794,11 +810,11 @@ class RepeatedDouble(google.protobuf.message.Message): *, values: collections.abc.Iterable[builtins.float] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["values", b"values"]) -> None: ... + def ClearField(self, field_name: typing.Literal["values", b"values"]) -> None: ... global___RepeatedDouble = RepeatedDouble -@typing_extensions.final +@typing.final class RepeatedString(google.protobuf.message.Message): """A repeated string value.""" @@ -812,11 +828,11 @@ class RepeatedString(google.protobuf.message.Message): *, values: collections.abc.Iterable[builtins.str] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["values", b"values"]) -> None: ... + def ClearField(self, field_name: typing.Literal["values", b"values"]) -> None: ... global___RepeatedString = RepeatedString -@typing_extensions.final +@typing.final class RepeatedBoolean(google.protobuf.message.Message): """A repeated boolean value.""" @@ -830,11 +846,11 @@ class RepeatedBoolean(google.protobuf.message.Message): *, values: collections.abc.Iterable[builtins.bool] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["values", b"values"]) -> None: ... + def ClearField(self, field_name: typing.Literal["values", b"values"]) -> None: ... global___RepeatedBoolean = RepeatedBoolean -@typing_extensions.final +@typing.final class ArgFunction(google.protobuf.message.Message): """A function of arguments. This is an s-expression tree representing mathematically the function being evaluated. @@ -858,17 +874,18 @@ class ArgFunction(google.protobuf.message.Message): @property def args(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Arg]: """The arguments to the function.""" + def __init__( self, *, type: builtins.str = ..., args: collections.abc.Iterable[global___Arg] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["args", b"args", "type", b"type"]) -> None: ... + def ClearField(self, field_name: typing.Literal["args", b"args", "type", b"type"]) -> None: ... global___ArgFunction = ArgFunction -@typing_extensions.final +@typing.final class CircuitOperation(google.protobuf.message.Message): """An operation that applies a modified version of a reference circuit. The circuit is stored in the top-level Constants table; the mappings in this @@ -892,23 +909,27 @@ class CircuitOperation(google.protobuf.message.Message): """Specifier for repetitions of the circuit, which contains either a number of repetitions or a list of repetition IDs. """ + @property def qubit_map(self) -> global___QubitMapping: """Map from qubits in the "inner" circuit (referenced by circuit_constant_index) to qubits in the "outer" circuit (the one that contains this operation). """ + @property def measurement_key_map(self) -> global___MeasurementKeyMapping: """Map of measurement keys in the "inner" circuit (referenced by circuit_constant_index) to measurement keys in the "outer" circuit (the one that contains this operation). """ + @property def arg_map(self) -> global___ArgMapping: """Map of args in the "inner" circuit (referenced by circuit_constant_index) to args in the "outer" circuit (the one that contains this operation). """ + def __init__( self, *, @@ -918,12 +939,12 @@ class CircuitOperation(google.protobuf.message.Message): measurement_key_map: global___MeasurementKeyMapping | None = ..., arg_map: global___ArgMapping | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["arg_map", b"arg_map", "measurement_key_map", b"measurement_key_map", "qubit_map", b"qubit_map", "repetition_specification", b"repetition_specification"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["arg_map", b"arg_map", "circuit_constant_index", b"circuit_constant_index", "measurement_key_map", b"measurement_key_map", "qubit_map", b"qubit_map", "repetition_specification", b"repetition_specification"]) -> None: ... + def HasField(self, field_name: typing.Literal["arg_map", b"arg_map", "measurement_key_map", b"measurement_key_map", "qubit_map", b"qubit_map", "repetition_specification", b"repetition_specification"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["arg_map", b"arg_map", "circuit_constant_index", b"circuit_constant_index", "measurement_key_map", b"measurement_key_map", "qubit_map", b"qubit_map", "repetition_specification", b"repetition_specification"]) -> None: ... global___CircuitOperation = CircuitOperation -@typing_extensions.final +@typing.final class RepetitionSpecification(google.protobuf.message.Message): """A description of the repetitions of a subcircuit. IDs are used as suffixes for measurements in the repeated subcircuit; if repetition_count is given @@ -932,7 +953,7 @@ class RepetitionSpecification(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor - @typing_extensions.final + @typing.final class RepetitionIds(google.protobuf.message.Message): """An ordered list of IDs for a sequence of repetitions.""" @@ -946,28 +967,29 @@ class RepetitionSpecification(google.protobuf.message.Message): *, ids: collections.abc.Iterable[builtins.str] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["ids", b"ids"]) -> None: ... + def ClearField(self, field_name: typing.Literal["ids", b"ids"]) -> None: ... REPETITION_IDS_FIELD_NUMBER: builtins.int REPETITION_COUNT_FIELD_NUMBER: builtins.int + repetition_count: builtins.int + """An integer number of repetitions to perform.""" @property def repetition_ids(self) -> global___RepetitionSpecification.RepetitionIds: """A list of unique IDs, one per repetition of the subcircuit.""" - repetition_count: builtins.int - """An integer number of repetitions to perform.""" + def __init__( self, *, repetition_ids: global___RepetitionSpecification.RepetitionIds | None = ..., repetition_count: builtins.int = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["repetition_count", b"repetition_count", "repetition_ids", b"repetition_ids", "repetition_value", b"repetition_value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["repetition_count", b"repetition_count", "repetition_ids", b"repetition_ids", "repetition_value", b"repetition_value"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["repetition_value", b"repetition_value"]) -> typing_extensions.Literal["repetition_ids", "repetition_count"] | None: ... + def HasField(self, field_name: typing.Literal["repetition_count", b"repetition_count", "repetition_ids", b"repetition_ids", "repetition_value", b"repetition_value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["repetition_count", b"repetition_count", "repetition_ids", b"repetition_ids", "repetition_value", b"repetition_value"]) -> None: ... + def WhichOneof(self, oneof_group: typing.Literal["repetition_value", b"repetition_value"]) -> typing.Literal["repetition_ids", "repetition_count"] | None: ... global___RepetitionSpecification = RepetitionSpecification -@typing_extensions.final +@typing.final class QubitMapping(google.protobuf.message.Message): """A mapping of qubits from one value to another. All mappings are applied simultaneously and independently; for example, [(a, b), (b, a)] will swap @@ -976,7 +998,7 @@ class QubitMapping(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor - @typing_extensions.final + @typing.final class QubitEntry(google.protobuf.message.Message): """Indicates that qubit "key" should be replaced with "value".""" @@ -994,23 +1016,24 @@ class QubitMapping(google.protobuf.message.Message): key: global___Qubit | None = ..., value: global___Qubit | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> None: ... + def HasField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> None: ... ENTRIES_FIELD_NUMBER: builtins.int @property def entries(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___QubitMapping.QubitEntry]: """A list of qubit mappings to apply.""" + def __init__( self, *, entries: collections.abc.Iterable[global___QubitMapping.QubitEntry] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["entries", b"entries"]) -> None: ... + def ClearField(self, field_name: typing.Literal["entries", b"entries"]) -> None: ... global___QubitMapping = QubitMapping -@typing_extensions.final +@typing.final class MeasurementKey(google.protobuf.message.Message): """A key for matching a measurement event to its results.""" @@ -1023,11 +1046,11 @@ class MeasurementKey(google.protobuf.message.Message): *, string_key: builtins.str = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["string_key", b"string_key"]) -> None: ... + def ClearField(self, field_name: typing.Literal["string_key", b"string_key"]) -> None: ... global___MeasurementKey = MeasurementKey -@typing_extensions.final +@typing.final class MeasurementKeyMapping(google.protobuf.message.Message): """A mapping of measurement keys from one value to another. All mappings are applied simultaneously and independently; for example, [(a, b), (b, a)] will @@ -1036,7 +1059,7 @@ class MeasurementKeyMapping(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor - @typing_extensions.final + @typing.final class MeasurementKeyEntry(google.protobuf.message.Message): """Indicates that measurement key "key" should be replaced with "value".""" @@ -1054,23 +1077,24 @@ class MeasurementKeyMapping(google.protobuf.message.Message): key: global___MeasurementKey | None = ..., value: global___MeasurementKey | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> None: ... + def HasField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> None: ... ENTRIES_FIELD_NUMBER: builtins.int @property def entries(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___MeasurementKeyMapping.MeasurementKeyEntry]: """A list of measurement key mappings to apply.""" + def __init__( self, *, entries: collections.abc.Iterable[global___MeasurementKeyMapping.MeasurementKeyEntry] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["entries", b"entries"]) -> None: ... + def ClearField(self, field_name: typing.Literal["entries", b"entries"]) -> None: ... global___MeasurementKeyMapping = MeasurementKeyMapping -@typing_extensions.final +@typing.final class ArgMapping(google.protobuf.message.Message): """A mapping of args from one value to another. All mappings are applied simultaneously and independently; for example, [(a, b), (b, a)] will swap @@ -1079,7 +1103,7 @@ class ArgMapping(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor - @typing_extensions.final + @typing.final class ArgEntry(google.protobuf.message.Message): """Indicates that arg "key" should be replaced with "value".""" @@ -1097,27 +1121,28 @@ class ArgMapping(google.protobuf.message.Message): key: global___Arg | None = ..., value: global___Arg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> None: ... + def HasField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> None: ... ENTRIES_FIELD_NUMBER: builtins.int @property def entries(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ArgMapping.ArgEntry]: """A list of arg mappings to apply.""" + def __init__( self, *, entries: collections.abc.Iterable[global___ArgMapping.ArgEntry] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["entries", b"entries"]) -> None: ... + def ClearField(self, field_name: typing.Literal["entries", b"entries"]) -> None: ... global___ArgMapping = ArgMapping -@typing_extensions.final +@typing.final class InternalGate(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor - @typing_extensions.final + @typing.final class GateArgsEntry(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1132,8 +1157,8 @@ class InternalGate(google.protobuf.message.Message): key: builtins.str = ..., value: global___Arg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["value", b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> None: ... + def HasField(self, field_name: typing.Literal["value", b"value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> None: ... NAME_FIELD_NUMBER: builtins.int MODULE_FIELD_NUMBER: builtins.int @@ -1148,6 +1173,7 @@ class InternalGate(google.protobuf.message.Message): @property def gate_args(self) -> google.protobuf.internal.containers.MessageMap[builtins.str, global___Arg]: """Gate args.""" + def __init__( self, *, @@ -1156,11 +1182,11 @@ class InternalGate(google.protobuf.message.Message): num_qubits: builtins.int = ..., gate_args: collections.abc.Mapping[builtins.str, global___Arg] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["gate_args", b"gate_args", "module", b"module", "name", b"name", "num_qubits", b"num_qubits"]) -> None: ... + def ClearField(self, field_name: typing.Literal["gate_args", b"gate_args", "module", b"module", "name", b"name", "num_qubits", b"num_qubits"]) -> None: ... global___InternalGate = InternalGate -@typing_extensions.final +@typing.final class CouplerPulseGate(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1173,12 +1199,15 @@ class CouplerPulseGate(google.protobuf.message.Message): @property def hold_time_ps(self) -> global___FloatArg: """ps=picoseconds.""" + @property def rise_time_ps(self) -> global___FloatArg: """ps=picoseconds.""" + @property def padding_time_ps(self) -> global___FloatArg: """ps=picoseconds.""" + @property def coupling_mhz(self) -> global___FloatArg: ... @property @@ -1195,24 +1224,24 @@ class CouplerPulseGate(google.protobuf.message.Message): q0_detune_mhz: global___FloatArg | None = ..., q1_detune_mhz: global___FloatArg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["_coupling_mhz", b"_coupling_mhz", "_hold_time_ps", b"_hold_time_ps", "_padding_time_ps", b"_padding_time_ps", "_q0_detune_mhz", b"_q0_detune_mhz", "_q1_detune_mhz", b"_q1_detune_mhz", "_rise_time_ps", b"_rise_time_ps", "coupling_mhz", b"coupling_mhz", "hold_time_ps", b"hold_time_ps", "padding_time_ps", b"padding_time_ps", "q0_detune_mhz", b"q0_detune_mhz", "q1_detune_mhz", b"q1_detune_mhz", "rise_time_ps", b"rise_time_ps"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["_coupling_mhz", b"_coupling_mhz", "_hold_time_ps", b"_hold_time_ps", "_padding_time_ps", b"_padding_time_ps", "_q0_detune_mhz", b"_q0_detune_mhz", "_q1_detune_mhz", b"_q1_detune_mhz", "_rise_time_ps", b"_rise_time_ps", "coupling_mhz", b"coupling_mhz", "hold_time_ps", b"hold_time_ps", "padding_time_ps", b"padding_time_ps", "q0_detune_mhz", b"q0_detune_mhz", "q1_detune_mhz", b"q1_detune_mhz", "rise_time_ps", b"rise_time_ps"]) -> None: ... + def HasField(self, field_name: typing.Literal["_coupling_mhz", b"_coupling_mhz", "_hold_time_ps", b"_hold_time_ps", "_padding_time_ps", b"_padding_time_ps", "_q0_detune_mhz", b"_q0_detune_mhz", "_q1_detune_mhz", b"_q1_detune_mhz", "_rise_time_ps", b"_rise_time_ps", "coupling_mhz", b"coupling_mhz", "hold_time_ps", b"hold_time_ps", "padding_time_ps", b"padding_time_ps", "q0_detune_mhz", b"q0_detune_mhz", "q1_detune_mhz", b"q1_detune_mhz", "rise_time_ps", b"rise_time_ps"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["_coupling_mhz", b"_coupling_mhz", "_hold_time_ps", b"_hold_time_ps", "_padding_time_ps", b"_padding_time_ps", "_q0_detune_mhz", b"_q0_detune_mhz", "_q1_detune_mhz", b"_q1_detune_mhz", "_rise_time_ps", b"_rise_time_ps", "coupling_mhz", b"coupling_mhz", "hold_time_ps", b"hold_time_ps", "padding_time_ps", b"padding_time_ps", "q0_detune_mhz", b"q0_detune_mhz", "q1_detune_mhz", b"q1_detune_mhz", "rise_time_ps", b"rise_time_ps"]) -> None: ... @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_coupling_mhz", b"_coupling_mhz"]) -> typing_extensions.Literal["coupling_mhz"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["_coupling_mhz", b"_coupling_mhz"]) -> typing.Literal["coupling_mhz"] | None: ... @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_hold_time_ps", b"_hold_time_ps"]) -> typing_extensions.Literal["hold_time_ps"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["_hold_time_ps", b"_hold_time_ps"]) -> typing.Literal["hold_time_ps"] | None: ... @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_padding_time_ps", b"_padding_time_ps"]) -> typing_extensions.Literal["padding_time_ps"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["_padding_time_ps", b"_padding_time_ps"]) -> typing.Literal["padding_time_ps"] | None: ... @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_q0_detune_mhz", b"_q0_detune_mhz"]) -> typing_extensions.Literal["q0_detune_mhz"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["_q0_detune_mhz", b"_q0_detune_mhz"]) -> typing.Literal["q0_detune_mhz"] | None: ... @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_q1_detune_mhz", b"_q1_detune_mhz"]) -> typing_extensions.Literal["q1_detune_mhz"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["_q1_detune_mhz", b"_q1_detune_mhz"]) -> typing.Literal["q1_detune_mhz"] | None: ... @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_rise_time_ps", b"_rise_time_ps"]) -> typing_extensions.Literal["rise_time_ps"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["_rise_time_ps", b"_rise_time_ps"]) -> typing.Literal["rise_time_ps"] | None: ... global___CouplerPulseGate = CouplerPulseGate -@typing_extensions.final +@typing.final class CliffordTableau(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1228,12 +1257,15 @@ class CliffordTableau(google.protobuf.message.Message): @property def rs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bool]: """A flattened version of the `rs` array.""" + @property def xs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bool]: """A flattened version of the `xs` array.""" + @property def zs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bool]: """A flattened version of the `zs` array.""" + def __init__( self, *, @@ -1243,16 +1275,16 @@ class CliffordTableau(google.protobuf.message.Message): xs: collections.abc.Iterable[builtins.bool] | None = ..., zs: collections.abc.Iterable[builtins.bool] | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["_initial_state", b"_initial_state", "_num_qubits", b"_num_qubits", "initial_state", b"initial_state", "num_qubits", b"num_qubits"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["_initial_state", b"_initial_state", "_num_qubits", b"_num_qubits", "initial_state", b"initial_state", "num_qubits", b"num_qubits", "rs", b"rs", "xs", b"xs", "zs", b"zs"]) -> None: ... + def HasField(self, field_name: typing.Literal["_initial_state", b"_initial_state", "_num_qubits", b"_num_qubits", "initial_state", b"initial_state", "num_qubits", b"num_qubits"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["_initial_state", b"_initial_state", "_num_qubits", b"_num_qubits", "initial_state", b"initial_state", "num_qubits", b"num_qubits", "rs", b"rs", "xs", b"xs", "zs", b"zs"]) -> None: ... @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_initial_state", b"_initial_state"]) -> typing_extensions.Literal["initial_state"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["_initial_state", b"_initial_state"]) -> typing.Literal["initial_state"] | None: ... @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_num_qubits", b"_num_qubits"]) -> typing_extensions.Literal["num_qubits"] | None: ... + def WhichOneof(self, oneof_group: typing.Literal["_num_qubits", b"_num_qubits"]) -> typing.Literal["num_qubits"] | None: ... global___CliffordTableau = CliffordTableau -@typing_extensions.final +@typing.final class SingleQubitCliffordGate(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1264,12 +1296,12 @@ class SingleQubitCliffordGate(google.protobuf.message.Message): *, tableau: global___CliffordTableau | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["tableau", b"tableau"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["tableau", b"tableau"]) -> None: ... + def HasField(self, field_name: typing.Literal["tableau", b"tableau"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["tableau", b"tableau"]) -> None: ... global___SingleQubitCliffordGate = SingleQubitCliffordGate -@typing_extensions.final +@typing.final class IdentityGate(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1281,11 +1313,11 @@ class IdentityGate(google.protobuf.message.Message): *, qid_shape: collections.abc.Iterable[builtins.int] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["qid_shape", b"qid_shape"]) -> None: ... + def ClearField(self, field_name: typing.Literal["qid_shape", b"qid_shape"]) -> None: ... global___IdentityGate = IdentityGate -@typing_extensions.final +@typing.final class HPowGate(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1297,7 +1329,7 @@ class HPowGate(google.protobuf.message.Message): *, exponent: global___FloatArg | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["exponent", b"exponent"]) -> None: ... + def HasField(self, field_name: typing.Literal["exponent", b"exponent"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["exponent", b"exponent"]) -> None: ... global___HPowGate = HPowGate diff --git a/cirq-google/cirq_google/api/v2/result_pb2.pyi b/cirq-google/cirq_google/api/v2/result_pb2.pyi index 9eb49a4c380..9fa28c05bb5 100644 --- a/cirq-google/cirq_google/api/v2/result_pb2.pyi +++ b/cirq-google/cirq_google/api/v2/result_pb2.pyi @@ -2,22 +2,18 @@ @generated by mypy-protobuf. Do not edit manually! isort:skip_file """ + import builtins import cirq_google.api.v2.program_pb2 import collections.abc import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.message -import sys - -if sys.version_info >= (3, 8): - import typing as typing_extensions -else: - import typing_extensions +import typing DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -@typing_extensions.final +@typing.final class Result(google.protobuf.message.Message): """The overall results of running a Program.""" @@ -30,16 +26,17 @@ class Result(google.protobuf.message.Message): as the parameter_sweeps repeated field in the RunContext that generated these results. """ + def __init__( self, *, sweep_results: collections.abc.Iterable[global___SweepResult] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["sweep_results", b"sweep_results"]) -> None: ... + def ClearField(self, field_name: typing.Literal["sweep_results", b"sweep_results"]) -> None: ... global___Result = Result -@typing_extensions.final +@typing.final class SweepResult(google.protobuf.message.Message): """The measurement results for a particular ParameterSweep.""" @@ -58,17 +55,18 @@ class SweepResult(google.protobuf.message.Message): These represent the expanded parameters defined int he ParameterSweep which this SweepResult corresponds to. """ + def __init__( self, *, repetitions: builtins.int = ..., parameterized_results: collections.abc.Iterable[global___ParameterizedResult] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["parameterized_results", b"parameterized_results", "repetitions", b"repetitions"]) -> None: ... + def ClearField(self, field_name: typing.Literal["parameterized_results", b"parameterized_results", "repetitions", b"repetitions"]) -> None: ... global___SweepResult = SweepResult -@typing_extensions.final +@typing.final class ParameterizedResult(google.protobuf.message.Message): """The parameters used to generate result along with the results for this set of parameters. @@ -81,24 +79,26 @@ class ParameterizedResult(google.protobuf.message.Message): @property def params(self) -> global___ParameterDict: """The parameter dict that was used when generating these results.""" + @property def measurement_results(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___MeasurementResult]: """The results of the measurement. There is one of these results per measurement key in the program. Measurement keys in the program are unique. """ + def __init__( self, *, params: global___ParameterDict | None = ..., measurement_results: collections.abc.Iterable[global___MeasurementResult] | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["params", b"params"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["measurement_results", b"measurement_results", "params", b"params"]) -> None: ... + def HasField(self, field_name: typing.Literal["params", b"params"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["measurement_results", b"measurement_results", "params", b"params"]) -> None: ... global___ParameterizedResult = ParameterizedResult -@typing_extensions.final +@typing.final class MeasurementResult(google.protobuf.message.Message): """The results of a measurement for a specific measurement key.""" @@ -114,6 +114,7 @@ class MeasurementResult(google.protobuf.message.Message): @property def qubit_measurement_results(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___QubitMeasurementResult]: """For each qubit that is measured, these are the measurement results.""" + def __init__( self, *, @@ -121,11 +122,11 @@ class MeasurementResult(google.protobuf.message.Message): instances: builtins.int = ..., qubit_measurement_results: collections.abc.Iterable[global___QubitMeasurementResult] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["instances", b"instances", "key", b"key", "qubit_measurement_results", b"qubit_measurement_results"]) -> None: ... + def ClearField(self, field_name: typing.Literal["instances", b"instances", "key", b"key", "qubit_measurement_results", b"qubit_measurement_results"]) -> None: ... global___MeasurementResult = MeasurementResult -@typing_extensions.final +@typing.final class QubitMeasurementResult(google.protobuf.message.Message): """The result of a measurement on a single qubit.""" @@ -133,9 +134,6 @@ class QubitMeasurementResult(google.protobuf.message.Message): QUBIT_FIELD_NUMBER: builtins.int RESULTS_FIELD_NUMBER: builtins.int - @property - def qubit(self) -> cirq_google.api.v2.program_pb2.Qubit: - """Which qubit was measured.""" results: builtins.bytes """These are the results of a measurement on a qubit. The number of bits measured is equal to repetitions * instances, where repetitions is defined @@ -158,24 +156,28 @@ class QubitMeasurementResult(google.protobuf.message.Message): but not all 8 bits may be used. This list of bytes then constitutes the bytes in this field. """ + @property + def qubit(self) -> cirq_google.api.v2.program_pb2.Qubit: + """Which qubit was measured.""" + def __init__( self, *, qubit: cirq_google.api.v2.program_pb2.Qubit | None = ..., results: builtins.bytes = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["qubit", b"qubit"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["qubit", b"qubit", "results", b"results"]) -> None: ... + def HasField(self, field_name: typing.Literal["qubit", b"qubit"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["qubit", b"qubit", "results", b"results"]) -> None: ... global___QubitMeasurementResult = QubitMeasurementResult -@typing_extensions.final +@typing.final class ParameterDict(google.protobuf.message.Message): """A point sampled during a parameter sweep.""" DESCRIPTOR: google.protobuf.descriptor.Descriptor - @typing_extensions.final + @typing.final class AssignmentsEntry(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -189,17 +191,18 @@ class ParameterDict(google.protobuf.message.Message): key: builtins.str = ..., value: builtins.float = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "value", b"value"]) -> None: ... + def ClearField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> None: ... ASSIGNMENTS_FIELD_NUMBER: builtins.int @property def assignments(self) -> google.protobuf.internal.containers.ScalarMap[builtins.str, builtins.float]: """Maps parameter names to values.""" + def __init__( self, *, assignments: collections.abc.Mapping[builtins.str, builtins.float] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["assignments", b"assignments"]) -> None: ... + def ClearField(self, field_name: typing.Literal["assignments", b"assignments"]) -> None: ... global___ParameterDict = ParameterDict From 1b69f034da9731d432b3f2a43026c8ab8348ac93 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 Sep 2024 22:21:41 -0700 Subject: [PATCH 06/10] Remove source proto to check if CI detects that --- cirq-google/cirq_google/api/v2/device.proto | 189 -------------------- 1 file changed, 189 deletions(-) delete mode 100644 cirq-google/cirq_google/api/v2/device.proto diff --git a/cirq-google/cirq_google/api/v2/device.proto b/cirq-google/cirq_google/api/v2/device.proto deleted file mode 100644 index da0d6a6c426..00000000000 --- a/cirq-google/cirq_google/api/v2/device.proto +++ /dev/null @@ -1,189 +0,0 @@ -syntax = "proto3"; - -package cirq.google.api.v2; - -option java_package = "com.google.cirq.google.api.v2"; -option java_outer_classname = "DeviceProto"; -option java_multiple_files = true; - -// This contains information about a device that includes the -// qubits on the device, supported gates, connections, and timing. -// This message specifies information that is needed when sending a -// Program message to the device. -message DeviceSpecification { - // A list of allowed gatesets for programs submitted to this processor - // Language.gate_set should be one of these values to be valid. - repeated GateSet valid_gate_sets = 1 [deprecated = true]; - - // The device gateset. - // Contains the list of gates allowed in programs submitted to this processor. - repeated GateSpecification valid_gates = 5; - - // A list of allowed ids for qubits within the Program. - // Any programs with ids not in this list will be rejected. - // If empty, all qubit values are allowed (e.g. in a simulator) - // Only grid qubits are supported. Strings must be in the form '_'. - // Single-qubit gates can be applied to all qubits. - // Measurement and wait gates can be applied to all subset of qubits. - repeated string valid_qubits = 2; - - // A list of targets that gates can use. - repeated TargetSet valid_targets = 3; - - // Additional recommendations, caveats, and soft requirements that - // are advice to users of the device, specified in English text - // For instance, "All Z gates are converted to VirtualZ gates". - string developer_recommendations = 4; -} - -// This contains information about a single device gate. -// Replaces `GateDefinition`. -message GateSpecification { - // This defines the approximate duration to run the gate on the device, - // specified as an integer number of picoseconds. - int64 gate_duration_picos = 1; - - // This specifies the gate type and gate parameter constraints for this - // device gate. - oneof gate { - Sycamore syc = 2; - SqrtISwap sqrt_iswap = 3; - SqrtISwapInv sqrt_iswap_inv = 4; - CZ cz = 5; - PhasedXZ phased_xz = 6; - VirtualZPow virtual_zpow = 7; - PhysicalZPow physical_zpow = 8; - CouplerPulse coupler_pulse = 9; - Measurement meas = 10; - Wait wait = 11; - FSimViaModel fsim_via_model = 12; - CZPowGate cz_pow_gate = 13; - InternalGate internal_gate = 14; - } - - // Gate types available to Google devices. - // Future gates may have parameter constraints that are frequently updated. - // In such cases, the gate message will contain additional fields to specify - // those constraints. - message Sycamore {} - message SqrtISwap {} - message SqrtISwapInv {} - message CZ {} - message PhasedXZ {} - message VirtualZPow {} - message PhysicalZPow {} - message CouplerPulse {} - message Measurement {} - message Wait {} - message FSimViaModel {} - message CZPowGate {} - // This gate gets mapped to the internal representation corresponding - // to . - message InternalGate {} -} - -message GateSet { - // The name of the gate set corresponding to Language.gate_set - string name = 1; - - // A list of valid gates permitted by this gate set - repeated GateDefinition valid_gates = 2; -} - -message GateDefinition { - // The name for the gate. This must match the Gate.id in your program. - string id = 1; - - // If unset or set to zero, any number of qubits is allowed. - int32 number_of_qubits = 2; - - // The name of the arguments that should be specified for - // an operation of this gate - repeated ArgDefinition valid_args = 3; - - // This defines the approximate amount of time for each gate, - // specified as an integer number of picoseconds. - int64 gate_duration_picos = 4; - - // Valid targets that this gate can use. - // Values in this list correspond to the name of the TargetSet - // If unset, all combinations with number_of_qubits target are allowed. - repeated string valid_targets = 5; -} - -// A description of an argument to an operation. -message ArgDefinition { - // Note: This should be kept in sync with the ArgValue proto - enum ArgType { - UNSPECIFIED = 0; - FLOAT = 1; - REPEATED_BOOLEAN = 2; - STRING = 3; - } - - // The name of the argument - // This corresponds to the valid key values for the - // map value of Operation.args - string name = 1; - - // The type of the argument. - // This should correspond to the legal assignment - // of the Arg.arg oneof for this argument - ArgType type = 2; - - // This should only be populated for type FLOAT. - // If not set, all float values are allowed. - repeated ArgumentRange allowed_ranges = 3; -} - -// Minimum value is inclusive and maximum value is exclusive. -// If minimum and maximum values are the same, only a single value is allowed. -message ArgumentRange { - float minimum_value = 1; - float maximum_value = 2; -} - -// A list of targets that are valid for a set of gates. -// For instance, all qubit pairs that can be acted on by a 2-qubit gate -message TargetSet { - enum TargetOrdering { - UNSPECIFIED = 0; - - // Symmetric gates, any id order within each target is valid. - // Two-qubit gates can be applied to all two-element targets in a TargetSet - // of this type. - SYMMETRIC = 1; - - // Asymmetric gates, the order of ids in each target is important. - // Only the order specified in each target is valid. - // Deprecated: Unused - ASYMMETRIC = 2 [deprecated = true]; - - // All targets in this TargetSet should contain only a single qubit id. - // Gates using this TargetSet can be applied to any subset of these targets - // in any order. - // For example, this could be the case for measurement gates that can - // measure any subset of qubits at once. - // Deprecated: Measurement gate can be applied to all subset of qubits. - SUBSET_PERMUTATION = 3 [deprecated = true]; - } - - // The name of the target list. - // This will be referenced in the GateDefinition to denote - // which targets are valid. - string name = 1; - - // The type of ordering of the ids within each target in this set. - // For instance, if the ids within each target are symmetric. - TargetOrdering target_ordering = 2; - - // A list of targets that are valid - repeated Target targets = 3; -} - -// A description of a valid target of a multi-qubit gate operation -// For most Google devices, this will be a pair of qubit ids. -message Target { - // A list of qubit ids that form a valid gate target. - repeated string ids = 1; -} From 097c679eb3bccbc30226750aa77caacb2c1618bd Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 Sep 2024 22:24:38 -0700 Subject: [PATCH 07/10] Revert "Remove source proto to check if CI detects that" This reverts commit 1b69f034da9731d432b3f2a43026c8ab8348ac93. --- cirq-google/cirq_google/api/v2/device.proto | 189 ++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 cirq-google/cirq_google/api/v2/device.proto diff --git a/cirq-google/cirq_google/api/v2/device.proto b/cirq-google/cirq_google/api/v2/device.proto new file mode 100644 index 00000000000..da0d6a6c426 --- /dev/null +++ b/cirq-google/cirq_google/api/v2/device.proto @@ -0,0 +1,189 @@ +syntax = "proto3"; + +package cirq.google.api.v2; + +option java_package = "com.google.cirq.google.api.v2"; +option java_outer_classname = "DeviceProto"; +option java_multiple_files = true; + +// This contains information about a device that includes the +// qubits on the device, supported gates, connections, and timing. +// This message specifies information that is needed when sending a +// Program message to the device. +message DeviceSpecification { + // A list of allowed gatesets for programs submitted to this processor + // Language.gate_set should be one of these values to be valid. + repeated GateSet valid_gate_sets = 1 [deprecated = true]; + + // The device gateset. + // Contains the list of gates allowed in programs submitted to this processor. + repeated GateSpecification valid_gates = 5; + + // A list of allowed ids for qubits within the Program. + // Any programs with ids not in this list will be rejected. + // If empty, all qubit values are allowed (e.g. in a simulator) + // Only grid qubits are supported. Strings must be in the form '_'. + // Single-qubit gates can be applied to all qubits. + // Measurement and wait gates can be applied to all subset of qubits. + repeated string valid_qubits = 2; + + // A list of targets that gates can use. + repeated TargetSet valid_targets = 3; + + // Additional recommendations, caveats, and soft requirements that + // are advice to users of the device, specified in English text + // For instance, "All Z gates are converted to VirtualZ gates". + string developer_recommendations = 4; +} + +// This contains information about a single device gate. +// Replaces `GateDefinition`. +message GateSpecification { + // This defines the approximate duration to run the gate on the device, + // specified as an integer number of picoseconds. + int64 gate_duration_picos = 1; + + // This specifies the gate type and gate parameter constraints for this + // device gate. + oneof gate { + Sycamore syc = 2; + SqrtISwap sqrt_iswap = 3; + SqrtISwapInv sqrt_iswap_inv = 4; + CZ cz = 5; + PhasedXZ phased_xz = 6; + VirtualZPow virtual_zpow = 7; + PhysicalZPow physical_zpow = 8; + CouplerPulse coupler_pulse = 9; + Measurement meas = 10; + Wait wait = 11; + FSimViaModel fsim_via_model = 12; + CZPowGate cz_pow_gate = 13; + InternalGate internal_gate = 14; + } + + // Gate types available to Google devices. + // Future gates may have parameter constraints that are frequently updated. + // In such cases, the gate message will contain additional fields to specify + // those constraints. + message Sycamore {} + message SqrtISwap {} + message SqrtISwapInv {} + message CZ {} + message PhasedXZ {} + message VirtualZPow {} + message PhysicalZPow {} + message CouplerPulse {} + message Measurement {} + message Wait {} + message FSimViaModel {} + message CZPowGate {} + // This gate gets mapped to the internal representation corresponding + // to . + message InternalGate {} +} + +message GateSet { + // The name of the gate set corresponding to Language.gate_set + string name = 1; + + // A list of valid gates permitted by this gate set + repeated GateDefinition valid_gates = 2; +} + +message GateDefinition { + // The name for the gate. This must match the Gate.id in your program. + string id = 1; + + // If unset or set to zero, any number of qubits is allowed. + int32 number_of_qubits = 2; + + // The name of the arguments that should be specified for + // an operation of this gate + repeated ArgDefinition valid_args = 3; + + // This defines the approximate amount of time for each gate, + // specified as an integer number of picoseconds. + int64 gate_duration_picos = 4; + + // Valid targets that this gate can use. + // Values in this list correspond to the name of the TargetSet + // If unset, all combinations with number_of_qubits target are allowed. + repeated string valid_targets = 5; +} + +// A description of an argument to an operation. +message ArgDefinition { + // Note: This should be kept in sync with the ArgValue proto + enum ArgType { + UNSPECIFIED = 0; + FLOAT = 1; + REPEATED_BOOLEAN = 2; + STRING = 3; + } + + // The name of the argument + // This corresponds to the valid key values for the + // map value of Operation.args + string name = 1; + + // The type of the argument. + // This should correspond to the legal assignment + // of the Arg.arg oneof for this argument + ArgType type = 2; + + // This should only be populated for type FLOAT. + // If not set, all float values are allowed. + repeated ArgumentRange allowed_ranges = 3; +} + +// Minimum value is inclusive and maximum value is exclusive. +// If minimum and maximum values are the same, only a single value is allowed. +message ArgumentRange { + float minimum_value = 1; + float maximum_value = 2; +} + +// A list of targets that are valid for a set of gates. +// For instance, all qubit pairs that can be acted on by a 2-qubit gate +message TargetSet { + enum TargetOrdering { + UNSPECIFIED = 0; + + // Symmetric gates, any id order within each target is valid. + // Two-qubit gates can be applied to all two-element targets in a TargetSet + // of this type. + SYMMETRIC = 1; + + // Asymmetric gates, the order of ids in each target is important. + // Only the order specified in each target is valid. + // Deprecated: Unused + ASYMMETRIC = 2 [deprecated = true]; + + // All targets in this TargetSet should contain only a single qubit id. + // Gates using this TargetSet can be applied to any subset of these targets + // in any order. + // For example, this could be the case for measurement gates that can + // measure any subset of qubits at once. + // Deprecated: Measurement gate can be applied to all subset of qubits. + SUBSET_PERMUTATION = 3 [deprecated = true]; + } + + // The name of the target list. + // This will be referenced in the GateDefinition to denote + // which targets are valid. + string name = 1; + + // The type of ordering of the ids within each target in this set. + // For instance, if the ids within each target are symmetric. + TargetOrdering target_ordering = 2; + + // A list of targets that are valid + repeated Target targets = 3; +} + +// A description of a valid target of a multi-qubit gate operation +// For most Google devices, this will be a pair of qubit ids. +message Target { + // A list of qubit ids that form a valid gate target. + repeated string ids = 1; +} From a30d2ef5cb95cbf132455c8443226af4b94cbee9 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 Sep 2024 22:26:51 -0700 Subject: [PATCH 08/10] Add source proto without generated files to check the CI check --- cirq-google/cirq_google/api/v2/batch.proto | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 cirq-google/cirq_google/api/v2/batch.proto diff --git a/cirq-google/cirq_google/api/v2/batch.proto b/cirq-google/cirq_google/api/v2/batch.proto new file mode 100644 index 00000000000..2645d91a6d8 --- /dev/null +++ b/cirq-google/cirq_google/api/v2/batch.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; + +import "cirq_google/api/v2/program.proto"; +import "cirq_google/api/v2/result.proto"; +import "cirq_google/api/v2/run_context.proto"; + +package cirq.google.api.v2; + +option java_package = "com.google.cirq.google.api.v2"; +option java_outer_classname = "BatchProto"; +option java_multiple_files = true; + +// A Batch of multiple circuits that should be run together +// as one QuantumProgram within Quantum Engine. +// +// Note: Batching is done on a best-effort basis. +// Circuits will be be bundled together, but the size +// of the total batch and different hardware constraints may +// cause the programs to be executed separately on the hardware. +message BatchProgram { + + // The circuits that should be bundled together as one program + repeated Program programs = 1; +} + +// A batch of contexts for running a bundled batch of programs +// To be used in conjunction with BatchProgram +message BatchRunContext { + + // Run contexts for each program in the BatchProgram + // Each RunContext should map directly to a Program in the corresponding + // BatchProgram. + // + // This message must have one RunContext for each Program in the + // BatchProgram, and the order of the RunContext messages should + // match the order of the Programs in the BatchProgram. + repeated RunContext run_contexts = 1; +} + + +// The result returned from running a BatchProgram/BatchRunContext +message BatchResult { + + // Results returned from executing a BatchProgram/BatchRunContext pair. + // + // After a BatchProgram and BatchRunContext is successfully run in + // Quantum Engine, the expected result if successful will be a BatchResult. + // + // Each Result in this message will directly correspond to a Program/ + // RunContext pair in the request. There will be one Result in this message + // for each corresponding pair in the request and the order of the Results + // will match the order of the Programs from the request. + // + // In case of partial results, an empty (default) Result object will be + // populated for programs that were not able to be run correctly. + repeated Result results = 1; +} + From e9b75932ff03ba30a3d956594992b90128f0a286 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 Sep 2024 22:34:13 -0700 Subject: [PATCH 09/10] Revert "Add source proto without generated files to check the CI check" This reverts commit a30d2ef5cb95cbf132455c8443226af4b94cbee9. --- cirq-google/cirq_google/api/v2/batch.proto | 58 ---------------------- 1 file changed, 58 deletions(-) delete mode 100644 cirq-google/cirq_google/api/v2/batch.proto diff --git a/cirq-google/cirq_google/api/v2/batch.proto b/cirq-google/cirq_google/api/v2/batch.proto deleted file mode 100644 index 2645d91a6d8..00000000000 --- a/cirq-google/cirq_google/api/v2/batch.proto +++ /dev/null @@ -1,58 +0,0 @@ -syntax = "proto3"; - -import "cirq_google/api/v2/program.proto"; -import "cirq_google/api/v2/result.proto"; -import "cirq_google/api/v2/run_context.proto"; - -package cirq.google.api.v2; - -option java_package = "com.google.cirq.google.api.v2"; -option java_outer_classname = "BatchProto"; -option java_multiple_files = true; - -// A Batch of multiple circuits that should be run together -// as one QuantumProgram within Quantum Engine. -// -// Note: Batching is done on a best-effort basis. -// Circuits will be be bundled together, but the size -// of the total batch and different hardware constraints may -// cause the programs to be executed separately on the hardware. -message BatchProgram { - - // The circuits that should be bundled together as one program - repeated Program programs = 1; -} - -// A batch of contexts for running a bundled batch of programs -// To be used in conjunction with BatchProgram -message BatchRunContext { - - // Run contexts for each program in the BatchProgram - // Each RunContext should map directly to a Program in the corresponding - // BatchProgram. - // - // This message must have one RunContext for each Program in the - // BatchProgram, and the order of the RunContext messages should - // match the order of the Programs in the BatchProgram. - repeated RunContext run_contexts = 1; -} - - -// The result returned from running a BatchProgram/BatchRunContext -message BatchResult { - - // Results returned from executing a BatchProgram/BatchRunContext pair. - // - // After a BatchProgram and BatchRunContext is successfully run in - // Quantum Engine, the expected result if successful will be a BatchResult. - // - // Each Result in this message will directly correspond to a Program/ - // RunContext pair in the request. There will be one Result in this message - // for each corresponding pair in the request and the order of the Results - // will match the order of the Programs from the request. - // - // In case of partial results, an empty (default) Result object will be - // populated for programs that were not able to be run correctly. - repeated Result results = 1; -} - From c3fd3dc82573b25c7baad5cb20d51a34ddd90e1c Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 Sep 2024 22:36:34 -0700 Subject: [PATCH 10/10] Yet another message tweak --- check/protos-up-to-date | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check/protos-up-to-date b/check/protos-up-to-date index 40fdca7af1b..5543533ed13 100755 --- a/check/protos-up-to-date +++ b/check/protos-up-to-date @@ -20,8 +20,8 @@ if [[ -n "${git_status}" ]]; then exit 2 fi -echo "Removing generated Python files. If not restored by this script, use" -echo 'git restore "*_pb2.py*" to get them back' +echo "Removing generated Python files. If not restored by this script use" +echo 'git restore "*_pb2.py*" to recover them back.' echo git rm --quiet "cirq-google/*_pb2.py*"