Skip to content

Commit

Permalink
Fix pylint failures for pylint 2.14
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Jun 26, 2022
1 parent 1251f96 commit 370035b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
6 changes: 5 additions & 1 deletion .pylintrc-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@
- maptlotlib.pyplot

- arg: init-hook
val: sys.setrecursionlimit(5000)
val: import sys; sys.setrecursionlimit(5000)

- arg: disable
val:
- E1102
1 change: 1 addition & 0 deletions loopy/auto_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def _default_check_result(result, ref_result):
linf_err = (
np.max(np.abs(ref_result-result))
/ np.max(np.abs(ref_result-result)))
# pylint: disable=bad-string-format-type
return (False,
"results do not match -- (rel) l_2 err: %g, l_inf err: %g"
% (l2_err, linf_err))
Expand Down
20 changes: 9 additions & 11 deletions loopy/kernel/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,13 +763,14 @@ def get_auto_axis_iname_ranking_by_stride(kernel, insn):
continue
coeffs = CoefficientCollector()(iexpr_i)
for var, coeff in coeffs.items():
if (isinstance(var, Variable)
and var.name in auto_axis_inames):
# excludes '1', i.e. the constant
new_stride = coeff*stride
old_stride = iname_to_stride_expr.get(var.name, None)
if old_stride is None or new_stride < old_stride:
iname_to_stride_expr[var.name] = new_stride
# This is a nested if instead of 'and' for pylint's benefit.
if isinstance(var, Variable):
if var.name in auto_axis_inames:
# excludes '1', i.e. the constant
new_stride = coeff*stride
old_stride = iname_to_stride_expr.get(var.name, None)
if old_stride is None or new_stride < old_stride:
iname_to_stride_expr[var.name] = new_stride

# }}}

Expand Down Expand Up @@ -1807,10 +1808,7 @@ def get_subkernel_to_insn_id_map(kernel):
for insn_id in sched_item_to_insn_id(sched_item):
result[subkernel].add(insn_id)

for subkernel in result:
result[subkernel] = frozenset(result[subkernel])

return result
return {name: frozenset(insn_ids) for name, insn_ids in result.items()}

# }}}

Expand Down

0 comments on commit 370035b

Please sign in to comment.