Skip to content

Commit

Permalink
ArgSizeMismatchRule: small fixes after PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
awnawab committed Jul 19, 2023
1 parent 16f022a commit 2073856
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions lint_rules/lint_rules/debug_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,7 @@ def check_subroutine(cls, subroutine, rule_report, config, **kwargs):
continue

arg_map = {carg: rarg for rarg, carg in call.arg_iter()}

# combine args and kwargs into single iterable
arguments = call.arguments
arguments += as_tuple([arg for kw, arg in call.kwarguments])

for arg in arguments:
for arg in arg_map:

if isinstance(arg_map[arg], Scalar):
dummy_arg_size = as_tuple(IntLiteral(1))
Expand All @@ -139,8 +134,7 @@ def check_subroutine(cls, subroutine, rule_report, config, **kwargs):
for dim in arg_map[arg].shape if isinstance(dim, RangeIndex)):
continue
dummy_arg_size = cls.get_explicit_arg_size(arg_map[arg], arg_map[arg].shape)

dummy_arg_size = SubstituteExpressions(dict(call.arg_iter())).visit(dummy_arg_size)
dummy_arg_size = SubstituteExpressions(dict(call.arg_iter())).visit(dummy_arg_size)

# TODO: skip string literal args
if isinstance(arg, StringLiteral):
Expand Down
2 changes: 1 addition & 1 deletion lint_rules/tests/test_debug_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


pytestmark = pytest.mark.skipif(not available_frontends(),
reason='Suitable frontend not available')
reason='Supported frontend not available')


@pytest.fixture(scope='module', name='rules')
Expand Down

0 comments on commit 2073856

Please sign in to comment.