Repository: enthought/chaco

Issue:
`six.moves` incorrectly imported in `errorbar_plot.py`
**Problem Description**
Noticed a stacktrace in my work that pointed out a `NameError` (`global name 'sm' is not defined`) at `errorbar_plot.py:77` of 4.7.1, which is:

    l1, l2, l3 = sm.map(len, (index, value_low, value_high))

It seems that this is because normally `six.moves` is imported like `import six.moves as sm` and the author was used to this, but this file just has `import six.moves`. This seems to result from [`dc08831`](https://github.com/enthought/chaco/commit/dc08831d35c60057b0e26466e412e644dea1c89b#diff-7b3ca9023e76b4689bb2a0e42bf4d8f1)

**Reproduction Steps:**

I don't have clear cut reproduction steps, but a cursory glance at the code seems to make the cause of the error obvious. I'm afraid I'm not actually even able to easily modify the setup we have to create a more minimal example or to even test the proposed change (which should be to just add the alias to the import).

Especially since the traceback doesn't even contain any of our code, so I don't have an easy way to find the offending code, haha. Traceback is:

    Traceback (most recent call last):
      File "/[removed]/site-packages/enable-4.7.1-py2.7-linux-x86_64.egg/enable/qt4/base_window.py", line 202, in paintEvent
        self.handler.paintEvent(event)
      File "/[removed]/site-packages/enable-4.7.1-py2.7-linux-x86_64.egg/enable/qt4/base_window.py", line 54, in paintEvent
        self._enable_window._paint(event)
      File "/[removed]/site-packages/enable-4.7.1-py2.7-linux-x86_64.egg/enable/abstract_window.py", line 468, in _paint
        self.component.draw(gc, view_bounds=(0, 0, size[0], size[1]))
      File "/[removed]/site-packages/enable-4.7.1-py2.7-linux-x86_64.egg/enable/component.py", line 427, in draw
        self._draw(gc, view_bounds, mode)
      File "/[removed]/site-packages/enable-4.7.1-py2.7-linux-x86_64.egg/enable/component.py", line 769, in _draw
        self._dispatch_draw(layer, bb, view_bounds, mode)
      File "/[removed]/site-packages/enable-4.7.1-py2.7-linux-x86_64.egg/enable/container.py", line 272, in _dispatch_draw
        component._dispatch_draw(layer, gc, new_bounds, mode)
      File "/[removed]/site-packages/enable-4.7.1-py2.7-linux-x86_64.egg/enable/container.py", line 272, in _dispatch_draw
        component._dispatch_draw(layer, gc, new_bounds, mode)
      File "/[removed]/site-packages/enable-4.7.1-py2.7-linux-x86_64.egg/enable/component.py", line 799, in _dispatch_draw
        handler(gc, view_bounds, mode)
      File "/[removed]/site-packages/chaco-4.7.1-py2.7-linux-x86_64.egg/chaco/base_xy_plot.py", line 466, in _draw_plot
        self._draw_component(gc, view_bounds, mode)
      File "/[removed]/site-packages/chaco-4.7.1-py2.7-linux-x86_64.egg/chaco/base_xy_plot.py", line 473, in _draw_component
        pts = self.get_screen_points()
      File "/[removed]/site-packages/chaco-4.7.1-py2.7-linux-x86_64.egg/chaco/errorbar_plot.py", line 61, in get_screen_points
        self._gather_points()
      File "/[removed]/site-packages/chaco-4.7.1-py2.7-linux-x86_64.egg/chaco/errorbar_plot.py", line 77, in _gather_points
        l1, l2, l3 = sm.map(len, (index, value_low, value_high))
    NameError: global name 'sm' is not defined

**Expected behavior:**

The traceback does not occur.

**OS, Python version:**

Ubuntu 14.04, Python 2.7.14, and chaco 4.7.1 with enable 4.7.1.



Discussion:

Resolving patch:
diff --git a/chaco/errorbar_plot.py b/chaco/errorbar_plot.py
--- a/chaco/errorbar_plot.py
+++ b/chaco/errorbar_plot.py
@@ -2,7 +2,7 @@
 from __future__ import with_statement
 
 import six
-import six.moves
+import six.moves as sm
 
 # Major library imports
 from numpy import column_stack, compress, invert, isnan, transpose
@@ -159,4 +159,3 @@ def _render_bar_endcap(self, gc, start, end, low, high, axis):
 
     def _render_icon(self, gc, x, y, width, height):
         pass
-


Test patch:
diff --git a/chaco/tests/errorbarplot_test_case.py b/chaco/tests/errorbarplot_test_case.py
new file mode 100644
--- /dev/null
+++ b/chaco/tests/errorbarplot_test_case.py
@@ -0,0 +1,36 @@
+import unittest
+
+import numpy as np
+from numpy import alltrue
+
+# Chaco imports
+from chaco.api import (
+    ArrayDataSource, DataRange1D, ErrorBarPlot, LinearMapper,
+    PlotGraphicsContext
+)
+
+
+class DrawErrorBarPlotCase(unittest.TestCase):
+    def test_errorbarplot(self):
+        """ Coverage test to check basic case works """
+        size = (50, 50)
+        x = np.array([1, 2])
+        y = np.array([5, 10])
+        errors = np.array([1, 2])
+        low = ArrayDataSource(y - errors)
+        high = ArrayDataSource(y + errors)
+        errorbar_plot = ErrorBarPlot(
+            index=ArrayDataSource(x),
+            values=ArrayDataSource(y),
+            index_mapper=LinearMapper(range=DataRange1D(low=0, high=3)),
+            value_mapper=LinearMapper(range=DataRange1D(low=0, high=15)),
+            value_low=low,
+            value_high=high,
+            color='blue',
+            line_width=3.0,
+        )
+        errorbar_plot.outer_bounds = list(size)
+        gc = PlotGraphicsContext(size)
+        gc.render_component(errorbar_plot)
+        actual = gc.bmp_array[:, :, :]
+        self.assertFalse(alltrue(actual == 255))