Skip to content

Commit a52bf66

Browse files
committed
update black version in pyproject.toml and pre-commit to match CI
1 parent 5aaeabd commit a52bf66

File tree

6 files changed

+89
-58
lines changed

6 files changed

+89
-58
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
- id: isort
1515
name: isort (python)
1616
- repo: https://github.com/psf/black
17-
rev: 25.1.0
17+
rev: 26.1.0
1818
hooks:
1919
- id: black
2020
- repo: https://github.com/charliermarsh/ruff-pre-commit

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ include = ["src/kirin/*"]
7373

7474
[tool.uv]
7575
dev-dependencies = [
76-
"black>=24.10.0",
76+
"black>=26.1.0",
7777
"coverage>=7.6.4",
7878
"ipykernel>=6.29.5",
7979
"ipython>=8.29.0",

src/kirin/dialects/math/_gen.py

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ def builtin_math_functions():
6060
ret_type = "types.Bool"
6161
else:
6262
ret_type = "types.Float"
63-
f.write(
64-
textwrap.dedent(
65-
f"""
63+
f.write(textwrap.dedent(f"""
6664
@statement(dialect=dialect)
6765
class {name}(ir.Statement):
6866
\"\"\"{name} statement, wrapping the math.{name} function
@@ -71,9 +69,7 @@ class {name}(ir.Statement):
7169
traits = frozenset({{ir.Pure(), lowering2.FromPythonCall()}})
7270
{fields}
7371
result: ir.ResultValue = info.result({ret_type})
74-
"""
75-
)
76-
)
72+
"""))
7773

7874

7975
with open(os.path.join(os.path.dirname(__file__), "interp.py"), "w") as f:
@@ -89,23 +85,19 @@ class {name}(ir.Statement):
8985
fields = ", ".join(
9086
[f"values[{idx}]" for idx, _ in enumerate(sig.parameters.keys())]
9187
)
92-
implements.append(
93-
f"""
88+
implements.append(f"""
9489
@impl(stmts.{name})
9590
def {name}(self, interp, frame: Frame, stmt: stmts.{name}):
9691
values = frame.get_values(stmt.args)
97-
return (math.{name}({fields}),)"""
98-
)
92+
return (math.{name}({fields}),)""")
9993

10094
# Write the interpreter class
10195
methods = "\n\n".join(implements)
102-
f.write(
103-
f"""
96+
f.write(f"""
10497
@dialect.register
10598
class MathMethodTable(MethodTable):
10699
{methods}
107-
"""
108-
)
100+
""")
109101

110102
# __init__.py
111103
with open(os.path.join(os.path.dirname(__file__), "__init__.py"), "w") as f:
@@ -124,14 +116,10 @@ class MathMethodTable(MethodTable):
124116
ret_type = "bool"
125117
else:
126118
ret_type = "float"
127-
f.write(
128-
textwrap.dedent(
129-
f"""
119+
f.write(textwrap.dedent(f"""
130120
@lowering2.wraps(stmts.{name})
131121
def {name}({", ".join(f"{arg}: {ret_type}" for arg in sig.parameters.keys())}) -> {ret_type}: ...
132-
"""
133-
)
134-
)
122+
"""))
135123
f.write("\n")
136124

137125
for file in ["__init__.py", "interp.py", "stmts.py"]:
@@ -178,16 +166,12 @@ def {name}({", ".join(f"{arg}: {ret_type}" for arg in sig.parameters.keys())}) -
178166
args = ", ".join(arg for arg in sig.parameters.keys())
179167
inputs = ", ".join("0.42" for _ in sig.parameters.keys())
180168

181-
f.write(
182-
textwrap.dedent(
183-
f"""
169+
f.write(textwrap.dedent(f"""
184170
@basic
185171
def {name}_func({args}):
186172
return math.{name}({args})
187173
188174
def test_{name}():
189175
truth = pymath.{name}({inputs})
190176
assert ({name}_func({inputs}) - truth) < 1e-6
191-
"""
192-
)
193-
)
177+
"""))

src/kirin/lowering/python/binding.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ class Binding(Generic[Params, RetType]):
1313
parent: type["Statement"]
1414

1515
def __call__(self, *args: Params.args, **kwargs: Params.kwargs) -> RetType:
16-
raise NotImplementedError(
17-
f"Binding of {self.parent.name} can \
18-
only be called from a kernel"
19-
)
16+
raise NotImplementedError(f"Binding of {self.parent.name} can \
17+
only be called from a kernel")
2018

2119

2220
def wraps(parent: type["Statement"]):

test/lowering/test_assign.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class MultiResult(ir.Statement):
2121
def test_multi_result():
2222
@dummy_dialect
2323
def multi_assign():
24-
(x, y) = MultiResult() # type: ignore
24+
x, y = MultiResult() # type: ignore
2525
return x, y
2626

2727
stmt = multi_assign.callable_region.blocks[0].stmts.at(0)
@@ -33,7 +33,7 @@ def multi_assign():
3333

3434
@dummy_dialect
3535
def multi_assign_error():
36-
(x, y, z) = MultiResult() # type: ignore
36+
x, y, z = MultiResult() # type: ignore
3737
return x, y, z
3838

3939

0 commit comments

Comments
 (0)