Skip to content

Apply suggestions from CommonTypos checker #6082

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cirq-aqt/cirq_aqt/aqt_device_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def twoq_gates_duration(self) -> 'cirq.DURATION_LIKE':
return self._twoq_gates_duration

def duration_of(self, operation: 'cirq.Operation') -> 'cirq.DURATION_LIKE':
"""Return the maximum duration of the specifed gate operation.
"""Return the maximum duration of the specified gate operation.

Args:
operation: The `cirq.Operation` for which to determine its duration.
Expand Down
6 changes: 3 additions & 3 deletions cirq-core/cirq/circuits/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ def concat_ragged(
are placed one after the other and then moved inward until just before
their operations would collide. If any of the circuits do not share
qubits and so would not collide, the starts or ends of the circuits will
be aligned, acording to the given align parameter.
be aligned, according to the given align parameter.

Beware that this method is *not* associative. For example:

Expand Down Expand Up @@ -2736,7 +2736,7 @@ def get_earliest_accommodating_moment_index(
ckey_indices: Dict['cirq.MeasurementKey', int],
length: Optional[int] = None,
) -> int:
"""Get the index of the earliest moment that can accomodate the given moment or operation.
"""Get the index of the earliest moment that can accommodate the given moment or operation.

Updates the dictionaries keeping track of the last moment index addressing a given qubit,
measurement key, and control key.
Expand All @@ -2751,7 +2751,7 @@ def get_earliest_accommodating_moment_index(
`mkey_indices`, and `ckey_indices`.

Returns:
The integer index of the earliest moment that can accomodate the given moment or operation.
The integer index of the earliest moment that can accommodate the given moment or operation.
"""
mop_qubits = moment_or_operation.qubits
mop_mkeys = protocols.measurement_key_objs(moment_or_operation)
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/contrib/acquaintance/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


class ExecutionStrategy(metaclass=abc.ABCMeta):
"""Tells `StrategyExecutorTransormer` how to execute an acquaintance strategy.
"""Tells `StrategyExecutorTransformer` how to execute an acquaintance strategy.

An execution strategy tells `StrategyExecutorTransformer` how to execute
an acquaintance strategy, i.e. what gates to implement at the available
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/ops/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(
"""Inits IdentityGate.

Args:
num_qubits: The number of qubits for the idenity gate.
num_qubits: The number of qubits for the identity gate.
qid_shape: Specifies the dimension of each qid the measurement
applies to. The default is 2 for every qubit.

Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/ops/linear_combinations.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def _value_equality_values_(self):
def wrap(val: PauliSumLike) -> 'PauliSum':
"""Convert a `cirq.PauliSumLike` object to a PauliSum

Attemps to convert an existing int, float, complex, `cirq.PauliString`,
Attempts to convert an existing int, float, complex, `cirq.PauliString`,
`cirq.PauliSum` or `cirq.SingleQubitPauliStringGateOperation` into
a `cirq.PauliSum` object. For example:

Expand Down
4 changes: 2 additions & 2 deletions cirq-core/cirq/ops/raw_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def __call__(self, *qubits: Qid, **kwargs):
return self.on(*qubits)

def with_probability(self, probability: 'cirq.TParamVal') -> 'cirq.Gate':
"""Creates a probabalistic channel with this gate.
"""Creates a probabilistic channel with this gate.

Args:
probability: floating point value between 0 and 1, giving the
Expand Down Expand Up @@ -601,7 +601,7 @@ def controlled_by(
return ops.controlled_operation.ControlledOperation(control_qubits, self, control_values)

def with_probability(self, probability: 'cirq.TParamVal') -> 'cirq.Operation':
"""Creates a probabalistic channel with this operation.
"""Creates a probabilistic channel with this operation.

Args:
probability: floating point value between 0 and 1, giving the
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/protocols/apply_channel_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def _apply_channel_(
`args.target_tensor` and the given buffers.

Returns:
If the receiving object is not able to apply a chanel, None
If the receiving object is not able to apply a channel, None
or NotImplemented should be returned.

If the receiving object is able to work inline, it should directly
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/protocols/circuit_diagram_info_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(
could be mistaken for an identity wire). Defaults to True.

Raises:
ValueError: If `wire_symbols` is a string, and not an interable
ValueError: If `wire_symbols` is a string, and not an iterable
of strings.
"""
if isinstance(wire_symbols, str):
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/sim/mux.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def final_state_vector(
Returns:
The state vector resulting from applying the given unitary operations to
the desired initial state. Specifically, a numpy array containing the
the amplitudes in np.kron order, where the order of arguments to kron
amplitudes in np.kron order, where the order of arguments to kron
is determined by the qubit order argument (which defaults to just
sorting the qubits that are present into an ascending order).

Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/sim/state_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, qubit_map: Optional[Mapping['cirq.Qid', int]] = None, *args,
"""Inits StateVectorMixin.

Args:
qubit_map: A map from the Qubits in the Circuit to the the index
qubit_map: A map from the Qubits in the Circuit to the index
of this qubit for a canonical ordering. This canonical ordering
is used to define the state (see the state_vector() method).
*args: Passed on to the class that this is mixed in with.
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/study/flatten_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def flatten(val: Any) -> Tuple[Any, 'ExpressionMap']:
the name to avoid collision: `sympy.Symbol('<x + 1>_1')`.

This function also creates a dictionary mapping from expressions and symbols
in `val` to the new symbols in the flattened copy of `val`. E.g
in `val` to the new symbols in the flattened copy of `val`. E.g.
`cirq.ExpressionMap({sympy.Symbol('x')+1: sympy.Symbol('<x + 1>')})`. This
`ExpressionMap` can be used to transform a sweep over the symbols in `val`
to a sweep over the flattened symbols e.g. a sweep over `sympy.Symbol('x')`
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/study/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def dataframe_from_measurements(measurements: Mapping[str, np.ndarray]) -> pd.Da
basis = 2 ** np.arange(n, dtype=dtype)[::-1]
converted_dict[key] = np.sum(basis * bitstrings, axis=1)

# Use objects to accomodate more than 64 qubits if needed.
# Use objects to accommodate more than 64 qubits if needed.
dtype = object if any(bs.shape[1] > 63 for _, bs in measurements.items()) else np.int64
return pd.DataFrame(converted_dict, dtype=dtype)

Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/testing/circuit_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def assert_circuits_have_same_unitary_given_final_permutation(
ValueError: if 'qubit_map' does not have the same set of keys and values.
"""
if set(qubit_map.keys()) != set(qubit_map.values()):
raise ValueError("'qubit_map' must have the same set of of keys and values.")
raise ValueError("'qubit_map' must have the same set of keys and values.")

if not set(qubit_map.keys()).issubset(actual.all_qubits()):
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/testing/consistent_act_on.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def assert_all_implemented_act_on_effects_match_unitary(
Checks that act_on with CliffordTableau or StabilizerStateCHForm behaves
consistently with act_on through final state vector. Does not work with
Operations or Gates expecting non-qubit Qids. If either of the
assert_*_implmented args is true, fails if the corresponding method is not
assert_*_implemented args is true, fails if the corresponding method is not
implemented for the test circuit.

Args:
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/testing/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def assert_logs(
module for valid levels. By default this captures at the
`logging.WARNING` level and above, so this does not capture `logging.INFO`
or `logging.DEBUG` logs by default.
max_level: The maxium level at which to capture the logs. See the python logging
max_level: The maximum level at which to capture the logs. See the python logging
module for valid levels. By default this captures to the `logging.CRITICAL` level
thus, all the errors and critical messages will be captured as well.
capture_warnings: Whether warnings from the python's `warnings` module
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/transformers/expand_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def expand_composite(
"""A transformer that expands composite operations via `cirq.decompose`.

For each operation in the circuit, this pass examines if the operation can
be decomposed. If it can be, the operation is cleared out and and replaced
be decomposed. If it can be, the operation is cleared out and replaced
with its decomposition using a fixed insertion strategy.

Transformation is applied using `cirq.map_operations_and_unroll`, which preserves the
Expand Down
4 changes: 2 additions & 2 deletions cirq-core/cirq/transformers/routing/route_circuit_cqc.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __call__(
context: transformer context storing common configurable options for transformers.

Returns:
The routed circuit, which is equivalent to original circuit upto a final qubit
The routed circuit, which is equivalent to original circuit up to a final qubit
permutation and where each 2-qubit operation is between adjacent qubits in the
`device_graph`.

Expand Down Expand Up @@ -183,7 +183,7 @@ def route_circuit(
context: transformer context storing common configurable options for transformers.

Returns:
The routed circuit, which is equivalent to original circuit upto a final qubit
The routed circuit, which is equivalent to original circuit up to a final qubit
permutation and where each 2-qubit operation is between adjacent qubits in the
`device_graph`.
The initial mapping from logical to physical qubits used as part of the routing
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/transformers/stratify.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _stratify_circuit(
num_classes = len(classifiers) + 1 # include one "extra" category for ignored operations
new_moments: List[List['cirq.Operation']] = []

# Keep track of the the latest time index for each qubit, measurement key, and control key.
# Keep track of the latest time index for each qubit, measurement key, and control key.
qubit_time_index: Dict['cirq.Qid', int] = {}
measurement_time_index: Dict['cirq.MeasurementKey', int] = {}
control_time_index: Dict['cirq.MeasurementKey', int] = {}
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/transformers/transformer_primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def merge_operations(

The method iterates on the input circuit moment-by-moment from left to right and attempts
to repeatedly merge each operation in the latest moment with all the corresponding merge-able
operations to it's left.
operations to its left.

If op1 and op2 are merged, both op1 and op2 are deleted from the circuit and
the resulting `merged_op` is inserted at the index corresponding to the larger
Expand Down
2 changes: 1 addition & 1 deletion cirq-core/cirq/value/product_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,4 +322,4 @@ def stabilized_by(self) -> Tuple[int, 'cirq.Pauli']:
)

PAULI_STATES = [KET_PLUS, KET_MINUS, KET_IMAG, KET_MINUS_IMAG, KET_ZERO, KET_ONE]
document(PAULI_STATES, """All one-qubit states stabalized by the pauli operators.""")
document(PAULI_STATES, """All one-qubit states stabilized by the pauli operators.""")
2 changes: 1 addition & 1 deletion cirq-core/cirq/vis/heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def __init__(self, value_map: Mapping[QubitTuple, SupportsFloat], **kwargs):

Args:
value_map: A map from a qubit tuple location to a value.
**kwargs: Optinal kwargs including
**kwargs: Optional kwargs including
coupler_margin: float, default = 0.03
coupler_width: float, default = 0.6
"""
Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/api/v2/batch.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ option java_multiple_files = true;
// 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 seperately on the hardware.
// cause the programs to be executed separately on the hardware.
message BatchProgram {

// The circuits that should be bundled together as one program
Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/calibration/phased_fsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def override(self, parameters: PhasedFSimCharacterization) -> 'PhasedFSimCalibra
which are not None will be used to replace current parameters for every pair stored.

Returns:
New instance of PhasedFSimCalibrationResult with certain parameters overriden.
New instance of PhasedFSimCalibrationResult with certain parameters overridden.
"""
return PhasedFSimCalibrationResult(
parameters={
Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/engine/abstract_local_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, processors: List[AbstractLocalProcessor]):
self._processors = {proc.processor_id: proc for proc in processors}

def get_program(self, program_id: str) -> AbstractProgram:
"""Returns an exsiting AbstractProgram given an identifier.
"""Returns an existing AbstractProgram given an identifier.

Iteratively checks each processor for the given id.

Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/engine/abstract_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ async def run_calibration_async(
program_description: An optional description to set on the program.
program_labels: Optional set of labels to set on the program.
job_description: An optional description to set on the job.
job_labels: Optional set of labels to set on the job. By defauly,
job_labels: Optional set of labels to set on the job. By default,
this will add a 'calibration' label to the job.
Returns:
An AbstractJob whose results can be retrieved by calling
Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ async def run_calibration_async(
program_description: An optional description to set on the program.
program_labels: Optional set of labels to set on the program.
job_description: An optional description to set on the job.
job_labels: Optional set of labels to set on the job. By defauly,
job_labels: Optional set of labels to set on the job. By default,
this will add a 'calibration' label to the job.

Returns:
Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/engine/engine_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ async def create_job_async(
Tuple of created job id and job.

Raises:
ValueError: If the priority is not betwen 0 and 1000.
ValueError: If the priority is not between 0 and 1000.
"""
# Check program to run and program parameters.
if priority and not 0 <= priority < 1000:
Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/engine/engine_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ async def run_calibration_async(
program_description: An optional description to set on the program.
program_labels: Optional set of labels to set on the program.
job_description: An optional description to set on the job.
job_labels: Optional set of labels to set on the job. By defauly,
job_labels: Optional set of labels to set on the job. By default,
this will add a 'calibration' label to the job.
Returns:
An AbstractJob whose results can be retrieved by calling
Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/engine/runtime_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
estimate_run_batch_time to retrieve approximations of runtime on QCS
of various sizes and shapes of circuits.

Times were extrapolated from actual runs on Sycamore processors duing
Times were extrapolated from actual runs on Sycamore processors during
November 2021. These times should only be used as a rough guide.
Your experience may vary based on many factors not captured here.

Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/experimental/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Experimental features. Their API can be broken without any warning and might be in an work-in
"""Experimental features. Their API can be broken without any warning and might be in a work-in
progress state"""
from cirq_google.experimental.noise_models import (
PerQubitDepolarizingWithDampedReadoutNoiseModel,
Expand Down
6 changes: 3 additions & 3 deletions cirq-google/cirq_google/ops/fsim_gate_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class FSimGateFamily(cirq.GateFamily):
>>> assert gf.convert(cirq.FSimGate(-np.pi/2, sympy.Symbol("t")), cirq.ISwapPowGate) is None

2. To convert to/from any of the parameterized `POSSIBLE_FSIM_GATES` types (assuming correct
value of the parameter would be filled in during paramter resolution):
value of the parameter would be filled in during parameter resolution):
>>> gf = cirq_google.FSimGateFamily(allow_symbols = True)
>>> theta, phi = sympy.Symbol("theta"), sympy.Symbol("phi")
>>> assert gf.convert(cirq.FSimGate(-np.pi/4, phi), cirq.ISwapPowGate) == cirq.SQRT_ISWAP
Expand Down Expand Up @@ -311,7 +311,7 @@ def convert(self, gate: cirq.Gate, target_gate_type: Type[T]) -> Optional[T]:

The method can also be used for converting parameterized gate instances, by setting
`allow_symbols=True` in the gate family constructor. Note that, conversion of
paramaterized gate instances tries to be lenient and assumes that the correct
parameterized gate instances tries to be lenient and assumes that the correct
parameters would eventually be filled during parameter resolution. This can also result
in dropping extra parameters during type conversion, assuming the dropped parameters
would be supplied the correct values. For example:
Expand All @@ -326,7 +326,7 @@ def convert(self, gate: cirq.Gate, target_gate_type: Type[T]) -> Optional[T]:
target_gate_type: One of `POSSIBLE_FSIM_GATES` types to which the given gate should be
converted to.
Returns:
The converted gate instances if the converion is possible, else None.
The converted gate instances if the conversion is possible, else None.
Raises:
ValueError: If `target_gate_type` is not one of `POSSIBLE_FSIM_GATES`.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def deserialize(self, proto: v2.program_pb2.Program) -> cirq.Circuit:
The deserialized Circuit

Raises:
ValueError: If the given proto has no language or the langauge gate set mismatches
ValueError: If the given proto has no language or the language gate set mismatches
that specified in as the name of this serialized gate set. Also if deserializing
a schedule is attempted.
NotImplementedError: If the program proto does not contain a circuit or schedule.
Expand Down
2 changes: 1 addition & 1 deletion cirq-ionq/cirq_ionq/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def fidelities(self) -> dict:
return self._calibration_dict['fidelity']

def timings(self) -> dict:
"""Returns the gate, measurement, and reseting timings."""
"""Returns the gate, measurement, and resetting timings."""
return self._calibration_dict['timing']

def connectivity(self) -> Set[Tuple[cirq.LineQubit, cirq.LineQubit]]:
Expand Down
4 changes: 2 additions & 2 deletions cirq-ionq/cirq_ionq/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SerializedProgram:
"""A container for the serialized portions of a `cirq.Circuit`.

Attributes:
body: A dictionary which containts the number of qubits and the serialized circuit
body: A dictionary which contains the number of qubits and the serialized circuit
minus the measurements.
metadata: A dictionary whose keys store information about the measurements in the circuit.
"""
Expand Down Expand Up @@ -242,7 +242,7 @@ def _serialize_measurements(self, meas_ops: Iterator) -> Dict[str, str]:

Each key and targets are serialized into a string of the form `key` + the ASCII unit
separator (chr(31)) + targets as a comma separated value. These are then combined
into a string with a seperator character of the ASCII record separator (chr(30)).
into a string with a separator character of the ASCII record separator (chr(30)).
Finally this full string is serialized as the values in the metadata dict with keys
given by `measurementX` for X = 0,1, .. 9 and X large enough to contain the entire
string.
Expand Down
Loading