Skip to content

Commit 0e5ca9f

Browse files
authored
Fix more pylint warnings (#143)
Fix a spurious divide-by-zero error in sedov_compare.py and gauss_diffusion_compare.py that pylint found. Most of the other fixes are for `unused-variable`, plus some instances of `consider-using-enumerate`, `consider-using-dict-items`, `consider-iterating-dictionary`, `use-dict-literal`, `useless-object-inheritance`, and `unneeded-not`. Also disable `pointless-string-statement`, since these are used for block comments in a couple places.
1 parent bf48f28 commit 0e5ca9f

24 files changed

Lines changed: 34 additions & 33 deletions

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ disable = [
2020
"missing-class-docstring",
2121
"missing-function-docstring",
2222
"missing-module-docstring",
23+
"pointless-string-statement",
2324
]
2425
enable = [
2526
"useless-suppression",

pyro/advection/simulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def dovis(self):
106106

107107
myg = self.cc_data.grid
108108

109-
_, axes, cbar_title = plot_tools.setup_axes(myg, 1)
109+
_, axes, _ = plot_tools.setup_axes(myg, 1)
110110

111111
# plot density
112112
ax = axes[0]

pyro/advection_nonuniform/simulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def dovis(self):
131131

132132
myg = self.cc_data.grid
133133

134-
_, axes, cbar_title = plot_tools.setup_axes(myg, 1)
134+
_, axes, _ = plot_tools.setup_axes(myg, 1)
135135

136136
# plot density
137137
ax = axes[0]

pyro/analysis/convergence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def compare(fine, coarse):
2727

2828
if __name__ == "__main__":
2929

30-
if not len(sys.argv) == 3:
30+
if len(sys.argv) != 3:
3131
print(usage)
3232
sys.exit(2)
3333

pyro/analysis/dam_compare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def abort(string):
2424
sys.exit(2)
2525

2626

27-
if not len(sys.argv) == 2:
27+
if len(sys.argv) != 2:
2828
print(usage)
2929
sys.exit(2)
3030

pyro/analysis/gauss_diffusion_compare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def process(file):
8888
# now bin the associated data
8989
phi_bin = np.zeros(len(ncount)-1, dtype=np.float64)
9090

91-
for n in range(len(ncount)):
91+
for n in range(1, len(ncount)):
9292

9393
# remember that there are no whichbin == 0, since that
9494
# corresponds to the left edge. So we want whichbin == 1 to
@@ -106,7 +106,7 @@ def process(file):
106106

107107
if __name__ == "__main__":
108108

109-
if not len(sys.argv) >= 2:
109+
if len(sys.argv) < 2:
110110
print(usage)
111111
sys.exit(2)
112112

pyro/analysis/incomp_converge_error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"""
1717

1818

19-
if not len(sys.argv) == 2:
19+
if len(sys.argv) != 2:
2020
print(usage)
2121
sys.exit(2)
2222

pyro/analysis/sedov_compare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
u_bin = np.zeros(len(ncount)-1, dtype=np.float64)
101101
p_bin = np.zeros(len(ncount)-1, dtype=np.float64)
102102

103-
for n in range(len(ncount)):
103+
for n in range(1, len(ncount)):
104104

105105
# remember that there are no whichbin == 0, since that corresponds
106106
# to the left edge. So we want whichbin == 1 to correspond to the

pyro/analysis/smooth_error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
usage: ./smooth_error.py file
1717
"""
1818

19-
if not len(sys.argv) == 2:
19+
if len(sys.argv) != 2:
2020
print(usage)
2121
sys.exit(2)
2222

pyro/analysis/sod_compare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def abort(string):
2121
sys.exit(2)
2222

2323

24-
if not len(sys.argv) == 2:
24+
if len(sys.argv) != 2:
2525
print(usage)
2626
sys.exit(2)
2727

0 commit comments

Comments
 (0)