Skip to content

Commit

Permalink
Merge pull request #185 from solodov/format
Browse files Browse the repository at this point in the history
fixed formatting
  • Loading branch information
dstrain115 authored Mar 5, 2024
2 parents 7141896 + 91e468f commit c83febf
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions unitary/alpha/quantum_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ def copy(self) -> "QuantumWorld":
for remap in self.qubit_remapping_dict:
new_dict = {}
for key_obj, value_obj in remap.items():
new_dict[
new_world.get_object_by_name(key_obj.name)
] = new_world.get_object_by_name(value_obj.name)
new_dict[new_world.get_object_by_name(key_obj.name)] = (
new_world.get_object_by_name(value_obj.name)
)
new_world.qubit_remapping_dict.append(new_dict)
new_world.qubit_remapping_dict_length = self.qubit_remapping_dict_length.copy()
return new_world
Expand Down
8 changes: 5 additions & 3 deletions unitary/engine_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ def _get_program_id(program: Any):
return str(uuid.uuid4())

parts = [
p
if len(p) <= chars_per_part
else p[: chars_per_part // 2] + p[-chars_per_part // 2 :]
(
p
if len(p) <= chars_per_part
else p[: chars_per_part // 2] + p[-chars_per_part // 2 :]
)
for p in parts
]
return "_".join(parts)
Expand Down
1 change: 0 additions & 1 deletion unitary/examples/quantum_rpg/ascii_art.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""ASCII art and other large text constants."""


# ASCII art generated with font
# DOOM by Frans P. de Vries <[email protected]> 18 Jun 1996
# based on Big by Glenn Chappell 4/93 -- based on Standard
Expand Down
4 changes: 1 addition & 3 deletions unitary/examples/quantum_rpg/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ def actions(self) -> Dict[str, Callable]:
),
}
if self.level >= 3:
action_dict[
"s"
] = (
action_dict["s"] = (
lambda monster, qubit: f"Sample result {monster.sample(monster.quantum_object_name(qubit), False)}"
)
return action_dict
1 change: 1 addition & 0 deletions unitary/examples/quantum_rpg/input_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for safe and user-friendly input."""

from typing import Callable, Optional, Sequence, TextIO

import sys
Expand Down
6 changes: 3 additions & 3 deletions unitary/quantum_chess/quantum_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,9 @@ def _generate_accumulations(self, repetitions: int = 1000) -> None:
probs = self._apply_cache(
previous_probability, last_move, self.cache[cache_key]
)
self.move_history_probabilities_cache[
-1
] = self._make_probability_history(repetitions, probs)
self.move_history_probabilities_cache[-1] = (
self._make_probability_history(repetitions, probs)
)
# Remove entry from cached since it has been consumed.
del self.cache[cache_key]
return
Expand Down

0 comments on commit c83febf

Please sign in to comment.