Skip to content
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

fixed formatting #185

Merged
merged 1 commit into from
Mar 5, 2024
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
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
Loading