diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index 122a678..b623f8c 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -29,6 +29,4 @@ jobs: python -m pip install --upgrade pip pip install .[dev] - - run: mypy - - - run: pyright + - run: mypy \ No newline at end of file diff --git a/README.md b/README.md index e5fd030..b5f331d 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,9 @@ circuit = parser.parse_file("my_circuit.qasm") |------------------------------------------------------------------|---------------------| | [ccx](https://openqasm.com/language/standard_library.html#ccx) | CCX | | [crz](https://openqasm.com/language/standard_library.html#crz) | RZZ | -| [cx](https://openqasm.com/language/standard_library.html#cx) | CX | +| [cx](https://openqasm.com/language/standard_library.html#cx) | CNOT | | [swap](https://openqasm.com/language/standard_library.html#swap) | SWAP | +| [swap](https://openqasm.com/language/standard_library.html#cz) | CZ | | [h](https://openqasm.com/language/standard_library.html#h) | H | | [s](https://openqasm.com/language/standard_library.html#s) | S | | [x](https://openqasm.com/language/standard_library.html#x) | X | diff --git a/graphix_qasm_parser/parser.py b/graphix_qasm_parser/parser.py index 16e1953..11cdbcf 100644 --- a/graphix_qasm_parser/parser.py +++ b/graphix_qasm_parser/parser.py @@ -45,10 +45,12 @@ def CZ(_q0: int, _q1: int) -> None: # noqa: N802 raise NotImplementedError(msg) try: - from graphix.fundamentals import rad_to_angle + from graphix.fundamentals import ANGLE_PI, rad_to_angle except ImportError: # Compatibility with graphix <= 0.3.3 # See https://github.com/TeamGraphix/graphix/pull/399 + ANGLE_PI = math.pi + def rad_to_angle(angle: float) -> float: """In older versions of graphix (<= 0.3.3), instruction angles were expressed in radians.""" return angle @@ -472,7 +474,8 @@ def visitLiteralExpression(self, ctx: qasm3Parser.LiteralExpressionContext) -> _ raise NotImplementedError(msg) def parse_binary_operator( - self, ctx: qasm3Parser.AdditiveExpressionContext | qasm3Parser.MultiplicativeExpressionContext + self, + ctx: qasm3Parser.AdditiveExpressionContext | qasm3Parser.MultiplicativeExpressionContext, ) -> _Value: lhs_expr: qasm3Parser.ExpressionContext = ctx.getChild(0) rhs_expr: qasm3Parser.ExpressionContext = ctx.getChild(2)