提交 ffd7a5aa authored 作者: Virgile Andreani's avatar Virgile Andreani 提交者: Virgile Andreani

Apply rule UP031

上级 83e4bd29
......@@ -514,14 +514,12 @@ class ProfileStats:
# While this carries over less information, it is arranged such
# that it is way more readable than the previous output of the
# profiler
nb_classes = max(0, len(otimes) - N)
percent_total = sum(f for f, t, a, ci, nb_call, nb_op in otimes[N:])
time_total = sum(t for f, t, a, ci, nb_call, nb_op in otimes[N:])
print(
" ... (remaining %i Classes account for %6.2f%%(%.2fs) of "
"the runtime)"
% (
max(0, len(otimes) - N),
sum(f for f, t, a, ci, nb_call, nb_op in otimes[N:]),
sum(t for f, t, a, ci, nb_call, nb_op in otimes[N:]),
),
f" ... (remaining {nb_classes} Classes account for "
f"{percent_total:6.2f}%%({time_total:.2f}s) of the runtime)",
file=file,
)
print("", file=file)
......@@ -607,14 +605,12 @@ class ProfileStats:
# While this carries over less information, it is arranged such
# that it is way more readable than the previous output of the
# profiler
nb_ops = max(0, len(otimes) - N)
percent_total = sum(f for f, t, a, ci, nb_call, nb_op in otimes[N:])
time_total = sum(t for f, t, a, ci, nb_call, nb_op in otimes[N:])
print(
" ... (remaining %i Ops account for %6.2f%%(%.2fs) of "
"the runtime)"
% (
max(0, len(otimes) - N),
sum(f for f, t, a, ci, nb_call, nb_op in otimes[N:]),
sum(t for f, t, a, ci, nb_call, nb_op in otimes[N:]),
),
f" ... (remaining {nb_ops} Ops account for "
f"{percent_total:6.2f}%%({time_total:.2f}s) of the runtime)",
file=file,
)
print("", file=file)
......
......@@ -108,12 +108,12 @@ def failure_code(sub, use_goto=True):
be careful to avoid executing incorrect code.
"""
id = sub["id"]
failure_var = sub["failure_var"]
if use_goto:
goto_statement = "goto __label_%(id)i;" % sub
goto_statement = f"goto __label_{id};"
else:
goto_statement = ""
id = sub["id"]
failure_var = sub["failure_var"]
return f"""{{
{failure_var} = {id};
if (!PyErr_Occurred()) {{
......
......@@ -1076,7 +1076,7 @@ class TestFusion:
def test_fusion_35_inputs(self):
r"""Make sure we don't fuse too many `Op`\s and go past the 31 function arguments limit."""
inpts = vectors(["i%i" % i for i in range(35)])
inpts = vectors([f"i{i}" for i in range(35)])
# Make an elemwise graph looking like:
# sin(i34 + sin(i33 + sin(... i1 + sin(i0) ...)))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论