prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Docs build script requires `path.py` without specifying it as a dependency.
  We should probably just remove it.
  
  
  </issue>
  <code>
  [start of docs/deploy.py]
  1 #!/usr/bin/env python
  2 from __future__ import print_function
  3 from contextlib import contextmanager
  4 from glob import glob
  5 from path import path
  6 import os
  7 from os.path import abspath, basename, dirname, exists, isfile
  8 from shutil import move, rmtree
  9 from subprocess import check_call
  10 
  11 HERE = dirname(abspath(__file__))
  12 ZIPLINE_ROOT = dirname(HERE)
  13 TEMP_LOCATION = '/tmp/zipline-doc'
  14 TEMP_LOCATION_GLOB = TEMP_LOCATION + '/*'
  15 
  16 
  17 @contextmanager
  18 def removing(path):
  19     try:
  20         yield
  21     finally:
  22         rmtree(path)
  23 
  24 
  25 def ensure_not_exists(path):
  26     if not exists(path):
  27         return
  28     if isfile(path):
  29         os.unlink(path)
  30     else:
  31         rmtree(path)
  32 
  33 
  34 def main():
  35     print("Moving to %s." % HERE)
  36     with path(HERE):
  37         print("Building docs with 'make html'")
  38         check_call(['make', 'html'])
  39 
  40         print("Clearing temp location '%s'" % TEMP_LOCATION)
  41         rmtree(TEMP_LOCATION, ignore_errors=True)
  42 
  43         with removing(TEMP_LOCATION):
  44             print("Copying built files to temp location.")
  45             move('build/html', TEMP_LOCATION)
  46 
  47             print("Moving to '%s'" % ZIPLINE_ROOT)
  48             os.chdir(ZIPLINE_ROOT)
  49 
  50             print("Checking out gh-pages branch.")
  51             check_call(
  52                 [
  53                     'git', 'branch', '-f',
  54                     '--track', 'gh-pages', 'origin/gh-pages'
  55                 ]
  56             )
  57             check_call(['git', 'checkout', 'gh-pages'])
  58             check_call(['git', 'reset', '--hard', 'origin/gh-pages'])
  59 
  60             print("Copying built files:")
  61             for file_ in glob(TEMP_LOCATION_GLOB):
  62                 base = basename(file_)
  63 
  64                 print("%s -> %s" % (file_, base))
  65                 ensure_not_exists(base)
  66                 move(file_, '.')
  67 
  68     print()
  69     print("Updated documentation branch in directory %s" % ZIPLINE_ROOT)
  70     print("If you are happy with these changes, commit and push to gh-pages.")
  71 
  72 if __name__ == '__main__':
  73     main()
  74
  [end of docs/deploy.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/docs/deploy.py b/docs/deploy.py
  --- a/docs/deploy.py
  +++ b/docs/deploy.py
  @@ -2,7 +2,6 @@
   from __future__ import print_function
   from contextlib import contextmanager
   from glob import glob
  -from path import path
   import os
   from os.path import abspath, basename, dirname, exists, isfile
   from shutil import move, rmtree
  @@ -32,8 +31,11 @@
   
   
   def main():
  +    old_dir = os.getcwd()
       print("Moving to %s." % HERE)
  -    with path(HERE):
  +    os.chdir(HERE)
  +
  +    try:
           print("Building docs with 'make html'")
           check_call(['make', 'html'])
   
  @@ -64,6 +66,8 @@
                   print("%s -> %s" % (file_, base))
                   ensure_not_exists(base)
                   move(file_, '.')
  +    finally:
  +        os.chdir(old_dir)
   
       print()
       print("Updated documentation branch in directory %s" % ZIPLINE_ROOT)
  
verification_info: {"golden_diff": "diff --git a/docs/deploy.py b/docs/deploy.py\n--- a/docs/deploy.py\n+++ b/docs/deploy.py\n@@ -2,7 +2,6 @@\n from __future__ import print_function\n from contextlib import contextmanager\n from glob import glob\n-from path import path\n import os\n from os.path import abspath, basename, dirname, exists, isfile\n from shutil import move, rmtree\n@@ -32,8 +31,11 @@\n \n \n def main():\n+    old_dir = os.getcwd()\n     print(\"Moving to %s.\" % HERE)\n-    with path(HERE):\n+    os.chdir(HERE)\n+\n+    try:\n         print(\"Building docs with 'make html'\")\n         check_call(['make', 'html'])\n \n@@ -64,6 +66,8 @@\n                 print(\"%s -> %s\" % (file_, base))\n                 ensure_not_exists(base)\n                 move(file_, '.')\n+    finally:\n+        os.chdir(old_dir)\n \n     print()\n     print(\"Updated documentation branch in directory %s\" % ZIPLINE_ROOT)\n", "issue": "Docs build script requires `path.py` without specifying it as a dependency.\nWe should probably just remove it.\n\n", "before_files": [{"content": "#!/usr/bin/env python\nfrom __future__ import print_function\nfrom contextlib import contextmanager\nfrom glob import glob\nfrom path import path\nimport os\nfrom os.path import abspath, basename, dirname, exists, isfile\nfrom shutil import move, rmtree\nfrom subprocess import check_call\n\nHERE = dirname(abspath(__file__))\nZIPLINE_ROOT = dirname(HERE)\nTEMP_LOCATION = '/tmp/zipline-doc'\nTEMP_LOCATION_GLOB = TEMP_LOCATION + '/*'\n\n\n@contextmanager\ndef removing(path):\n    try:\n        yield\n    finally:\n        rmtree(path)\n\n\ndef ensure_not_exists(path):\n    if not exists(path):\n        return\n    if isfile(path):\n        os.unlink(path)\n    else:\n        rmtree(path)\n\n\ndef main():\n    print(\"Moving to %s.\" % HERE)\n    with path(HERE):\n        print(\"Building docs with 'make html'\")\n        check_call(['make', 'html'])\n\n        print(\"Clearing temp location '%s'\" % TEMP_LOCATION)\n        rmtree(TEMP_LOCATION, ignore_errors=True)\n\n        with removing(TEMP_LOCATION):\n            print(\"Copying built files to temp location.\")\n            move('build/html', TEMP_LOCATION)\n\n            print(\"Moving to '%s'\" % ZIPLINE_ROOT)\n            os.chdir(ZIPLINE_ROOT)\n\n            print(\"Checking out gh-pages branch.\")\n            check_call(\n                [\n                    'git', 'branch', '-f',\n                    '--track', 'gh-pages', 'origin/gh-pages'\n                ]\n            )\n            check_call(['git', 'checkout', 'gh-pages'])\n            check_call(['git', 'reset', '--hard', 'origin/gh-pages'])\n\n            print(\"Copying built files:\")\n            for file_ in glob(TEMP_LOCATION_GLOB):\n                base = basename(file_)\n\n                print(\"%s -> %s\" % (file_, base))\n                ensure_not_exists(base)\n                move(file_, '.')\n\n    print()\n    print(\"Updated documentation branch in directory %s\" % ZIPLINE_ROOT)\n    print(\"If you are happy with these changes, commit and push to gh-pages.\")\n\nif __name__ == '__main__':\n    main()\n", "path": "docs/deploy.py"}]}