From 6c5041844afc02c89453515b196b13a0539d743e Mon Sep 17 00:00:00 2001 From: Pengfei Chen Date: Mon, 2 Oct 2023 13:05:13 -0700 Subject: [PATCH] reformat --- .../examples/quantum_chinese_chess/enums.py | 27 ++++++++++--------- .../examples/quantum_chinese_chess/piece.py | 6 ++--- .../quantum_chinese_chess/piece_test.py | 6 +++-- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/unitary/examples/quantum_chinese_chess/enums.py b/unitary/examples/quantum_chinese_chess/enums.py index 83e3b63d..3009a0b5 100644 --- a/unitary/examples/quantum_chinese_chess/enums.py +++ b/unitary/examples/quantum_chinese_chess/enums.py @@ -54,20 +54,21 @@ class Color(enum.Enum): class Type(enum.Enum): - """ The four values are symbols corresponding to - English red - English black - Chinese red - Chinese black - """ - EMPTY = [".", ".", ".", "."] - SOLDIER = ["s", "S", "兵", "卒"] - CANNON = ["c", "C", "炮", "砲"] - ROOK = ["r", "R", "车", "車"] - HORSE = ["h", "H", "马", "馬"] + """The four values are symbols corresponding to + English red + English black + Chinese red + Chinese black + """ + + EMPTY = [".", ".", ".", "."] + SOLDIER = ["s", "S", "兵", "卒"] + CANNON = ["c", "C", "炮", "砲"] + ROOK = ["r", "R", "车", "車"] + HORSE = ["h", "H", "马", "馬"] ELEPHANT = ["e", "E", "象", "相"] - ADVISOR = ["a", "A", "士", "仕"] - GENERAL = ["g", "G", "将", "帥"] + ADVISOR = ["a", "A", "士", "仕"] + GENERAL = ["g", "G", "将", "帥"] @staticmethod def type_of(c: str) -> Optional["Type"]: diff --git a/unitary/examples/quantum_chinese_chess/piece.py b/unitary/examples/quantum_chinese_chess/piece.py index 62777fcf..0e9462d4 100644 --- a/unitary/examples/quantum_chinese_chess/piece.py +++ b/unitary/examples/quantum_chinese_chess/piece.py @@ -11,14 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from unitary.alpha import ( - QuantumObject -) +from unitary.alpha import QuantumObject from unitary.examples.quantum_chinese_chess.enums import ( SquareState, Language, Color, - Type + Type, ) diff --git a/unitary/examples/quantum_chinese_chess/piece_test.py b/unitary/examples/quantum_chinese_chess/piece_test.py index 2dfdf327..c7df0358 100644 --- a/unitary/examples/quantum_chinese_chess/piece_test.py +++ b/unitary/examples/quantum_chinese_chess/piece_test.py @@ -16,7 +16,7 @@ SquareState, Language, Color, - Type + Type, ) from unitary.examples.quantum_chinese_chess.piece import Piece from unitary.alpha import QuantumWorld @@ -44,4 +44,6 @@ def test_enum(): p1 = Piece("b1", SquareState.OCCUPIED, Type.HORSE, Color.BLACK) p2 = Piece("c2", SquareState.EMPTY, Type.EMPTY, Color.NA) board = QuantumWorld([p0, p1, p2]) - assert board.peek() == [[SquareState.OCCUPIED,SquareState.OCCUPIED,SquareState.EMPTY]] + assert board.peek() == [ + [SquareState.OCCUPIED, SquareState.OCCUPIED, SquareState.EMPTY] + ]