prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  basestring
  Hi there
  I found the following issue:
  If I'm using the F1 object from rootpy.plotting and try to access a parameter using [parnr] (the __getitem__) methode, I get the following error:
  `NameError: name 'basestring' is not defined`
  I'm using python 3.6 which doesn't has the basestring data type anymore..
  
  https://github.com/rootpy/rootpy/blob/457e074056a916fff848978ef68b7f5107856e47/rootpy/plotting/func.py#L63
  
  </issue>
  <code>
  [start of rootpy/plotting/func.py]
  1 from __future__ import absolute_import
  2 
  3 from .. import QROOT
  4 from ..decorators import snake_case_methods
  5 from .base import Plottable
  6 from ..base import NameOnlyObject
  7 
  8 
  9 __all__ = [
  10     'F1',
  11     'F2',
  12     'F3',
  13 ]
  14 
  15 class BaseFunction(object):
  16     class ParProxy(object):
  17         def __init__(self, fcn, idx):
  18             self.fcn_ = fcn
  19             self.idx_ = idx
  20         
  21         @property
  22         def index(self):
  23             return self.idx_
  24 
  25         @property
  26         def name(self):
  27             return self.fcn_.GetParName(self.idx_)
  28         
  29         @name.setter
  30         def name(self, val):
  31             return self.fcn_.SetParName(self.idx_, val)
  32 
  33         @property
  34         def value(self):
  35             return self.fcn_.GetParameter(self.idx_)
  36 
  37         @value.setter
  38         def value(self, val):
  39             self.fcn_.SetParameter(self.idx_, val)
  40 
  41         @property
  42         def error(self):
  43             return self.fcn_.GetParError(self.idx_)
  44 
  45         @error.setter
  46         def error(self, val):
  47             return self.fcn_.SetParError(self.idx_, val)
  48 
  49         @property
  50         def limits(self):
  51             m = QROOT.Double()
  52             M = QROOT.Double()
  53             self.fcn_.GetParLimits(self.idx_, m, M)
  54             return float(m), float(M)
  55 
  56         @limits.setter
  57         def limits(self, val):
  58             if not hastattr(val, '__len__') and len(val) != 2:
  59                 raise RuntimeError('Function limits must be a tuple size 2')
  60             self.fcn_.SetParLimits(self.idx_, val[0], val[1])
  61 
  62     def __getitem__(self, value):
  63         if isinstance(value, basestring):
  64             idx = self.GetParNumber(value)
  65         elif isinstance(value, int):
  66             idx = value
  67         else:
  68             raise ValueError('Function index must be a integer or a string')
  69         return BaseFunction.ParProxy(self, idx)
  70 
  71 
  72 @snake_case_methods
  73 class F1(Plottable, NameOnlyObject, BaseFunction, QROOT.TF1):
  74     _ROOT = QROOT.TF1
  75 
  76     def __init__(self, *args, **kwargs):
  77         name = kwargs.pop('name', None)
  78         super(F1, self).__init__(*args, name=name)
  79         self._post_init(**kwargs)
  80 
  81 
  82 @snake_case_methods
  83 class F2(Plottable, NameOnlyObject, BaseFunction, QROOT.TF2):
  84     _ROOT = QROOT.TF2
  85 
  86     def __init__(self, *args, **kwargs):
  87         name = kwargs.pop('name', None)
  88         super(F2, self).__init__(*args, name=name)
  89         self._post_init(**kwargs)
  90 
  91 
  92 @snake_case_methods
  93 class F3(Plottable, NameOnlyObject, BaseFunction, QROOT.TF3):
  94     _ROOT = QROOT.TF3
  95 
  96     def __init__(self, *args, **kwargs):
  97         name = kwargs.pop('name', None)
  98         super(F3, self).__init__(*args, name=name)
  99         self._post_init(**kwargs)
  100
  [end of rootpy/plotting/func.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/rootpy/plotting/func.py b/rootpy/plotting/func.py
  --- a/rootpy/plotting/func.py
  +++ b/rootpy/plotting/func.py
  @@ -4,7 +4,7 @@
   from ..decorators import snake_case_methods
   from .base import Plottable
   from ..base import NameOnlyObject
  -
  +import six
   
   __all__ = [
       'F1',
  @@ -17,7 +17,7 @@
           def __init__(self, fcn, idx):
               self.fcn_ = fcn
               self.idx_ = idx
  -        
  +
           @property
           def index(self):
               return self.idx_
  @@ -25,7 +25,7 @@
           @property
           def name(self):
               return self.fcn_.GetParName(self.idx_)
  -        
  +
           @name.setter
           def name(self, val):
               return self.fcn_.SetParName(self.idx_, val)
  @@ -55,14 +55,14 @@
   
           @limits.setter
           def limits(self, val):
  -            if not hastattr(val, '__len__') and len(val) != 2:
  +            if not hasattr(val, '__len__') and len(val) != 2:
                   raise RuntimeError('Function limits must be a tuple size 2')
               self.fcn_.SetParLimits(self.idx_, val[0], val[1])
   
       def __getitem__(self, value):
  -        if isinstance(value, basestring):
  +        if isinstance(value, six.string_types):
               idx = self.GetParNumber(value)
  -        elif isinstance(value, int):
  +        elif isinstance(value, six.integer_types):
               idx = value
           else:
               raise ValueError('Function index must be a integer or a string')
  
verification_info: {"golden_diff": "diff --git a/rootpy/plotting/func.py b/rootpy/plotting/func.py\n--- a/rootpy/plotting/func.py\n+++ b/rootpy/plotting/func.py\n@@ -4,7 +4,7 @@\n from ..decorators import snake_case_methods\n from .base import Plottable\n from ..base import NameOnlyObject\n-\n+import six\n \n __all__ = [\n     'F1',\n@@ -17,7 +17,7 @@\n         def __init__(self, fcn, idx):\n             self.fcn_ = fcn\n             self.idx_ = idx\n-        \n+\n         @property\n         def index(self):\n             return self.idx_\n@@ -25,7 +25,7 @@\n         @property\n         def name(self):\n             return self.fcn_.GetParName(self.idx_)\n-        \n+\n         @name.setter\n         def name(self, val):\n             return self.fcn_.SetParName(self.idx_, val)\n@@ -55,14 +55,14 @@\n \n         @limits.setter\n         def limits(self, val):\n-            if not hastattr(val, '__len__') and len(val) != 2:\n+            if not hasattr(val, '__len__') and len(val) != 2:\n                 raise RuntimeError('Function limits must be a tuple size 2')\n             self.fcn_.SetParLimits(self.idx_, val[0], val[1])\n \n     def __getitem__(self, value):\n-        if isinstance(value, basestring):\n+        if isinstance(value, six.string_types):\n             idx = self.GetParNumber(value)\n-        elif isinstance(value, int):\n+        elif isinstance(value, six.integer_types):\n             idx = value\n         else:\n             raise ValueError('Function index must be a integer or a string')\n", "issue": "basestring\nHi there\r\nI found the following issue:\r\nIf I'm using the F1 object from rootpy.plotting and try to access a parameter using [parnr] (the __getitem__) methode, I get the following error:\r\n`NameError: name 'basestring' is not defined`\r\nI'm using python 3.6 which doesn't has the basestring data type anymore..\r\n\r\nhttps://github.com/rootpy/rootpy/blob/457e074056a916fff848978ef68b7f5107856e47/rootpy/plotting/func.py#L63\n", "before_files": [{"content": "from __future__ import absolute_import\n\nfrom .. import QROOT\nfrom ..decorators import snake_case_methods\nfrom .base import Plottable\nfrom ..base import NameOnlyObject\n\n\n__all__ = [\n    'F1',\n    'F2',\n    'F3',\n]\n\nclass BaseFunction(object):\n    class ParProxy(object):\n        def __init__(self, fcn, idx):\n            self.fcn_ = fcn\n            self.idx_ = idx\n        \n        @property\n        def index(self):\n            return self.idx_\n\n        @property\n        def name(self):\n            return self.fcn_.GetParName(self.idx_)\n        \n        @name.setter\n        def name(self, val):\n            return self.fcn_.SetParName(self.idx_, val)\n\n        @property\n        def value(self):\n            return self.fcn_.GetParameter(self.idx_)\n\n        @value.setter\n        def value(self, val):\n            self.fcn_.SetParameter(self.idx_, val)\n\n        @property\n        def error(self):\n            return self.fcn_.GetParError(self.idx_)\n\n        @error.setter\n        def error(self, val):\n            return self.fcn_.SetParError(self.idx_, val)\n\n        @property\n        def limits(self):\n            m = QROOT.Double()\n            M = QROOT.Double()\n            self.fcn_.GetParLimits(self.idx_, m, M)\n            return float(m), float(M)\n\n        @limits.setter\n        def limits(self, val):\n            if not hastattr(val, '__len__') and len(val) != 2:\n                raise RuntimeError('Function limits must be a tuple size 2')\n            self.fcn_.SetParLimits(self.idx_, val[0], val[1])\n\n    def __getitem__(self, value):\n        if isinstance(value, basestring):\n            idx = self.GetParNumber(value)\n        elif isinstance(value, int):\n            idx = value\n        else:\n            raise ValueError('Function index must be a integer or a string')\n        return BaseFunction.ParProxy(self, idx)\n\n\n@snake_case_methods\nclass F1(Plottable, NameOnlyObject, BaseFunction, QROOT.TF1):\n    _ROOT = QROOT.TF1\n\n    def __init__(self, *args, **kwargs):\n        name = kwargs.pop('name', None)\n        super(F1, self).__init__(*args, name=name)\n        self._post_init(**kwargs)\n\n\n@snake_case_methods\nclass F2(Plottable, NameOnlyObject, BaseFunction, QROOT.TF2):\n    _ROOT = QROOT.TF2\n\n    def __init__(self, *args, **kwargs):\n        name = kwargs.pop('name', None)\n        super(F2, self).__init__(*args, name=name)\n        self._post_init(**kwargs)\n\n\n@snake_case_methods\nclass F3(Plottable, NameOnlyObject, BaseFunction, QROOT.TF3):\n    _ROOT = QROOT.TF3\n\n    def __init__(self, *args, **kwargs):\n        name = kwargs.pop('name', None)\n        super(F3, self).__init__(*args, name=name)\n        self._post_init(**kwargs)\n", "path": "rootpy/plotting/func.py"}]}