Skip to content

Commit 8410140

Browse files
authored
Merge pull request #711 from ketch/no_py2
Drop support for Python 2, removing imports of six and __future__.
2 parents 16b85ff + a65eb5e commit 8410140

File tree

107 files changed

+16
-186
lines changed

Some content is hidden

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

107 files changed

+16
-186
lines changed

examples/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
from .advection_1d import advection_1d
32
from .acoustics_1d_homogeneous import acoustics_1d
43
from .acoustics_2d_homogeneous import acoustics_2d

examples/acoustics_1d_homogeneous/acoustics_1d.py

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
The final solution is identical to the initial data because both waves have
1919
crossed the domain exactly once.
2020
"""
21-
from __future__ import absolute_import
2221
from numpy import sqrt, exp, cos
2322
from clawpack import riemann
2423

examples/acoustics_1d_homogeneous/test_acoustics.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
31

42
def test_1d_acoustics():
53
"""test_1d_acoustics

examples/acoustics_2d_homogeneous/acoustics_2d.py

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
Here p is the pressure, (u,v) is the velocity, K is the bulk modulus,
1515
and :math:`\rho` is the density.
1616
"""
17-
from __future__ import absolute_import
1817
from clawpack import riemann
1918
import numpy as np
2019

examples/acoustics_2d_homogeneous/test_2d_acoustics.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
def test_2d_acoustics():
32
"""test_2d_acoustics"""
43

examples/acoustics_2d_mapped/acoustics_2d_inclusions.py

-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
This example shows how to solve a problem with variable coefficients on a mapped grid.
1818
The domain contains circular inclusions with different acoustic properties.
1919
"""
20-
from __future__ import absolute_import
2120
import numpy as np
22-
from six.moves import range
2321

2422
# Circle radius, square radius, circle center:
2523
# ((r1, r2), (x0, y0))

examples/acoustics_2d_mapped/test_acoustics_2d_mapped.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
def test_acoustics_2d_variable():
32
"""Test variable-coefficient 2D acoustics on mapped grids"""
43

examples/acoustics_2d_variable/acoustics_2d_interface.py

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
The left and right halves of the domain consist of different materials.
1919
"""
2020

21-
from __future__ import absolute_import
2221
import numpy as np
2322

2423
def setup(kernel_language='Fortran', use_petsc=False, outdir='./_output',

examples/acoustics_2d_variable/test_acoustics_2d_variable.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
def test_acoustics_2d_variable():
32
"""Test variable-coefficient 2D acoustics"""
43

examples/acoustics_2d_variable/test_acoustics_2d_variable_io.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
from __future__ import print_function
31
def test_acoustics_2d_variable_io():
42
"""Test I/O on variable-coefficient 2D acoustics application"""
53

examples/acoustics_3d_variable/acoustics_3d_interface.py

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
The left and right halves of the domain consist of different materials.
2020
"""
2121

22-
from __future__ import absolute_import
2322
import numpy as np
2423

2524
def setup(use_petsc=False,outdir='./_output',solver_type='classic',

examples/acoustics_3d_variable/test_3d_acoustics.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
import os
32
from itertools import chain
43

examples/advection_1d/advection_1d.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
The final solution is identical to the initial data because the wave has
1717
crossed the domain exactly once.
1818
"""
19-
from __future__ import absolute_import
2019
import numpy as np
2120
from clawpack import riemann
2221

examples/advection_1d/advection_1d_nonunif.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
crossed the domain exactly once, which takes computational time 0.5, because the speed is 1 and grid length 0.5.
1818
"""
1919

20-
from __future__ import absolute_import
2120
import numpy as np
2221
from clawpack import riemann
2322

examples/advection_1d/test_advection.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
def test_1d_advection():
32
"""test_1d_advection
43

examples/advection_1d/test_advection_nonunif.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
def test_1d_advection():
32
"""test_1d_advection
43

examples/advection_1d_variable/variable_coefficient_advection.py

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"""
2121

2222

23-
from __future__ import absolute_import
2423
import numpy as np
2524

2625
def qinit(state):

examples/advection_2d/advection_2d.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
Here q is a conserved quantity, and (u,v) is the velocity vector.
1313
"""
1414

15-
from __future__ import absolute_import
1615
import numpy as np
1716
from clawpack import riemann
1817

examples/advection_2d_annulus/advection_annulus.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
This is the simplest example that shows how to use a mapped grid in PyClaw.
1818
However, it doesn't use a mapped-grid Riemann solver.
1919
"""
20-
from __future__ import absolute_import
2120
import numpy as np
2221

2322
def mapc2p_annulus(xc, yc):

examples/advection_2d_annulus/mapc2p.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
3-
from __future__ import absolute_import
41
def mapc2p(xc,yc):
52
"""
63
Specifies the mapping to curvilinear coordinates

examples/advection_reaction_2d/advection_reaction.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
This example also shows how to use your own Riemann solver.
1717
"""
1818

19-
from __future__ import absolute_import
2019
import numpy as np
2120
import os
2221

examples/advection_reaction_2d/setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# How to use this file
44
# python setup.py build_ext -i
55

6-
from __future__ import absolute_import
76
import os
87
from os.path import join as pjoin
98
from os.path import pardir as pardir

examples/advection_reaction_2d/test_advection_reaction.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
def test_advection_reaction():
32
""" tests against expected sharpclaw results """
43
from clawpack.pyclaw.examples.advection_reaction_2d import advection_reaction

examples/burgers_1d/burgers_1d.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
The initial condition is sinusoidal, but after a short time a shock forms
1717
(due to the nonlinearity).
1818
"""
19-
from __future__ import absolute_import
2019
import numpy as np
2120
from clawpack import riemann
2221

examples/compare_solvers.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#!/usr/bin/env python
22
# encoding: utf-8
33

4-
from __future__ import absolute_import
5-
from __future__ import print_function
64
from clawpack import pyclaw
75
import numpy as np
86
import logging
9-
import six
107

118
def debug_loggers():
129
"""
@@ -91,7 +88,7 @@ def compare_1D(nx=1000):
9188

9289
times, tests = {}, {}
9390

94-
for name, solver in six.iteritems(solvers):
91+
for name, solver in solvers.items():
9592
solver.bc_lower[0] = pyclaw.BC.periodic
9693
solver.bc_upper[0] = pyclaw.BC.periodic
9794

@@ -127,7 +124,7 @@ def compare_2D(nx=(250,250)):
127124

128125
times, tests = {}, {}
129126

130-
for name, solver in six.iteritems(solvers):
127+
for name, solver in solvers.items():
131128
solver.num_waves = 3
132129
solver.bc_lower[0] = pyclaw.BC.extrap
133130
solver.bc_upper[0] = pyclaw.BC.wall

examples/cubic_1d/cubic.py

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
This is a scalar nonlinear conservation law which is often used as a simple
1414
example for problems with non-convex flux functions.
1515
"""
16-
from __future__ import absolute_import
1716
import numpy as np
1817
from clawpack import riemann
1918

examples/cubic_1d/test_cubic.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"Runs the test problem."
2-
from __future__ import absolute_import
32

43
def test_cubic():
54
import numpy as np

examples/euler_1d/setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# How to use this file
44
# python setup.py build_ext -i
55

6-
from __future__ import absolute_import
76
import os
87
from os.path import join as pjoin
98
from os.path import pardir as pardir

examples/euler_1d/shocksine.py

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
- How to use characteristic decomposition with an evec() routine in SharpClaw
2323
"""
2424

25-
from __future__ import absolute_import
26-
from __future__ import print_function
2725
import numpy as np
2826
from clawpack import riemann
2927
from clawpack.riemann.euler_with_efix_1D_constants import density, momentum, energy, num_eqn

examples/euler_1d/shocktube.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
1717
This script runs a shock-tube problem.
1818
"""
19-
from __future__ import absolute_import
2019
from clawpack import riemann
2120
from clawpack.riemann.euler_with_efix_1D_constants import density, momentum, energy, num_eqn
2221

examples/euler_1d/test_shocksine.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
def test_shocksine():
32
""" Test shock-sine wave interaction (Euler 1D)"""
43
from . import shocksine

examples/euler_1d/test_shocktube.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"Runs the shocktube test problem with the Python and Fortran HLL solvers."
2-
from __future__ import absolute_import
32

43
def test_shocktube():
54
"Shock tube test (Euler 1D)"

examples/euler_1d/test_woodward_colella_blast.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
def test_woodward_colella_blast():
32
""" Woodward-Colella blast wave test (Euler 1D)"""
43
from . import woodward_colella_blast

examples/euler_1d/woodward_colella_blast.py

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
- How to use a total fluctuation solver in SharpClaw
2323
- How to use characteristic decomposition with an evec() routine in SharpClaw
2424
"""
25-
from __future__ import absolute_import
26-
from __future__ import print_function
2725
from clawpack import riemann
2826
from clawpack.riemann.euler_with_efix_1D_constants import *
2927

examples/euler_2d/euler_2d.py

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
2020
This example shows how to use VisClaw's Iplot class for simple interactive plotting.
2121
"""
22-
from __future__ import absolute_import
2322
from clawpack import pyclaw
2423
from clawpack import riemann
2524
from clawpack.riemann.euler_4wave_2D_constants import density, x_momentum, y_momentum, \

examples/euler_2d/quadrants.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
Liska and Wendroff.
1818
1919
"""
20-
from __future__ import absolute_import
2120
from clawpack import riemann
2221
from clawpack.riemann.euler_4wave_2D_constants import density, x_momentum, y_momentum, \
2322
energy, num_eqn

examples/euler_2d/shock_bubble_interaction.py

-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@
2626
- how to use the auxiliary array for spatially-varying coefficients
2727
"""
2828

29-
from __future__ import absolute_import
3029
import numpy as np
3130
from clawpack import riemann
3231
from clawpack.riemann.euler_5wave_2D_constants import density, x_momentum, y_momentum, \
3332
energy, num_eqn
34-
from six.moves import range
3533

3634
gamma = 1.4 # Ratio of specific heats
3735

examples/euler_2d/shock_forward_step.py

-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
aligned with the grid.
2828
"""
2929

30-
from __future__ import absolute_import
31-
from six.moves import range
32-
3330
gamma = 1.4 # Ratio of specific heats
3431

3532
def incoming_shock(state,dim,t,qbc,auxbc,num_ghost):

examples/euler_2d/test_euler2d_shockbubble.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
def test_2d_euler_shockbubble():
32
"""test_2d_euler_shockbubble"""
43
def verify_classic_shockbubble(controller):

examples/euler_2d/test_quadrants.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"Runs the quadrants test problem with the HLLC solver."
2-
from __future__ import absolute_import
32
import numpy as np
43
import os
54
from . import quadrants

examples/euler_3d/Sedov.py

-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
The primary variables are:
1111
density (rho), x,y, and z momentum (rho*u,rho*v,rho*w), and energy.
1212
"""
13-
from __future__ import absolute_import
1413
import numpy as np
1514
from scipy import integrate
1615
from clawpack import riemann
1716
from clawpack.riemann.euler_3D_constants import density, x_momentum, \
1817
y_momentum, z_momentum, energy, num_eqn
19-
from six.moves import range
2018

2119
gamma = 1.4 # Ratio of Specific Heats
2220

examples/euler_3d/shock_bubble.py

-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
The conserved quantities are:
1717
density (rho), x-,y-, and z-momentum (rho*u,rho*v,rho*w), and energy.
1818
"""
19-
from __future__ import absolute_import
2019
import numpy as np
2120
from scipy import integrate
22-
from six.moves import range
2321

2422
gamma = 1.4 # Ratio of Specific Heats
2523
gamma1 = gamma - 1.

examples/euler_3d/shocktube.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
The primary variables are:
99
density (rho), x,y, and z momentum (rho*u,rho*v,rho*w), and energy.
1010
"""
11-
from __future__ import absolute_import
1211
from clawpack import riemann
1312
from clawpack.riemann.euler_3D_constants import density, x_momentum, \
1413
y_momentum, z_momentum, energy, num_eqn

examples/euler_3d/test_sedov_and_hdf.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
from __future__ import print_function
31
def test_sedov_and_hdf():
42
"""Test HDF I/O on Sedov 3D Euler application"""
53

examples/euler_gravity_3d/plotCreateVisitXDMF.py

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
! files for use visualizing within VisIt (https://visit.llnl.gov).
77
!-----------------------------------------------------------------------
88
"""
9-
from __future__ import absolute_import
10-
from __future__ import print_function
119
import os,sys
1210
import h5py
1311
from numpy import *

examples/euler_gravity_3d/rising_hot_sphere.py

-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010
The primary variables are:
1111
density (rho), x,y, and z momentum (rho*u,rho*v,rho*w), and energy.
1212
"""
13-
from __future__ import absolute_import
14-
from __future__ import print_function
1513
import numpy as np
1614
from mappedGrid import euler3d_mappedgrid as mg
17-
from six.moves import range
1815

1916
try:
2017
from mpi4py import MPI

examples/euler_gravity_3d/rising_hot_sphere_spherical.py

-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010
The primary variables are:
1111
density (rho), x,y, and z momentum (rho*u,rho*v,rho*w), and energy.
1212
"""
13-
from __future__ import absolute_import
14-
from __future__ import print_function
1513
import numpy as np
1614
from mappedGrid import euler3d_mappedgrid as mg
17-
from six.moves import range
1815

1916
# Test for MPI, and set sizes accordingly
2017
try:

examples/euler_gravity_3d/test_rising_hot_sphere.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
def test_euler_3d_rising_hot_sphere():
32
"""test_euler_3d_rising_hot_sphere"""
43
def verify_classic_rising_hot_sphere(controller):

examples/euler_gravity_3d/visitHDF5XDMF.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
! HDF5 and XDMF routines for creating output files for VisIt.
77
!-----------------------------------------------------------------------
88
"""
9-
from __future__ import absolute_import
109
import os,sys
1110
import h5py
1211
from numpy import *

examples/iso_c_advection/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
from __future__ import absolute_import
21
from .iso_c_solver import ISO_C_ClawSolver1D
32
from .iso_c_advection import iso_c_rp1_advection

0 commit comments

Comments
 (0)