Skip to content

Commit d047b16

Browse files
committed
flake8 compatibility
1 parent b295e9d commit d047b16

File tree

51 files changed

+83
-86
lines changed

Some content is hidden

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

51 files changed

+83
-86
lines changed

.flake8

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[flake8]
2+
max-line-length = 120
3+
ignore = E741, E402, W504, W605
4+
per-file-ignores =
5+
pySDC/tutorial/step_6/C_MPI_parallelization.py:F401,
6+
pySDC/projects/Hamiltonian/solar_system.py:F401
7+
exclude =
8+
playgrounds
9+
tests

pySDC/helpers/transfer_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def border_padding(grid, l, r, pad_type='mirror'):
266266

267267
assert l < grid.size and r < grid.size
268268
padded_arr = np.zeros(grid.size + l + r)
269-
if pad_type is 'mirror':
269+
if pad_type == 'mirror':
270270
for i in range(l):
271271
padded_arr[i] = 2 * grid[0] - grid[l - i]
272272
for j in range(r):

pySDC/helpers/visualization_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ def show_residual_across_simulation(stats, fname='residuals.png'):
6565
ax.set_xticklabels(np.arange(maxiter) + 1, minor=False)
6666
ax.set_yticklabels(np.arange(maxprocs + 1), minor=False)
6767

68-
plt.savefig(fname, transparent=True, bbox_inches='tight')
68+
plt.savefig(fname, transparent=True, bbox_inches='tight')

pySDC/implementations/controller_classes/controller_nonMPI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,15 +675,15 @@ def default(local_MS_running):
675675
raise ControllerError('Unknown stage, got %s' % local_MS_running[0].status.stage) # TODO
676676

677677
# if all stages are the same (or DONE), continue, otherwise abort
678-
stages = [S.status.stage for S in local_MS_active if S.status.stage is not 'DONE']
678+
stages = [S.status.stage for S in local_MS_active if S.status.stage != 'DONE']
679679
if stages[1:] == stages[:-1]:
680680
stage = stages[0]
681681
else:
682682
raise ControllerError('not all stages are equal')
683683

684684
self.logger.debug(stage)
685685

686-
MS_running = [S for S in local_MS_active if S.status.stage is not 'DONE']
686+
MS_running = [S for S in local_MS_active if S.status.stage != 'DONE']
687687

688688
switcher = {
689689
'SPREAD': spread,

pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import numpy as np
2-
from mpi4py import MPI
32
from mpi4py_fft import PFFT
43

54
from pySDC.core.Errors import ParameterError, ProblemError

pySDC/implementations/problem_classes/FullSolarSystem.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,26 @@ def u_exact(self, t):
5151
# initial positions and velocities taken from
5252
# https://www.aanda.org/articles/aa/full/2002/08/aa1405/aa1405.right.html
5353
me.pos[:, 0] = [0.0, 0.0, 0.0]
54-
me.pos[:, 1] = [-2.503321047836E-01, +1.873217481656E-01, +1.260230112145E-01]
55-
me.pos[:, 2] = [+1.747780055994E-02, -6.624210296743E-01, -2.991203277122E-01]
56-
me.pos[:, 3] = [-9.091916173950E-01, +3.592925969244E-01, +1.557729610506E-01]
57-
me.pos[:, 4] = [+1.203018828754E+00, +7.270712989688E-01, +3.009561427569E-01]
58-
me.pos[:, 5] = [+3.733076999471E+00, +3.052424824299E+00, +1.217426663570E+00]
54+
me.pos[:, 1] = [-2.503321047836E-01, +1.873217481656E-01, +1.260230112145E-01]
55+
me.pos[:, 2] = [+1.747780055994E-02, -6.624210296743E-01, -2.991203277122E-01]
56+
me.pos[:, 3] = [-9.091916173950E-01, +3.592925969244E-01, +1.557729610506E-01]
57+
me.pos[:, 4] = [+1.203018828754E+00, +7.270712989688E-01, +3.009561427569E-01]
58+
me.pos[:, 5] = [+3.733076999471E+00, +3.052424824299E+00, +1.217426663570E+00]
5959
me.pos[:, 6] = [+6.164433062913E+00, +6.366775402981E+00, +2.364531109847E+00]
60-
me.pos[:, 7] = [+1.457964661868E+01, -1.236891078519E+01, -5.623617280033E+00]
61-
me.pos[:, 8] = [+1.695491139909E+01, -2.288713988623E+01, -9.789921035251E+00]
60+
me.pos[:, 7] = [+1.457964661868E+01, -1.236891078519E+01, -5.623617280033E+00]
61+
me.pos[:, 8] = [+1.695491139909E+01, -2.288713988623E+01, -9.789921035251E+00]
6262
me.pos[:, 9] = [-9.707098450131E+00, -2.804098175319E+01, -5.823808919246E+00]
6363

6464
me.vel[:, 0] = [0.0, 0.0, 0.0]
6565
me.vel[:, 1] = [-2.438808424736E-02, -1.850224608274E-02, -7.353811537540E-03]
6666
me.vel[:, 2] = [+2.008547034175E-02, +8.365454832702E-04, -8.947888514893E-04]
67-
me.vel[:, 3] = [-7.085843239142E-03, -1.455634327653E-02, -6.310912842359E-03]
68-
me.vel[:, 4] = [-7.124453943885E-03, +1.166307407692E-02, +5.542098698449E-03]
69-
me.vel[:, 5] = [-5.086540617947E-03, +5.493643783389E-03, +2.478685100749E-03]
67+
me.vel[:, 3] = [-7.085843239142E-03, -1.455634327653E-02, -6.310912842359E-03]
68+
me.vel[:, 4] = [-7.124453943885E-03, +1.166307407692E-02, +5.542098698449E-03]
69+
me.vel[:, 5] = [-5.086540617947E-03, +5.493643783389E-03, +2.478685100749E-03]
7070
me.vel[:, 6] = [-4.426823593779E-03, +3.394060157503E-03, +1.592261423092E-03]
7171
me.vel[:, 7] = [+2.647505630327E-03, +2.487457379099E-03, +1.052000252243E-03]
72-
me.vel[:, 8] = [+2.568651772461E-03, +1.681832388267E-03, +6.245613982833E-04]
73-
me.vel[:, 9] = [+3.034112963576E-03, -1.111317562971E-03, -1.261841468083E-03]
72+
me.vel[:, 8] = [+2.568651772461E-03, +1.681832388267E-03, +6.245613982833E-04]
73+
me.vel[:, 9] = [+3.034112963576E-03, -1.111317562971E-03, -1.261841468083E-03]
7474

7575
# masses relative to the sun taken from
7676
# https://en.wikipedia.org/wiki/Planetary_mass#Values_from_the_DE405_ephemeris

pySDC/implementations/problem_classes/HeatEquation_ND_FD_forced_periodic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __get_A(N, nu, dx, ndim, order):
9696
stencil = [1 / 90, -3 / 20, 3 / 2, -49 / 18, 3 / 2, -3 / 20, 1 / 90]
9797
zero_pos = 4
9898
elif order == 8:
99-
stencil = [-1 / 560, 8 / 315, -1 / 5, 8 / 5, -205 / 72, 8 / 5, -1 / 5, 8 / 315, -1 / 560]
99+
stencil = [-1 / 560, 8 / 315, -1 / 5, 8 / 5, -205 / 72, 8 / 5, -1 / 5, 8 / 315, -1 / 560]
100100
zero_pos = 5
101101
else:
102102
raise ProblemError(f'wrong order given, has to be 2, 4, 6, or 8, got {order}')

pySDC/implementations/problem_classes/PenningTrap_3D.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def u_init(self):
109109

110110
u = self.dtype_u(((3, N), self.init[1], self.init[2]))
111111

112-
if u0[2][0] is not 1 or u0[3][0] is not 1:
112+
if u0[2][0] != 1 or u0[3][0] != 1:
113113
raise ProblemError('so far only q = m = 1 is implemented')
114114

115115
# set first particle to u0

pySDC/implementations/problem_classes/acoustic_helpers/standard_integrators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import math
2-
from decimal import Decimal
2+
from decimal import Decimal, getcontext
33

44
import numpy as np
55
import scipy.sparse as sp

pySDC/implementations/problem_classes/boussinesq_helpers/standard_integrators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import math
2-
from decimal import Decimal
2+
from decimal import Decimal, getcontext
33

44
import numpy as np
55
import scipy.sparse as sp

0 commit comments

Comments
 (0)