prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [SkipRev] broken - cannot import name SkipDownload
  SkipRev plugin failed to import with following error:
  Errore durante l'importazione SkipRev: cannot import name SkipDownload
  
  I already tried following, without success: http://forum.pyload.org/viewtopic.php?f=7&t=4335
  
  Debian GNU/Linux 7.8 (wheezy) x64
  Python 2.7.3
  pyLoad 0.4.9
  SkipRev 0.30
  
  
  </issue>
  <code>
  [start of module/plugins/hooks/SkipRev.py]
  1 # -*- coding: utf-8 -*-
  2 
  3 import re
  4 import urllib
  5 import urlparse
  6 
  7 from types import MethodType
  8 
  9 from module.PyFile import PyFile
  10 from module.plugins.internal.Hook import Hook
  11 from module.plugins.internal.Plugin import SkipDownload
  12 
  13 
  14 class SkipRev(Hook):
  15     __name__    = "SkipRev"
  16     __type__    = "hook"
  17     __version__ = "0.30"
  18 
  19     __config__ = [("mode"     , "Auto;Manual", "Choose recovery archives to skip"               , "Auto"),
  20                   ("revtokeep", "int"        , "Number of recovery archives to keep for package", 0     )]
  21 
  22     __description__ = """Skip recovery archives (.rev)"""
  23     __license__     = "GPLv3"
  24     __authors__     = [("Walter Purcaro", "vuolter@gmail.com")]
  25 
  26 
  27     interval = 0  #@TODO: Remove in 0.4.10
  28 
  29 
  30     def setup(self):
  31         self.info = {}  #@TODO: Remove in 0.4.10
  32 
  33 
  34     @staticmethod
  35     def _setup(self):
  36         self.pyfile.plugin._setup()
  37         if self.pyfile.hasStatus("skipped"):
  38             raise SkipDownload(self.pyfile.statusname or self.pyfile.pluginname)
  39 
  40 
  41     def _name(self, pyfile):
  42         if hasattr(pyfile.pluginmodule, "getInfo"):  #@NOTE: getInfo is deprecated in 0.4.10
  43             return pyfile.pluginmodule.getInfo([pyfile.url]).next()[0]
  44         else:
  45             self.logWarning("Unable to grab file name")
  46             return urlparse.urlparse(urllib.unquote(pyfile.url)).path.split('/')[-1]
  47 
  48 
  49     def _pyfile(self, link):
  50         return PyFile(self.core.files,
  51                       link.fid,
  52                       link.url,
  53                       link.name,
  54                       link.size,
  55                       link.status,
  56                       link.error,
  57                       link.plugin,
  58                       link.packageID,
  59                       link.order)
  60 
  61 
  62     def downloadPreparing(self, pyfile):
  63         name = self._name(pyfile)
  64 
  65         if pyfile.statusname is _("unskipped") or not name.endswith(".rev") or not ".part" in name:
  66             return
  67 
  68         revtokeep = -1 if self.getConfig('mode') == "Auto" else self.getConfig('revtokeep')
  69 
  70         if revtokeep:
  71             status_list = (1, 4, 8, 9, 14) if revtokeep < 0 else (1, 3, 4, 8, 9, 14)
  72             pyname      = re.compile(r'%s\.part\d+\.rev$' % name.rsplit('.', 2)[0].replace('.', '\.'))
  73 
  74             queued = [True for link in self.core.api.getPackageData(pyfile.package().id).links \
  75                       if link.status not in status_list and pyname.match(link.name)].count(True)
  76 
  77             if not queued or queued < revtokeep:  #: keep one rev at least in auto mode
  78                 return
  79 
  80         pyfile.setCustomStatus("SkipRev", "skipped")
  81 
  82         if not hasattr(pyfile.plugin, "_setup"):
  83             # Work-around: inject status checker inside the preprocessing routine of the plugin
  84             pyfile.plugin._setup = pyfile.plugin.setup
  85             pyfile.plugin.setup  = MethodType(self._setup, pyfile.plugin)
  86 
  87 
  88     def downloadFailed(self, pyfile):
  89         #: Check if pyfile is still "failed",
  90         #  maybe might has been restarted in meantime
  91         if pyfile.status != 8 or pyfile.name.rsplit('.', 1)[-1].strip() not in ("rar", "rev"):
  92             return
  93 
  94         revtokeep = -1 if self.getConfig('mode') == "Auto" else self.getConfig('revtokeep')
  95 
  96         if not revtokeep:
  97             return
  98 
  99         pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.'))
  100 
  101         for link in self.core.api.getPackageData(pyfile.package().id).links:
  102             if link.status is 4 and pyname.match(link.name):
  103                 pylink = self._pyfile(link)
  104 
  105                 if revtokeep > -1 or pyfile.name.endswith(".rev"):
  106                     pylink.setStatus("queued")
  107                 else:
  108                     pylink.setCustomStatus(_("unskipped"), "queued")
  109 
  110                 self.core.files.save()
  111                 pylink.release()
  112                 return
  113
  [end of module/plugins/hooks/SkipRev.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/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py
  --- a/module/plugins/hooks/SkipRev.py
  +++ b/module/plugins/hooks/SkipRev.py
  @@ -8,13 +8,13 @@
   
   from module.PyFile import PyFile
   from module.plugins.internal.Hook import Hook
  -from module.plugins.internal.Plugin import SkipDownload
  +from module.plugins.internal.Plugin import Skip
   
   
   class SkipRev(Hook):
       __name__    = "SkipRev"
       __type__    = "hook"
  -    __version__ = "0.30"
  +    __version__ = "0.31"
   
       __config__ = [("mode"     , "Auto;Manual", "Choose recovery archives to skip"               , "Auto"),
                     ("revtokeep", "int"        , "Number of recovery archives to keep for package", 0     )]
  @@ -35,7 +35,7 @@
       def _setup(self):
           self.pyfile.plugin._setup()
           if self.pyfile.hasStatus("skipped"):
  -            raise SkipDownload(self.pyfile.statusname or self.pyfile.pluginname)
  +            raise Skip(self.pyfile.statusname or self.pyfile.pluginname)
   
   
       def _name(self, pyfile):
  
verification_info: {"golden_diff": "diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py\n--- a/module/plugins/hooks/SkipRev.py\n+++ b/module/plugins/hooks/SkipRev.py\n@@ -8,13 +8,13 @@\n \n from module.PyFile import PyFile\n from module.plugins.internal.Hook import Hook\n-from module.plugins.internal.Plugin import SkipDownload\n+from module.plugins.internal.Plugin import Skip\n \n \n class SkipRev(Hook):\n     __name__    = \"SkipRev\"\n     __type__    = \"hook\"\n-    __version__ = \"0.30\"\n+    __version__ = \"0.31\"\n \n     __config__ = [(\"mode\"     , \"Auto;Manual\", \"Choose recovery archives to skip\"               , \"Auto\"),\n                   (\"revtokeep\", \"int\"        , \"Number of recovery archives to keep for package\", 0     )]\n@@ -35,7 +35,7 @@\n     def _setup(self):\n         self.pyfile.plugin._setup()\n         if self.pyfile.hasStatus(\"skipped\"):\n-            raise SkipDownload(self.pyfile.statusname or self.pyfile.pluginname)\n+            raise Skip(self.pyfile.statusname or self.pyfile.pluginname)\n \n \n     def _name(self, pyfile):\n", "issue": "[SkipRev] broken - cannot import name SkipDownload\nSkipRev plugin failed to import with following error:\nErrore durante l'importazione SkipRev: cannot import name SkipDownload\n\nI already tried following, without success: http://forum.pyload.org/viewtopic.php?f=7&t=4335\n\nDebian GNU/Linux 7.8 (wheezy) x64\nPython 2.7.3\npyLoad 0.4.9\nSkipRev 0.30\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\nimport re\nimport urllib\nimport urlparse\n\nfrom types import MethodType\n\nfrom module.PyFile import PyFile\nfrom module.plugins.internal.Hook import Hook\nfrom module.plugins.internal.Plugin import SkipDownload\n\n\nclass SkipRev(Hook):\n    __name__    = \"SkipRev\"\n    __type__    = \"hook\"\n    __version__ = \"0.30\"\n\n    __config__ = [(\"mode\"     , \"Auto;Manual\", \"Choose recovery archives to skip\"               , \"Auto\"),\n                  (\"revtokeep\", \"int\"        , \"Number of recovery archives to keep for package\", 0     )]\n\n    __description__ = \"\"\"Skip recovery archives (.rev)\"\"\"\n    __license__     = \"GPLv3\"\n    __authors__     = [(\"Walter Purcaro\", \"vuolter@gmail.com\")]\n\n\n    interval = 0  #@TODO: Remove in 0.4.10\n\n\n    def setup(self):\n        self.info = {}  #@TODO: Remove in 0.4.10\n\n\n    @staticmethod\n    def _setup(self):\n        self.pyfile.plugin._setup()\n        if self.pyfile.hasStatus(\"skipped\"):\n            raise SkipDownload(self.pyfile.statusname or self.pyfile.pluginname)\n\n\n    def _name(self, pyfile):\n        if hasattr(pyfile.pluginmodule, \"getInfo\"):  #@NOTE: getInfo is deprecated in 0.4.10\n            return pyfile.pluginmodule.getInfo([pyfile.url]).next()[0]\n        else:\n            self.logWarning(\"Unable to grab file name\")\n            return urlparse.urlparse(urllib.unquote(pyfile.url)).path.split('/')[-1]\n\n\n    def _pyfile(self, link):\n        return PyFile(self.core.files,\n                      link.fid,\n                      link.url,\n                      link.name,\n                      link.size,\n                      link.status,\n                      link.error,\n                      link.plugin,\n                      link.packageID,\n                      link.order)\n\n\n    def downloadPreparing(self, pyfile):\n        name = self._name(pyfile)\n\n        if pyfile.statusname is _(\"unskipped\") or not name.endswith(\".rev\") or not \".part\" in name:\n            return\n\n        revtokeep = -1 if self.getConfig('mode') == \"Auto\" else self.getConfig('revtokeep')\n\n        if revtokeep:\n            status_list = (1, 4, 8, 9, 14) if revtokeep < 0 else (1, 3, 4, 8, 9, 14)\n            pyname      = re.compile(r'%s\\.part\\d+\\.rev$' % name.rsplit('.', 2)[0].replace('.', '\\.'))\n\n            queued = [True for link in self.core.api.getPackageData(pyfile.package().id).links \\\n                      if link.status not in status_list and pyname.match(link.name)].count(True)\n\n            if not queued or queued < revtokeep:  #: keep one rev at least in auto mode\n                return\n\n        pyfile.setCustomStatus(\"SkipRev\", \"skipped\")\n\n        if not hasattr(pyfile.plugin, \"_setup\"):\n            # Work-around: inject status checker inside the preprocessing routine of the plugin\n            pyfile.plugin._setup = pyfile.plugin.setup\n            pyfile.plugin.setup  = MethodType(self._setup, pyfile.plugin)\n\n\n    def downloadFailed(self, pyfile):\n        #: Check if pyfile is still \"failed\",\n        #  maybe might has been restarted in meantime\n        if pyfile.status != 8 or pyfile.name.rsplit('.', 1)[-1].strip() not in (\"rar\", \"rev\"):\n            return\n\n        revtokeep = -1 if self.getConfig('mode') == \"Auto\" else self.getConfig('revtokeep')\n\n        if not revtokeep:\n            return\n\n        pyname = re.compile(r'%s\\.part\\d+\\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\\.'))\n\n        for link in self.core.api.getPackageData(pyfile.package().id).links:\n            if link.status is 4 and pyname.match(link.name):\n                pylink = self._pyfile(link)\n\n                if revtokeep > -1 or pyfile.name.endswith(\".rev\"):\n                    pylink.setStatus(\"queued\")\n                else:\n                    pylink.setCustomStatus(_(\"unskipped\"), \"queued\")\n\n                self.core.files.save()\n                pylink.release()\n                return\n", "path": "module/plugins/hooks/SkipRev.py"}]}