Skip to content

Commit b490757

Browse files
huydhnfacebook-github-bot
authored andcommitted
Apply lintrunner --all-files -a (#275)
Summary: Pretty big bang fix for all existing linter issues captured by #266. They are: * F401 imported but unused * B028 No explicit stacklevel argument found * C901 too complex (ignored with `# noqa: C901`) * C419 Unnecessary list comprehension * F841 local variable is assigned to but never used * B023 Function definition does not bind loop variable (only once in `backends/xnnpack/test/test_xnnpack_quantized.py`) * EXE001 Shebang is present but the file is not executable ### Testing All tests pass on CI and `lintrunner --all-files -a` passes locally. Pull Request resolved: #275 Test Plan: `arc lint` && `lintrunner --all-files -a` locally Reviewed By: guangy10 Differential Revision: D49175246 Pulled By: huydhn fbshipit-source-id: 1d035dd791f9bdafbae14b6d9132e8ca6cf52b9f
1 parent 26527ef commit b490757

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+66
-123
lines changed

backends/transforms/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ python_library(
2020
deps = [
2121
"//caffe2:torch",
2222
"//executorch/exir:sym_util",
23+
"//executorch/exir/dialects:lib",
2324
],
2425
)

backends/transforms/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# pyre-strict
88

9-
from executorch.backends.transforms.addmm_mm_to_linear import (
9+
from executorch.backends.transforms.addmm_mm_to_linear import ( # noqa: F401
1010
apply_addmm_mm_to_linear_transform,
1111
get_shape,
1212
)

backends/vulkan/serialization/vulkan_graph_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from dataclasses import dataclass
1414
from enum import IntEnum
15-
from typing import List, Union
15+
from typing import List
1616

1717

1818
class VkDatatype(IntEnum):

backends/xnnpack/partition/xnnpack_partitioner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def qualify_nodes(self, input_nodes: List[torch.fx.Node]) -> bool:
347347
Disqualify the whole module if one of the nodes fails to satisfy.
348348
"""
349349
return all(
350-
[XnnpackOperatorSupport.check_constraint(node) for node in input_nodes]
350+
XnnpackOperatorSupport.check_constraint(node) for node in input_nodes
351351
)
352352

353353
def get_module_partitions(

backends/xnnpack/passes/TARGETS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@ python_library(
2121
"//executorch/exir:pass_base",
2222
"//executorch/exir/dialects:lib",
2323
"//executorch/exir/passes:const_prop_pass",
24-
"//executorch/exir/passes:lib",
2524
],
2625
)

backends/xnnpack/passes/channels_last_tagged_reshape_pass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def input_to_nchw(
344344
target_node=target_node,
345345
)
346346

347-
def call(self, graph_module: torch.fx.GraphModule):
347+
def call(self, graph_module: torch.fx.GraphModule): # noqa: C901
348348
graph = graph_module.graph
349349
original_nodes = list(graph.nodes)
350350
for node in original_nodes:

backends/xnnpack/test/TARGETS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ python_unittest(
2525
"//executorch/bundled_program:core",
2626
"//executorch/bundled_program/serialize:lib",
2727
"//executorch/exir:lib",
28-
"//executorch/exir:tracer",
2928
"//executorch/exir/backend:backend_api",
3029
"//executorch/exir/passes:spec_prop_pass",
3130
"//executorch/extension/pybindings:portable_lib", # @manual
@@ -54,7 +53,6 @@ python_unittest(
5453
"//executorch/bundled_program:core",
5554
"//executorch/bundled_program/serialize:lib",
5655
"//executorch/exir:lib",
57-
"//executorch/exir:tracer",
5856
"//executorch/exir/backend:backend_api",
5957
"//executorch/exir/dialects:lib",
6058
"//executorch/exir/passes:spec_prop_pass",
@@ -84,7 +82,6 @@ python_unittest(
8482
"//executorch/bundled_program:core",
8583
"//executorch/bundled_program/serialize:lib",
8684
"//executorch/exir:lib",
87-
"//executorch/exir:tracer",
8885
"//executorch/exir/backend:backend_api",
8986
"//executorch/exir/passes:spec_prop_pass",
9087
"//executorch/extension/pybindings:portable_lib", # @manual

backends/xnnpack/test/test_xnnpack_quantized.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,17 @@ def just_quant(x):
4646
self.lower_module_and_test_output(just_quant, sample_input)
4747

4848
def test_xnnpack_qmax_pool_2d(self):
49-
for maxpool_params in [(4,), (4, 2), (4, 2, 2)]:
50-
51-
class maxpool(torch.nn.Module):
52-
def __init__(self):
53-
super().__init__()
54-
self.max = torch.nn.MaxPool2d(*maxpool_params)
49+
class maxpool(torch.nn.Module):
50+
def __init__(self, maxpool_params):
51+
super().__init__()
52+
self.max = torch.nn.MaxPool2d(*maxpool_params)
5553

56-
def forward(self, x):
57-
return self.max(x)
54+
def forward(self, x):
55+
return self.max(x)
5856

57+
for maxpool_params in [(4,), (4, 2), (4, 2, 2)]:
5958
example_input = (torch.ones(1, 2, 8, 8),)
60-
self.quantize_and_test_model(maxpool(), example_input)
59+
self.quantize_and_test_model(maxpool(maxpool_params), example_input)
6160

6261
def test_xnnpack_qadd(self):
6362
class Add(torch.nn.Module):

backends/xnnpack/test/test_xnnpack_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from executorch.exir.backend.backend_api import to_backend, validation_disabled
3636

3737
from executorch.exir.passes.spec_prop_pass import SpecPropPass
38-
from executorch.exir.tracer import _default_decomposition_table
3938

4039
from executorch.extension.pybindings.portable_lib import ( # @manual
4140
_load_for_executorch_from_buffer,

backends/xnnpack/test/tester/tester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def __init__(
290290
self._stage_name(Serialize): [],
291291
}
292292
assert all(
293-
[stage in self.pipeline for stage in self.stages]
293+
stage in self.pipeline for stage in self.stages
294294
), "Invalid Tester internal state!"
295295

296296
# Current stage name

0 commit comments

Comments
 (0)