Skip to content

Commit 7c84253

Browse files
authored
run pyupgrade and fix name clashes (#110)
in particular, profile and io should be renamed to not clash with python modules
1 parent 80f6b46 commit 7c84253

47 files changed

Lines changed: 100 additions & 137 deletions

Some content is hidden

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

advection/simulation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def initialize(self):
3838
self.particles = particles.Particles(self.cc_data, bc, n_particles, particle_generator)
3939

4040
# now set the initial conditions for the problem
41-
problem = importlib.import_module("advection.problems.{}".format(self.problem_name))
41+
problem = importlib.import_module(f"advection.problems.{self.problem_name}")
4242
problem.init_data(self.cc_data, self.rp)
4343

4444
def method_compute_timestep(self):
@@ -141,7 +141,7 @@ def dovis(self):
141141
ax.set_xlim([myg.xmin, myg.xmax])
142142
ax.set_ylim([myg.ymin, myg.ymax])
143143

144-
plt.figtext(0.05, 0.0125, "t = {:10.5f}".format(self.cc_data.t))
144+
plt.figtext(0.05, 0.0125, f"t = {self.cc_data.t:10.5f}")
145145

146146
plt.pause(0.001)
147147
plt.draw()

advection_fv4/simulation.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import print_function
2-
31
import importlib
42
import advection_rk
53
import advection_fv4.fluxes as flx
@@ -33,7 +31,7 @@ def initialize(self):
3331
self.particles = particles.Particles(self.cc_data, bc, n_particles, particle_generator)
3432

3533
# now set the initial conditions for the problem
36-
problem = importlib.import_module("advection_fv4.problems.{}".format(self.problem_name))
34+
problem = importlib.import_module(f"advection_fv4.problems.{self.problem_name}")
3735
problem.init_data(self.cc_data, self.rp)
3836

3937
def substep(self, myd):

advection_nonuniform/simulation.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import print_function
2-
31
import importlib
42
import numpy as np
53
import matplotlib
@@ -61,7 +59,7 @@ def shift(velocity):
6159
self.particles = particles.Particles(self.cc_data, bc, n_particles, particle_generator)
6260

6361
# now set the initial conditions for the problem
64-
problem = importlib.import_module("advection_nonuniform.problems.{}".format(self.problem_name))
62+
problem = importlib.import_module(f"advection_nonuniform.problems.{self.problem_name}")
6563
problem.init_data(self.cc_data, self.rp)
6664

6765
# compute the required shift for each node using corresponding velocity at the node
@@ -168,7 +166,7 @@ def dovis(self):
168166
ax.set_xlim([myg.xmin, myg.xmax])
169167
ax.set_ylim([myg.ymin, myg.ymax])
170168

171-
plt.figtext(0.05, 0.0125, "t = {:10.5f}".format(self.cc_data.t))
169+
plt.figtext(0.05, 0.0125, f"t = {self.cc_data.t:10.5f}")
172170

173171
plt.pause(0.001)
174172
plt.draw()

advection_rk/simulation.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import print_function
2-
31
import advection
42
import advection_rk.fluxes as flx
53
import mesh.integration as integration

advection_weno/simulation.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import print_function
2-
31
import advection
42
import advection_weno.fluxes as flx
53
import mesh.integration as integration

analysis/convergence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

33
import sys
4-
import util.io as io
4+
import util.io_pyro as io
55
import numpy as np
66

77
# read in two files -- one twice the resolution of the other, and

analysis/dam_compare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env python3
22

3-
from __future__ import print_function
43

54
import numpy as np
65
from scipy.optimize import brentq
76
import sys
87
import os
98
import matplotlib.pyplot as plt
10-
from util import msg, runparams, io
9+
from util import msg, runparams
10+
import util.io_pyro as io
1111

1212
usage = """
1313
compare the output for a dam problem with the exact solution contained

analysis/gauss_diffusion_compare.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/usr/bin/env python3
22

3-
from __future__ import print_function
43

54
import numpy as np
65
import sys
76
import matplotlib.pyplot as plt
87
import diffusion.problems.gaussian as gaussian
9-
from util import io
8+
import util.io_pyro as io
109
import matplotlib as mpl
1110

1211
mpl.rcParams["text.usetex"] = True

analysis/incomp_converge_error.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/usr/bin/env python3
22

3-
from __future__ import print_function
43

54
import numpy as np
65
import sys
76
import math
8-
from util import io
7+
import util.io_pyro as io
98

109
usage = """
1110
compare the output in file from the incompressible converge problem to

analysis/plot_thumbnail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44
import matplotlib.pyplot as plt
55
import sys
6-
from util import io
6+
import util.io_pyro as io
77

88
# plot an output file using the solver's dovis script
99

0 commit comments

Comments
 (0)