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