From 84220627a211b4a702bc2434c2a6bb37a9f1e471 Mon Sep 17 00:00:00 2001 From: David Ketcheson Date: Thu, 2 Nov 2023 13:04:49 +0300 Subject: [PATCH] Drop Python 2 support, remove imports of six and __future__ --- dev/fix_maxmx.py | 3 --- dev/tests/run_regression_tests.py | 3 --- dev/tests/run_regression_tests_mandli.py | 3 --- src/python/amrclaw/compare_gauges.py | 3 --- src/python/amrclaw/data.py | 10 +++------- 5 files changed, 3 insertions(+), 19 deletions(-) diff --git a/dev/fix_maxmx.py b/dev/fix_maxmx.py index 4a0174895..89b6e7197 100644 --- a/dev/fix_maxmx.py +++ b/dev/fix_maxmx.py @@ -9,10 +9,7 @@ # Now supports wildcards in list of targetfiles. # -from __future__ import absolute_import -from __future__ import print_function import os,sys,glob -from six.moves import zip rootdir = '.' targetfiles = ['*.f*'] diff --git a/dev/tests/run_regression_tests.py b/dev/tests/run_regression_tests.py index d361b66ff..9f9131733 100644 --- a/dev/tests/run_regression_tests.py +++ b/dev/tests/run_regression_tests.py @@ -8,15 +8,12 @@ "Test 2", etc. """ -from __future__ import absolute_import -from __future__ import print_function from setrun_regression import setrun from setplot import setplot from clawpack.clawutil.runclaw import runclaw from clawpack.visclaw.plotclaw import plotclaw from clawpack.clawutil.compare_regression_tests import compare_regression_tests import os,sys -from six.moves import input def run_regression_tests(regression_dir="_regression_tests", \ diff --git a/dev/tests/run_regression_tests_mandli.py b/dev/tests/run_regression_tests_mandli.py index 4a4e15ece..c5e0a5e8c 100644 --- a/dev/tests/run_regression_tests_mandli.py +++ b/dev/tests/run_regression_tests_mandli.py @@ -8,10 +8,7 @@ "Test 2", etc. """ -from __future__ import absolute_import -from __future__ import print_function import clawpack.clawutil.batch as batch -from six.moves import input # from setrun_regression import setrun # from setplot import setplot diff --git a/src/python/amrclaw/compare_gauges.py b/src/python/amrclaw/compare_gauges.py index edebe62eb..5e14b0101 100755 --- a/src/python/amrclaw/compare_gauges.py +++ b/src/python/amrclaw/compare_gauges.py @@ -1,14 +1,11 @@ #!/usr/bin/env python -from __future__ import absolute_import -from __future__ import print_function import sys import numpy import matplotlib.pyplot as plt import clawpack.pyclaw.gauges as gauges -from six.moves import range # Load all gauges diff --git a/src/python/amrclaw/data.py b/src/python/amrclaw/data.py index 897457bd3..a3406cc15 100755 --- a/src/python/amrclaw/data.py +++ b/src/python/amrclaw/data.py @@ -2,13 +2,9 @@ """Base AMRClaw data class for writing out data parameter files.""" -from __future__ import print_function -from __future__ import absolute_import import os import clawpack.clawutil.data -import six -from six.moves import range class AmrclawInputData(clawpack.clawutil.data.ClawData): r""" @@ -391,7 +387,7 @@ def __init__(self, num_dim=None): super(GaugeData,self).__init__() self.add_attribute('gauges',[]) - for (value, default) in six.iteritems(self.defaults): + for (value, default) in self.defaults.items()): self.add_attribute(value, default) @@ -475,7 +471,7 @@ def write(self, num_eqn, num_aux, out_file='gauges.data', self._out_file.write("# q fields\n") for gauge_num in self.gauge_numbers: # Handle special values of "all" and "none" - if isinstance(self.q_out_fields[gauge_num], six.string_types): + if isinstance(self.q_out_fields[gauge_num], str): if self.q_out_fields[gauge_num].lower() == 'all': self._out_file.write("%s\n" % " ".join(['True'] * num_eqn)) elif self.q_out_fields[gauge_num].lower() == 'none': @@ -498,7 +494,7 @@ def write(self, num_eqn, num_aux, out_file='gauges.data', self._out_file.write("# aux fields\n") for gauge_num in self.gauge_numbers: # Handle special values of "all" and "none" - if isinstance(self.aux_out_fields[gauge_num], six.string_types): + if isinstance(self.aux_out_fields[gauge_num], str): if self.aux_out_fields[gauge_num].lower() == 'all': self._out_file.write("%s\n" % " ".join(['True'] * num_aux)) elif self.aux_out_fields[gauge_num].lower() == 'none':