Skip to content

Commit 1e43df9

Browse files
committed
Fix linters
1 parent 8678012 commit 1e43df9

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

.isort.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[isort]
2-
line_length = 79
2+
line_length = 89
33
multi_line_output = 0
44
known_standard_library = setuptools
55
known_first_party = ptflops

ptflops/aten_engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def f(*args):
5454

5555
def exit_module(self, name):
5656
def f(*args):
57-
assert(self.parents[-1] == name)
57+
assert (self.parents[-1] == name)
5858
self.parents.pop()
5959
return f
6060

@@ -138,7 +138,7 @@ def get_flops_aten(model, input_res,
138138

139139
except Exception as e:
140140
print("Flops estimation was not finished successfully because of"
141-
f" the following exception:\n{type(e)} : {e}")
141+
f" the following exception: \n{type(e)}: {e}")
142142
traceback.print_exc()
143143

144144
return None, None

ptflops/pytorch_engine.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
import torch.nn as nn
1616
import torch.nn.functional as F
1717

18-
from .pytorch_ops import (CUSTOM_MODULES_MAPPING, FUNCTIONAL_MAPPING,
19-
MODULES_MAPPING, TENSOR_OPS_MAPPING)
18+
from .pytorch_ops import (CUSTOM_MODULES_MAPPING, FUNCTIONAL_MAPPING, MODULES_MAPPING,
19+
TENSOR_OPS_MAPPING)
2020
from .utils import flops_to_string, params_to_string
2121

2222

@@ -72,7 +72,7 @@ def reset_environment():
7272

7373
except Exception as e:
7474
print("Flops estimation was not finished successfully because of"
75-
f" the following exception:\n{type(e)} : {e}")
75+
f" the following exception: \n{type(e)}: {e}")
7676
traceback.print_exc()
7777
reset_environment()
7878

ptflops/pytorch_ops.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def bn_flops_counter_hook(module, input, output):
5757
module.__flops__ += int(batch_flops)
5858

5959

60-
def conv_flops_counter_hook(conv_module, input, output, extra_per_position_flops=0, transpose=False):
60+
def conv_flops_counter_hook(conv_module, input, output, extra_per_position_flops=0,
61+
transpose=False):
6162
# Can have multiple inputs, getting the first one
6263
input = input[0]
6364

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ classifiers = [
2626

2727
[project.optional-dependencies]
2828
dev = [
29-
"flake8==3.8.1",
29+
"flake8==5.0.1",
3030
"flake8-import-order==0.18.1",
3131
"isort==4.3.21",
3232
"torchvision>=0.5.0",

0 commit comments

Comments
 (0)