prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Quote doesn't return valid lists
  ```
  => (car (quote [if 1 2 3]))
  u'if'
  => (cdr (quote [if 1 2 3]))
  [1, 2, 3]
  ```
  
  => OK
  
  ```
  => (car (quote (if 1 2 3)))
  u'_hy_hoisted_fn_1'
  => (car (car (quote (if 1 2 3))))
  u'_'
  => (cdr (quote (if 1 2 3)))
  []
  ```
  
  => Not ok
  
  
  </issue>
  <code>
  [start of hy/core/mangles.py]
  1 # Copyright (c) 2013 Paul Tagliamonte <paultag@debian.org>
  2 #
  3 # Permission is hereby granted, free of charge, to any person obtaining a
  4 # copy of this software and associated documentation files (the "Software"),
  5 # to deal in the Software without restriction, including without limitation
  6 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
  7 # and/or sell copies of the Software, and to permit persons to whom the
  8 # Software is furnished to do so, subject to the following conditions:
  9 #
  10 # The above copyright notice and this permission notice shall be included in
  11 # all copies or substantial portions of the Software.
  12 #
  13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  16 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  19 # DEALINGS IN THE SOFTWARE.
  20 
  21 from hy.models.expression import HyExpression
  22 from hy.models.symbol import HySymbol
  23 from hy.models.list import HyList
  24 
  25 import hy.mangle
  26 
  27 
  28 class HoistableMangle(hy.mangle.Mangle):
  29     def should_hoist(self):
  30         for frame in self.stack:
  31             if frame is self.scope:
  32                 return False
  33 
  34             if isinstance(frame, HyExpression) and frame != []:
  35                 call = frame[0]
  36                 if call in self.ignore:
  37                     continue
  38             return True
  39         return False
  40 
  41 
  42 class FunctionMangle(HoistableMangle):
  43     hoistable = ["fn"]
  44     ignore = ["def", "decorate_with", "setf", "setv", "foreach", "do"]
  45 
  46     def __init__(self):
  47         self.series = 0
  48 
  49     def unique_name(self):
  50         self.series += 1
  51         return "_hy_hoisted_fn_%s" % (self.series)
  52 
  53     def visit(self, tree):
  54         if isinstance(tree, HyExpression) and tree != []:
  55             call = tree[0]
  56             if call == "fn" and self.should_hoist():
  57                 new_name = HySymbol(self.unique_name())
  58                 new_name.replace(tree)
  59                 fn_def = HyExpression([HySymbol("def"),
  60                                        new_name,
  61                                        tree])
  62                 fn_def.replace(tree)
  63                 self.hoist(fn_def)
  64                 return new_name
  65 
  66 
  67 class IfMangle(HoistableMangle):
  68     ignore = ["foreach", "do"]
  69 
  70     def __init__(self):
  71         self.series = 0
  72 
  73     def visit(self, tree):
  74         if isinstance(tree, HyExpression) and tree != []:
  75             call = tree[0]
  76             if call == "if" and self.should_hoist():
  77                 fn = HyExpression([HyExpression([HySymbol("fn"),
  78                                    HyList([]),
  79                                    tree])])
  80                 fn.replace(tree)
  81                 return fn
  82 
  83 
  84 hy.mangle.MANGLES.append(IfMangle)
  85 hy.mangle.MANGLES.append(FunctionMangle)
  86
  [end of hy/core/mangles.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/hy/core/mangles.py b/hy/core/mangles.py
  --- a/hy/core/mangles.py
  +++ b/hy/core/mangles.py
  @@ -27,6 +27,11 @@
   
   class HoistableMangle(hy.mangle.Mangle):
       def should_hoist(self):
  +        for frame in self.stack:
  +            if (isinstance(frame, HyExpression) and
  +                    frame and frame[0] == "quote"):
  +                return False
  +
           for frame in self.stack:
               if frame is self.scope:
                   return False
  
verification_info: {"golden_diff": "diff --git a/hy/core/mangles.py b/hy/core/mangles.py\n--- a/hy/core/mangles.py\n+++ b/hy/core/mangles.py\n@@ -27,6 +27,11 @@\n \n class HoistableMangle(hy.mangle.Mangle):\n     def should_hoist(self):\n+        for frame in self.stack:\n+            if (isinstance(frame, HyExpression) and\n+                    frame and frame[0] == \"quote\"):\n+                return False\n+\n         for frame in self.stack:\n             if frame is self.scope:\n                 return False\n", "issue": "Quote doesn't return valid lists\n```\n=> (car (quote [if 1 2 3]))\nu'if'\n=> (cdr (quote [if 1 2 3]))\n[1, 2, 3]\n```\n\n=> OK\n\n```\n=> (car (quote (if 1 2 3)))\nu'_hy_hoisted_fn_1'\n=> (car (car (quote (if 1 2 3))))\nu'_'\n=> (cdr (quote (if 1 2 3)))\n[]\n```\n\n=> Not ok\n\n", "before_files": [{"content": "# Copyright (c) 2013 Paul Tagliamonte <paultag@debian.org>\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Software\"),\n# to deal in the Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n# and/or sell copies of the Software, and to permit persons to whom the\n# Software is furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n# DEALINGS IN THE SOFTWARE.\n\nfrom hy.models.expression import HyExpression\nfrom hy.models.symbol import HySymbol\nfrom hy.models.list import HyList\n\nimport hy.mangle\n\n\nclass HoistableMangle(hy.mangle.Mangle):\n    def should_hoist(self):\n        for frame in self.stack:\n            if frame is self.scope:\n                return False\n\n            if isinstance(frame, HyExpression) and frame != []:\n                call = frame[0]\n                if call in self.ignore:\n                    continue\n            return True\n        return False\n\n\nclass FunctionMangle(HoistableMangle):\n    hoistable = [\"fn\"]\n    ignore = [\"def\", \"decorate_with\", \"setf\", \"setv\", \"foreach\", \"do\"]\n\n    def __init__(self):\n        self.series = 0\n\n    def unique_name(self):\n        self.series += 1\n        return \"_hy_hoisted_fn_%s\" % (self.series)\n\n    def visit(self, tree):\n        if isinstance(tree, HyExpression) and tree != []:\n            call = tree[0]\n            if call == \"fn\" and self.should_hoist():\n                new_name = HySymbol(self.unique_name())\n                new_name.replace(tree)\n                fn_def = HyExpression([HySymbol(\"def\"),\n                                       new_name,\n                                       tree])\n                fn_def.replace(tree)\n                self.hoist(fn_def)\n                return new_name\n\n\nclass IfMangle(HoistableMangle):\n    ignore = [\"foreach\", \"do\"]\n\n    def __init__(self):\n        self.series = 0\n\n    def visit(self, tree):\n        if isinstance(tree, HyExpression) and tree != []:\n            call = tree[0]\n            if call == \"if\" and self.should_hoist():\n                fn = HyExpression([HyExpression([HySymbol(\"fn\"),\n                                   HyList([]),\n                                   tree])])\n                fn.replace(tree)\n                return fn\n\n\nhy.mangle.MANGLES.append(IfMangle)\nhy.mangle.MANGLES.append(FunctionMangle)\n", "path": "hy/core/mangles.py"}]}