Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lib/iris/_concatenate.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,14 @@ def __new__(cls, coord, dims):
else:
order = _DECREASING
kwargs['order'] = order
metadata = super(_CoordMetaData, cls).__new__(cls, defn, dims,
points_dtype,
bounds_dtype,
kwargs)
metadata = super().__new__(cls, defn, dims, points_dtype,
bounds_dtype, kwargs)
return metadata

__slots__ = ()

def __hash__(self):
return super(_CoordMetaData, self).__hash__()
return super().__hash__()

def __eq__(self, other):
result = NotImplemented
Expand Down
3 changes: 1 addition & 2 deletions lib/iris/_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,4 @@ def __new__(metacls, classname, bases, class_dict):
class_dict['__doc__'] = parent_class.__doc__

# Return the result.
return super(ClassWrapperSameDocstring, metacls).__new__(
metacls, classname, bases, class_dict)
return super().__new__(metacls, classname, bases, class_dict)
14 changes: 7 additions & 7 deletions lib/iris/aux_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def __init__(self, delta=None, sigma=None, orography=None):
The coordinate providing the `orog` term.

"""
super(HybridHeightFactory, self).__init__()
super().__init__()

if delta and delta.nbounds not in (0, 2):
raise ValueError('Invalid delta coordinate: must have either 0 or'
Expand Down Expand Up @@ -521,7 +521,7 @@ def __init__(self, delta=None, sigma=None, surface_air_pressure=None):
The coordinate providing the `ps` term.

"""
super(HybridPressureFactory, self).__init__()
super().__init__()

# Check that provided coords meet necessary conditions.
self._check_dependencies(delta, sigma, surface_air_pressure)
Expand Down Expand Up @@ -696,7 +696,7 @@ def __init__(self, sigma=None, eta=None, depth=None,
either `eta`, or 'sigma' and `depth` and `depth_c` coordinates.

"""
super(OceanSigmaZFactory, self).__init__()
super().__init__()

# Check that provided coordinates meet necessary conditions.
self._check_dependencies(sigma, eta, depth, depth_c, nsigma, zlev)
Expand Down Expand Up @@ -955,7 +955,7 @@ def __init__(self, sigma=None, eta=None, depth=None):
(depth(j, i) + eta(n, j, i))

"""
super(OceanSigmaFactory, self).__init__()
super().__init__()

# Check that provided coordinates meet necessary conditions.
self._check_dependencies(sigma, eta, depth)
Expand Down Expand Up @@ -1119,7 +1119,7 @@ def __init__(self, s=None, c=None, eta=None, depth=None, depth_c=None):
S(k,j,i) = depth_c * s(k) + (depth(j,i) - depth_c) * C(k)

"""
super(OceanSg1Factory, self).__init__()
super().__init__()

# Check that provided coordinates meet necessary conditions.
self._check_dependencies(s, c, eta, depth, depth_c)
Expand Down Expand Up @@ -1308,7 +1308,7 @@ def __init__(self, s=None, eta=None, depth=None, a=None, b=None,
b * [tanh(a * (s(k) + 0.5)) / (2 * tanh(0.5*a)) - 0.5]

"""
super(OceanSFactory, self).__init__()
super().__init__()

# Check that provided coordinates meet necessary conditions.
self._check_dependencies(s, eta, depth, a, b, depth_c)
Expand Down Expand Up @@ -1492,7 +1492,7 @@ def __init__(self, s=None, c=None, eta=None, depth=None, depth_c=None):
(depth_c + depth(j,i))

"""
super(OceanSg2Factory, self).__init__()
super().__init__()

# Check that provided coordinates meet necessary conditions.
self._check_dependencies(s, c, eta, depth, depth_c)
Expand Down
9 changes: 4 additions & 5 deletions lib/iris/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,9 +860,8 @@ def __new__(cls, name_or_coord, minimum, maximum,
in the selection. Default is True.

"""
return super(CoordExtent, cls).__new__(cls, name_or_coord, minimum,
maximum, min_inclusive,
max_inclusive)
return super().__new__(cls, name_or_coord, minimum, maximum,
min_inclusive, max_inclusive)

__slots__ = ()

Expand Down Expand Up @@ -979,7 +978,7 @@ def __new__(cls, point=None, bound=None):
'length 1.')
point = point[0]

return super(Cell, cls).__new__(cls, point, bound)
return super().__new__(cls, point, bound)

def __mod__(self, mod):
point = self.point
Expand All @@ -1000,7 +999,7 @@ def __add__(self, mod):
return Cell(point, bound)

def __hash__(self):
return super(Cell, self).__hash__()
return super().__hash__()

def __eq__(self, other):
"""
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def __add__(self, other):

def __getitem__(self, keys):
"""x.__getitem__(y) <==> x[y]"""
result = super(CubeList, self).__getitem__(keys)
result = super().__getitem__(keys)
if isinstance(result, list):
result = CubeList(result)
return result
Expand All @@ -243,7 +243,7 @@ def __getslice__(self, start, stop):
Use of negative indices is not supported.

"""
result = super(CubeList, self).__getslice__(start, stop)
result = super().__getslice__(start, stop)
result = CubeList(result)
return result

Expand Down
5 changes: 2 additions & 3 deletions lib/iris/fileformats/_structured_array_identification.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ class ArrayStructure(namedtuple('ArrayStructure',

"""
def __new__(cls, stride, unique_ordered_values):
self = super(ArrayStructure, cls).__new__(cls, stride,
unique_ordered_values)
self = super().__new__(cls, stride, unique_ordered_values)
return self

__slots__ = ()
Expand All @@ -108,7 +107,7 @@ def size(self):
return len(self.unique_ordered_values)

def __hash__(self):
return super(ArrayStructure, self).__hash__()
return super().__hash__()

def __eq__(self, other):
stride = getattr(other, 'stride', None)
Expand Down
8 changes: 4 additions & 4 deletions lib/iris/fileformats/pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def __new__(cls, model, section, item):
model = cls._validate_member('model', model, 1, 99)
section = cls._validate_member('section', section, 0, 99)
item = cls._validate_member('item', item, 1, 999)
return super(STASH, cls).__new__(cls, model, section, item)
return super().__new__(cls, model, section, item)

@staticmethod
def from_msi(msi):
Expand Down Expand Up @@ -318,13 +318,13 @@ def is_valid(self):
return '?' not in str(self)

def __hash__(self):
return super(STASH, self).__hash__()
return super().__hash__()

def __eq__(self, other):
if isinstance(other, six.string_types):
return super(STASH, self).__eq__(STASH.from_msi(other))
return super().__eq__(STASH.from_msi(other))
else:
return super(STASH, self).__eq__(other)
return super().__eq__(other)

def __ne__(self, other):
return not self.__eq__(other)
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/fileformats/um/_fast_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, fields, filepath):
The path of the file the collation is loaded from.

"""
super(FieldCollation, self).__init__(fields)
super().__init__(fields)
self._load_filepath = filepath

@property
Expand Down
3 changes: 1 addition & 2 deletions lib/iris/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,7 @@ def assertRaisesRegexp(self, *args, **kwargs):
"""
# Note: invoke via parent class to avoid recursion as, in Python 2,
# "six.assertRaisesRegex" calls getattr(self, 'assertRaisesRegexp').
return six.assertRaisesRegex(super(IrisTest_nometa, self),
*args, **kwargs)
return six.assertRaisesRegex(super(), *args, **kwargs)

@contextlib.contextmanager
def _recordWarningMatches(self, expected_regexp=''):
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/experimental/test_animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@tests.skip_plot
class IntegrationTest(tests.GraphicsTest):
def setUp(self):
super(IntegrationTest, self).setUp()
super().setUp()
cube = iris.cube.Cube(np.arange(36, dtype=np.int32).reshape((3, 3, 4)))
cs = GeogCS(6371229)

Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/integration/plot/test_colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@tests.skip_plot
class TestColorBarCreation(tests.GraphicsTest):
def setUp(self):
super(TestColorBarCreation, self).setUp()
super().setUp()
self.draw_functions = (contour, contourf, pcolormesh, pcolor)
self.cube = iris.tests.stock.lat_lon_cube()
self.cube.coord('longitude').guess_bounds()
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/integration/plot/test_vector_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_circular_longitude(self):

class TestQuiver(MixinVectorPlotCases, tests.GraphicsTest):
def setUp(self):
super(TestQuiver, self).setUp()
super().setUp()

def plot_function_to_test(self):
return quiver
Expand Down
6 changes: 3 additions & 3 deletions lib/iris/tests/integration/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ def pickle_obj(self, obj):
# see https://github.com/SciTools/iris/pull/2608
@unittest.expectedFailure
def test_protocol_0(self):
super(TestGribMessage, self).test_protocol_0()
super().test_protocol_0()

@unittest.expectedFailure
def test_protocol_1(self):
super(TestGribMessage, self).test_protocol_1()
super().test_protocol_1()

@unittest.expectedFailure
def test_protocol_2(self):
super(TestGribMessage, self).test_protocol_2()
super().test_protocol_2()

def test(self):
# Check that a GribMessage pickles without errors.
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/integration/test_regridding.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_linear_same_crs_global(self):

class TestZonalMean_regional(TestZonalMean_global, tests.IrisTest):
def setUp(self):
super(TestZonalMean_regional, self).setUp()
super().setUp()

# Define a target grid and a target result (what we expect the
# regridder to return).
Expand Down
3 changes: 1 addition & 2 deletions lib/iris/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ def get_file_results(self):
return self.file_errors

# Otherwise call the superclass' method to print the bad results.
return super(StandardReportWithExclusions,
self).get_file_results()
return super().get_file_results()


class TestCodeFormat(tests.IrisTest):
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/test_grib_load_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def cube_from_message(self, grib):
class TestGrib1LoadPhenomenon(TestGribSimple):
# Test recognition of grib phenomenon types.
def mock_grib(self):
grib = super(TestGrib1LoadPhenomenon, self).mock_grib()
grib = super().mock_grib()
grib.edition = 1
return grib

Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/test_hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@tests.skip_data
class TestRealistic4d(tests.GraphicsTest):
def setUp(self):
super(TestRealistic4d, self).setUp()
super().setUp()
self.cube = iris.tests.stock.realistic_4d()
self.altitude = self.cube.coord('altitude')

Expand Down
12 changes: 6 additions & 6 deletions lib/iris/tests/test_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@tests.skip_data
class TestBasic(tests.GraphicsTest):
def setUp(self):
super(TestBasic, self).setUp()
super().setUp()
self.cube = iris.tests.stock.realistic_4d()

def test_contourf(self):
Expand Down Expand Up @@ -73,7 +73,7 @@ def test_default_projection_and_extent(self):
@tests.skip_plot
class TestUnmappable(tests.GraphicsTest):
def setUp(self):
super(TestUnmappable, self).setUp()
super().setUp()
src_cube = iris.tests.stock.global_pp()

# Make a cube that can't be located on the globe.
Expand All @@ -99,7 +99,7 @@ def test_simple(self):
@tests.skip_plot
class TestMappingSubRegion(tests.GraphicsTest):
def setUp(self):
super(TestMappingSubRegion, self).setUp()
super().setUp()
cube_path = tests.get_data_path(
('PP', 'aPProt1', 'rotatedMHtimecube.pp'))
cube = iris.load_cube(cube_path)[0]
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_default_projection_and_extent(self):
@tests.skip_plot
class TestLowLevel(tests.GraphicsTest):
def setUp(self):
super(TestLowLevel, self).setUp()
super().setUp()
self.cube = iris.tests.stock.global_pp()
self.few = 4
self.few_levels = list(range(280, 300, 5))
Expand Down Expand Up @@ -181,7 +181,7 @@ def test_keywords(self):
@tests.skip_plot
class TestBoundedCube(tests.GraphicsTest):
def setUp(self):
super(TestBoundedCube, self).setUp()
super().setUp()
self.cube = iris.tests.stock.global_pp()
# Add some bounds to this data (this will actually make the bounds
# invalid as they will straddle the north pole and overlap on the
Expand Down Expand Up @@ -216,7 +216,7 @@ def test_default_projection_and_extent(self):
@tests.skip_plot
class TestLimitedAreaCube(tests.GraphicsTest):
def setUp(self):
super(TestLimitedAreaCube, self).setUp()
super().setUp()
cube_path = tests.get_data_path(('PP', 'aPProt1', 'rotated.pp'))
self.cube = iris.load_cube(cube_path)[::20, ::20]
self.cube.coord('grid_latitude').guess_bounds()
Expand Down
Loading