diff --git a/unitary/alpha/quantum_world.py b/unitary/alpha/quantum_world.py index 28b291e4..daa00dff 100644 --- a/unitary/alpha/quantum_world.py +++ b/unitary/alpha/quantum_world.py @@ -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 diff --git a/unitary/engine_utils.py b/unitary/engine_utils.py index 0f1c6bc9..5b78ee07 100644 --- a/unitary/engine_utils.py +++ b/unitary/engine_utils.py @@ -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) diff --git a/unitary/examples/quantum_rpg/ascii_art.py b/unitary/examples/quantum_rpg/ascii_art.py index b6ed4d39..08eef985 100644 --- a/unitary/examples/quantum_rpg/ascii_art.py +++ b/unitary/examples/quantum_rpg/ascii_art.py @@ -1,6 +1,5 @@ """ASCII art and other large text constants.""" - # ASCII art generated with font # DOOM by Frans P. de Vries 18 Jun 1996 # based on Big by Glenn Chappell 4/93 -- based on Standard diff --git a/unitary/examples/quantum_rpg/classes.py b/unitary/examples/quantum_rpg/classes.py index 13473725..c22e2da5 100644 --- a/unitary/examples/quantum_rpg/classes.py +++ b/unitary/examples/quantum_rpg/classes.py @@ -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 diff --git a/unitary/examples/quantum_rpg/input_helpers.py b/unitary/examples/quantum_rpg/input_helpers.py index d9d52a3e..6e1b44c6 100644 --- a/unitary/examples/quantum_rpg/input_helpers.py +++ b/unitary/examples/quantum_rpg/input_helpers.py @@ -1,4 +1,5 @@ """Functions for safe and user-friendly input.""" + from typing import Callable, Optional, Sequence, TextIO import sys diff --git a/unitary/quantum_chess/quantum_board.py b/unitary/quantum_chess/quantum_board.py index 6ac79e03..4039e4c0 100644 --- a/unitary/quantum_chess/quantum_board.py +++ b/unitary/quantum_chess/quantum_board.py @@ -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