Skip to content

Commit

Permalink
Replace Black with Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-koch committed Nov 6, 2023
1 parent 5aaa453 commit 5ec5029
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions guppy/hugr/visualise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)} ?"
Expand Down
9 changes: 6 additions & 3 deletions guppy/prelude/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
...
Expand Down Expand Up @@ -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:
...
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dev = [
"build",
"pytest",
"mypy==1.3.0",
"black",
"ruff",
"maturin>=1.1,<2.0",
]
Expand Down

0 comments on commit 5ec5029

Please sign in to comment.