Skip to content

Commit

Permalink
Merge pull request #711 from ketch/no_py2
Browse files Browse the repository at this point in the history
Drop support for Python 2, removing imports of six and __future__.
  • Loading branch information
mandli authored Nov 2, 2023
2 parents 16b85ff + a65eb5e commit 8410140
Show file tree
Hide file tree
Showing 107 changed files with 16 additions and 186 deletions.
1 change: 0 additions & 1 deletion examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
from .advection_1d import advection_1d
from .acoustics_1d_homogeneous import acoustics_1d
from .acoustics_2d_homogeneous import acoustics_2d
Expand Down
1 change: 0 additions & 1 deletion examples/acoustics_1d_homogeneous/acoustics_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
The final solution is identical to the initial data because both waves have
crossed the domain exactly once.
"""
from __future__ import absolute_import
from numpy import sqrt, exp, cos
from clawpack import riemann

Expand Down
2 changes: 0 additions & 2 deletions examples/acoustics_1d_homogeneous/test_acoustics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import


def test_1d_acoustics():
"""test_1d_acoustics
Expand Down
1 change: 0 additions & 1 deletion examples/acoustics_2d_homogeneous/acoustics_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Here p is the pressure, (u,v) is the velocity, K is the bulk modulus,
and :math:`\rho` is the density.
"""
from __future__ import absolute_import
from clawpack import riemann
import numpy as np

Expand Down
1 change: 0 additions & 1 deletion examples/acoustics_2d_homogeneous/test_2d_acoustics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
def test_2d_acoustics():
"""test_2d_acoustics"""

Expand Down
2 changes: 0 additions & 2 deletions examples/acoustics_2d_mapped/acoustics_2d_inclusions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
This example shows how to solve a problem with variable coefficients on a mapped grid.
The domain contains circular inclusions with different acoustic properties.
"""
from __future__ import absolute_import
import numpy as np
from six.moves import range

# Circle radius, square radius, circle center:
# ((r1, r2), (x0, y0))
Expand Down
1 change: 0 additions & 1 deletion examples/acoustics_2d_mapped/test_acoustics_2d_mapped.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
def test_acoustics_2d_variable():
"""Test variable-coefficient 2D acoustics on mapped grids"""

Expand Down
1 change: 0 additions & 1 deletion examples/acoustics_2d_variable/acoustics_2d_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
The left and right halves of the domain consist of different materials.
"""

from __future__ import absolute_import
import numpy as np

def setup(kernel_language='Fortran', use_petsc=False, outdir='./_output',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
def test_acoustics_2d_variable():
"""Test variable-coefficient 2D acoustics"""

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

Expand Down
1 change: 0 additions & 1 deletion examples/acoustics_3d_variable/acoustics_3d_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
The left and right halves of the domain consist of different materials.
"""

from __future__ import absolute_import
import numpy as np

def setup(use_petsc=False,outdir='./_output',solver_type='classic',
Expand Down
1 change: 0 additions & 1 deletion examples/acoustics_3d_variable/test_3d_acoustics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
import os
from itertools import chain

Expand Down
1 change: 0 additions & 1 deletion examples/advection_1d/advection_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
The final solution is identical to the initial data because the wave has
crossed the domain exactly once.
"""
from __future__ import absolute_import
import numpy as np
from clawpack import riemann

Expand Down
1 change: 0 additions & 1 deletion examples/advection_1d/advection_1d_nonunif.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
crossed the domain exactly once, which takes computational time 0.5, because the speed is 1 and grid length 0.5.
"""

from __future__ import absolute_import
import numpy as np
from clawpack import riemann

Expand Down
1 change: 0 additions & 1 deletion examples/advection_1d/test_advection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
def test_1d_advection():
"""test_1d_advection
Expand Down
1 change: 0 additions & 1 deletion examples/advection_1d/test_advection_nonunif.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
def test_1d_advection():
"""test_1d_advection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"""


from __future__ import absolute_import
import numpy as np

def qinit(state):
Expand Down
1 change: 0 additions & 1 deletion examples/advection_2d/advection_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
Here q is a conserved quantity, and (u,v) is the velocity vector.
"""

from __future__ import absolute_import
import numpy as np
from clawpack import riemann

Expand Down
1 change: 0 additions & 1 deletion examples/advection_2d_annulus/advection_annulus.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
This is the simplest example that shows how to use a mapped grid in PyClaw.
However, it doesn't use a mapped-grid Riemann solver.
"""
from __future__ import absolute_import
import numpy as np

def mapc2p_annulus(xc, yc):
Expand Down
3 changes: 0 additions & 3 deletions examples/advection_2d_annulus/mapc2p.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@


from __future__ import absolute_import
def mapc2p(xc,yc):
"""
Specifies the mapping to curvilinear coordinates
Expand Down
1 change: 0 additions & 1 deletion examples/advection_reaction_2d/advection_reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
This example also shows how to use your own Riemann solver.
"""

from __future__ import absolute_import
import numpy as np
import os

Expand Down
1 change: 0 additions & 1 deletion examples/advection_reaction_2d/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# How to use this file
# python setup.py build_ext -i

from __future__ import absolute_import
import os
from os.path import join as pjoin
from os.path import pardir as pardir
Expand Down
1 change: 0 additions & 1 deletion examples/advection_reaction_2d/test_advection_reaction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
def test_advection_reaction():
""" tests against expected sharpclaw results """
from clawpack.pyclaw.examples.advection_reaction_2d import advection_reaction
Expand Down
1 change: 0 additions & 1 deletion examples/burgers_1d/burgers_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
The initial condition is sinusoidal, but after a short time a shock forms
(due to the nonlinearity).
"""
from __future__ import absolute_import
import numpy as np
from clawpack import riemann

Expand Down
7 changes: 2 additions & 5 deletions examples/compare_solvers.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#!/usr/bin/env python
# encoding: utf-8

from __future__ import absolute_import
from __future__ import print_function
from clawpack import pyclaw
import numpy as np
import logging
import six

def debug_loggers():
"""
Expand Down Expand Up @@ -91,7 +88,7 @@ def compare_1D(nx=1000):

times, tests = {}, {}

for name, solver in six.iteritems(solvers):
for name, solver in solvers.items():
solver.bc_lower[0] = pyclaw.BC.periodic
solver.bc_upper[0] = pyclaw.BC.periodic

Expand Down Expand Up @@ -127,7 +124,7 @@ def compare_2D(nx=(250,250)):

times, tests = {}, {}

for name, solver in six.iteritems(solvers):
for name, solver in solvers.items():
solver.num_waves = 3
solver.bc_lower[0] = pyclaw.BC.extrap
solver.bc_upper[0] = pyclaw.BC.wall
Expand Down
1 change: 0 additions & 1 deletion examples/cubic_1d/cubic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
This is a scalar nonlinear conservation law which is often used as a simple
example for problems with non-convex flux functions.
"""
from __future__ import absolute_import
import numpy as np
from clawpack import riemann

Expand Down
1 change: 0 additions & 1 deletion examples/cubic_1d/test_cubic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"Runs the test problem."
from __future__ import absolute_import

def test_cubic():
import numpy as np
Expand Down
1 change: 0 additions & 1 deletion examples/euler_1d/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# How to use this file
# python setup.py build_ext -i

from __future__ import absolute_import
import os
from os.path import join as pjoin
from os.path import pardir as pardir
Expand Down
2 changes: 0 additions & 2 deletions examples/euler_1d/shocksine.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
- How to use characteristic decomposition with an evec() routine in SharpClaw
"""

from __future__ import absolute_import
from __future__ import print_function
import numpy as np
from clawpack import riemann
from clawpack.riemann.euler_with_efix_1D_constants import density, momentum, energy, num_eqn
Expand Down
1 change: 0 additions & 1 deletion examples/euler_1d/shocktube.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
This script runs a shock-tube problem.
"""
from __future__ import absolute_import
from clawpack import riemann
from clawpack.riemann.euler_with_efix_1D_constants import density, momentum, energy, num_eqn

Expand Down
1 change: 0 additions & 1 deletion examples/euler_1d/test_shocksine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
def test_shocksine():
""" Test shock-sine wave interaction (Euler 1D)"""
from . import shocksine
Expand Down
1 change: 0 additions & 1 deletion examples/euler_1d/test_shocktube.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"Runs the shocktube test problem with the Python and Fortran HLL solvers."
from __future__ import absolute_import

def test_shocktube():
"Shock tube test (Euler 1D)"
Expand Down
1 change: 0 additions & 1 deletion examples/euler_1d/test_woodward_colella_blast.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
def test_woodward_colella_blast():
""" Woodward-Colella blast wave test (Euler 1D)"""
from . import woodward_colella_blast
Expand Down
2 changes: 0 additions & 2 deletions examples/euler_1d/woodward_colella_blast.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
- How to use a total fluctuation solver in SharpClaw
- How to use characteristic decomposition with an evec() routine in SharpClaw
"""
from __future__ import absolute_import
from __future__ import print_function
from clawpack import riemann
from clawpack.riemann.euler_with_efix_1D_constants import *

Expand Down
1 change: 0 additions & 1 deletion examples/euler_2d/euler_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
This example shows how to use VisClaw's Iplot class for simple interactive plotting.
"""
from __future__ import absolute_import
from clawpack import pyclaw
from clawpack import riemann
from clawpack.riemann.euler_4wave_2D_constants import density, x_momentum, y_momentum, \
Expand Down
1 change: 0 additions & 1 deletion examples/euler_2d/quadrants.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
Liska and Wendroff.
"""
from __future__ import absolute_import
from clawpack import riemann
from clawpack.riemann.euler_4wave_2D_constants import density, x_momentum, y_momentum, \
energy, num_eqn
Expand Down
2 changes: 0 additions & 2 deletions examples/euler_2d/shock_bubble_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@
- how to use the auxiliary array for spatially-varying coefficients
"""

from __future__ import absolute_import
import numpy as np
from clawpack import riemann
from clawpack.riemann.euler_5wave_2D_constants import density, x_momentum, y_momentum, \
energy, num_eqn
from six.moves import range

gamma = 1.4 # Ratio of specific heats

Expand Down
3 changes: 0 additions & 3 deletions examples/euler_2d/shock_forward_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
aligned with the grid.
"""

from __future__ import absolute_import
from six.moves import range

gamma = 1.4 # Ratio of specific heats

def incoming_shock(state,dim,t,qbc,auxbc,num_ghost):
Expand Down
1 change: 0 additions & 1 deletion examples/euler_2d/test_euler2d_shockbubble.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
def test_2d_euler_shockbubble():
"""test_2d_euler_shockbubble"""
def verify_classic_shockbubble(controller):
Expand Down
1 change: 0 additions & 1 deletion examples/euler_2d/test_quadrants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"Runs the quadrants test problem with the HLLC solver."
from __future__ import absolute_import
import numpy as np
import os
from . import quadrants
Expand Down
2 changes: 0 additions & 2 deletions examples/euler_3d/Sedov.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
The primary variables are:
density (rho), x,y, and z momentum (rho*u,rho*v,rho*w), and energy.
"""
from __future__ import absolute_import
import numpy as np
from scipy import integrate
from clawpack import riemann
from clawpack.riemann.euler_3D_constants import density, x_momentum, \
y_momentum, z_momentum, energy, num_eqn
from six.moves import range

gamma = 1.4 # Ratio of Specific Heats

Expand Down
2 changes: 0 additions & 2 deletions examples/euler_3d/shock_bubble.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
The conserved quantities are:
density (rho), x-,y-, and z-momentum (rho*u,rho*v,rho*w), and energy.
"""
from __future__ import absolute_import
import numpy as np
from scipy import integrate
from six.moves import range

gamma = 1.4 # Ratio of Specific Heats
gamma1 = gamma - 1.
Expand Down
1 change: 0 additions & 1 deletion examples/euler_3d/shocktube.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
The primary variables are:
density (rho), x,y, and z momentum (rho*u,rho*v,rho*w), and energy.
"""
from __future__ import absolute_import
from clawpack import riemann
from clawpack.riemann.euler_3D_constants import density, x_momentum, \
y_momentum, z_momentum, energy, num_eqn
Expand Down
2 changes: 0 additions & 2 deletions examples/euler_3d/test_sedov_and_hdf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import
from __future__ import print_function
def test_sedov_and_hdf():
"""Test HDF I/O on Sedov 3D Euler application"""

Expand Down
2 changes: 0 additions & 2 deletions examples/euler_gravity_3d/plotCreateVisitXDMF.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
! files for use visualizing within VisIt (https://visit.llnl.gov).
!-----------------------------------------------------------------------
"""
from __future__ import absolute_import
from __future__ import print_function
import os,sys
import h5py
from numpy import *
Expand Down
3 changes: 0 additions & 3 deletions examples/euler_gravity_3d/rising_hot_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
The primary variables are:
density (rho), x,y, and z momentum (rho*u,rho*v,rho*w), and energy.
"""
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
from mappedGrid import euler3d_mappedgrid as mg
from six.moves import range

try:
from mpi4py import MPI
Expand Down
3 changes: 0 additions & 3 deletions examples/euler_gravity_3d/rising_hot_sphere_spherical.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
The primary variables are:
density (rho), x,y, and z momentum (rho*u,rho*v,rho*w), and energy.
"""
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
from mappedGrid import euler3d_mappedgrid as mg
from six.moves import range

# Test for MPI, and set sizes accordingly
try:
Expand Down
1 change: 0 additions & 1 deletion examples/euler_gravity_3d/test_rising_hot_sphere.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import
def test_euler_3d_rising_hot_sphere():
"""test_euler_3d_rising_hot_sphere"""
def verify_classic_rising_hot_sphere(controller):
Expand Down
1 change: 0 additions & 1 deletion examples/euler_gravity_3d/visitHDF5XDMF.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
! HDF5 and XDMF routines for creating output files for VisIt.
!-----------------------------------------------------------------------
"""
from __future__ import absolute_import
import os,sys
import h5py
from numpy import *
Expand Down
1 change: 0 additions & 1 deletion examples/iso_c_advection/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from __future__ import absolute_import
from .iso_c_solver import ISO_C_ClawSolver1D
from .iso_c_advection import iso_c_rp1_advection
Loading

0 comments on commit 8410140

Please sign in to comment.