We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Docs build script requires `path.py` without specifying it as a dependency.
We should probably just remove it.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docs/deploy.py`
Content:
```
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 FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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)

{"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"}], "after_files": [{"content": "#!/usr/bin/env python\nfrom __future__ import print_function\nfrom contextlib import contextmanager\nfrom glob import glob\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    old_dir = os.getcwd()\n    print(\"Moving to %s.\" % HERE)\n    os.chdir(HERE)\n\n    try:\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    finally:\n        os.chdir(old_dir)\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"}]}