From 5ec5029e94c40a0f78550eabb21e8ba093c3eb0f Mon Sep 17 00:00:00 2001 From: Mark Koch Date: Mon, 6 Nov 2023 09:33:17 +0000 Subject: [PATCH] Replace Black with Ruff --- .github/workflows/pull-request.yaml | 4 ++-- guppy/hugr/visualise.py | 7 ++++--- guppy/prelude/integer.py | 9 ++++++--- pyproject.toml | 1 - 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index d248faf7..1ac9e3ed 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -37,8 +37,8 @@ jobs: - name: Type check with mypy run: mypy guppy - - name: Check formatting with black - run: black --check guppy + - name: Check formatting with ruff + run: ruff format --check guppy - name: Lint with ruff run: ruff check guppy diff --git a/guppy/hugr/visualise.py b/guppy/hugr/visualise.py index 53ada424..eba0bca6 100644 --- a/guppy/hugr/visualise.py +++ b/guppy/hugr/visualise.py @@ -251,15 +251,16 @@ def cfg_to_graphviz( ) -> gv.Digraph: graph = gv.Digraph("CFG", strict=False) for bb in cfg.bbs: - label = f""" + label = ( + f""" assigned: {commas(*bb.vars.assigned)} used: {commas(*bb.vars.used)} maybe_ass_before: {commas(*maybe_ass_before[bb])} ass_before: {commas(*ass_before[bb])} live_before: {commas(*live_before[bb])} -------- -""" + "\n".join( - ast.unparse(s) for s in bb.statements +""" + + "\n".join(ast.unparse(s) for s in bb.statements) ) if bb.branch_pred is not None: label += f"\n{ast.unparse(bb.branch_pred)} ?" diff --git a/guppy/prelude/integer.py b/guppy/prelude/integer.py index d3d6fd64..578edbb2 100644 --- a/guppy/prelude/integer.py +++ b/guppy/prelude/integer.py @@ -83,7 +83,8 @@ def __ceil__(self: int) -> int: @extension.func( - OpCompiler(ops.DummyOp(name="idivmod_s_panic")), instance=IntType # TODO + OpCompiler(ops.DummyOp(name="idivmod_s_panic")), + instance=IntType, # TODO ) def __divmod__(self: int, other: int) -> tuple[int, int]: ... @@ -192,14 +193,16 @@ def __rand__(self: int, other: int) -> int: @extension.func( - Reversed(OpCompiler(ops.DummyOp(name="idivmod_s_panic"))), instance=IntType # TODO + Reversed(OpCompiler(ops.DummyOp(name="idivmod_s_panic"))), + instance=IntType, # TODO ) def __rdivmod__(self: int, other: int) -> int: ... @extension.func( - Reversed(OpCompiler(ops.DummyOp(name="idiv_s_panic"))), instance=IntType # TODO + Reversed(OpCompiler(ops.DummyOp(name="idiv_s_panic"))), + instance=IntType, # TODO ) def __rfloordiv__(self: int, other: int) -> int: ... diff --git a/pyproject.toml b/pyproject.toml index 1e3e4ad6..df4fc7d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,6 @@ dev = [ "build", "pytest", "mypy==1.3.0", - "black", "ruff", "maturin>=1.1,<2.0", ]