Skip to content

Commit d563c2d

Browse files
committed
py2k fixes (!)
1 parent 08e20c9 commit d563c2d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/iris/cube.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,19 +718,21 @@ def _get_bits(self):
718718
continue
719719
else:
720720
start_inds.append(start_ind)
721+
# Make sure the indices are in order.
722+
start_inds = sorted(start_inds)
721723
# Mark the end of the file.
722-
start_inds.append(0)
724+
start_inds.append(None)
723725

724726
# Retrieve info for each heading from the printout.
725727
for i0, i1 in zip(start_inds[:-1], start_inds[1:]):
726728
str_heading_name = bits[i0].strip()
727-
if i1 != 0:
729+
if i1 is not None:
728730
content = bits[i0 + 1: i1]
729731
else:
730732
content = bits[i0 + 1:]
731733
self.str_headings[str_heading_name] = content
732734

733-
def make_content(self):
735+
def _make_content(self):
734736
elements = []
735737
for k, v in self.str_headings.items():
736738
if v is not None:
@@ -749,7 +751,7 @@ def repr_html(self):
749751
"""Produce an html representation of a cube and return it."""
750752
self._get_bits()
751753
summary = self.summary
752-
content = self.make_content()
754+
content = self._make_content()
753755
return self._template.format(summary=summary,
754756
content=content,
755757
obj_id=self.cube_id,

lib/iris/tests/unit/cube/test_CubeRepresentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ def test_headings__cellmethods(self):
109109
self.assertIn(str(cell_method), content_str)
110110

111111

112-
class Test_make_content(tests.IrisTest):
112+
class Test__make_content(tests.IrisTest):
113113
def setUp(self):
114114
self.cube = stock.simple_3d()
115115
self.representer = _CubeRepresentation(self.cube)
116116
self.representer._get_bits()
117-
self.result = self.representer.make_content()
117+
self.result = self.representer._make_content()
118118

119119
def test_included(self):
120120
included = 'Dimension coordinates:'

0 commit comments

Comments
 (0)