prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  "Edit on Github" link broken in ReadTheDocs
  http://fake-factory.readthedocs.org/en/latest/locales.html
  
  Clicking "Edit on Github" results in a 404 error.
  
  EDIT: 
  http://fake-factory.readthedocs.org/en/latest/ has a github link to `https://github.com/joke2k/faker/blob/docs/docs/index.rst` when the correct link is
  `https://github.com/joke2k/faker/blob/master/docs/index.rst`
  (Note the doubled up `docs/docs` instead of `master/docs`)
  
  
  </issue>
  <code>
  [start of faker/build_docs.py]
  1 # coding=utf-8
  2 
  3 from __future__ import print_function, unicode_literals
  4 
  5 import os
  6 import pprint
  7 import sys
  8 
  9 import six
  10 
  11 DOCS_ROOT = os.path.abspath(os.path.join('..', 'docs'))
  12 
  13 
  14 def write(fh, s):
  15     return fh.write(s.encode('utf-8'))
  16 
  17 
  18 def write_provider(fh, doc, provider, formatters, excludes=None):
  19 
  20     if excludes is None:
  21         excludes = []
  22 
  23     write(fh, '\n')
  24     title = "``{0}``".format(doc.get_provider_name(provider))
  25     write(fh, '%s\n' % title)
  26     write(fh, "-" * len(title))
  27     write(fh, '\n\n::\n')
  28 
  29     for signature, example in formatters.items():
  30         if signature in excludes:
  31             continue
  32         try:
  33             # `pprint` can't format sets of heterogenous types.
  34             if not isinstance(example, set):
  35                 example = pprint.pformat(example, indent=4)
  36             lines = six.text_type(example).expandtabs().splitlines()
  37         except UnicodeEncodeError:
  38             msg = 'error on "{0}" with value "{1}"'.format(signature, example)
  39             raise Exception(msg)
  40         write(fh, '\n')
  41         write(fh, "\t{fake}\n{example}\n".format(
  42             fake=signature,
  43             example='\n'.join(['\t# ' + line for line in lines]),
  44         ))
  45 
  46 
  47 def write_docs(*args, **kwargs):
  48     from faker import Faker, documentor
  49     from faker.config import DEFAULT_LOCALE, AVAILABLE_LOCALES
  50 
  51     fake = Faker(locale=DEFAULT_LOCALE)
  52 
  53     from faker.providers import BaseProvider
  54     base_provider_formatters = [f for f in dir(BaseProvider)]
  55 
  56     doc = documentor.Documentor(fake)
  57 
  58     formatters = doc.get_formatters(with_args=True, with_defaults=True)
  59 
  60     for provider, fakers in formatters:
  61         provider_name = doc.get_provider_name(provider)
  62         fname = os.path.join(DOCS_ROOT, 'providers', '%s.rst' % provider_name)
  63         with open(fname, 'wb') as fh:
  64             write_provider(fh, doc, provider, fakers)
  65 
  66     with open(os.path.join(DOCS_ROOT, 'providers.rst'), 'wb') as fh:
  67         write(fh, 'Providers\n')
  68         write(fh, '=========\n')
  69         write(fh, '.. toctree::\n')
  70         write(fh, '   :maxdepth: 2\n\n')
  71         [write(fh, '   providers/%s\n' % doc.get_provider_name(provider))
  72          for provider, fakers in formatters]
  73 
  74     AVAILABLE_LOCALES = sorted(AVAILABLE_LOCALES)
  75     for lang in AVAILABLE_LOCALES:
  76         fname = os.path.join(DOCS_ROOT, 'locales', '%s.rst' % lang)
  77         with open(fname, 'wb') as fh:
  78             write(fh, '\n')
  79             title = 'Language {0}\n'.format(lang)
  80             write(fh, title)
  81             write(fh, '=' * len(title))
  82             write(fh, '\n')
  83             fake = Faker(locale=lang)
  84             d = documentor.Documentor(fake)
  85 
  86             for p, fs in d.get_formatters(with_args=True, with_defaults=True,
  87                                           locale=lang,
  88                                           excludes=base_provider_formatters):
  89                 write_provider(fh, d, p, fs)
  90 
  91     with open(os.path.join(DOCS_ROOT, 'locales.rst'), 'wb') as fh:
  92         write(fh, 'Locales\n')
  93         write(fh, '=======\n')
  94         write(fh, '.. toctree::\n')
  95         write(fh, '   :maxdepth: 2\n\n')
  96         [write(fh, '   locales/%s\n' % lang) for lang in AVAILABLE_LOCALES]
  97 
  98 
  99 # wrappers for sphinx
  100 def _main(app, *args, **kwargs):
  101     return write_docs(*args, **kwargs)
  102 
  103 
  104 def setup(app):
  105     app.connect(str('builder-inited'), _main)
  106 
  107 
  108 if __name__ == "__main__":
  109     write_docs(*sys.argv[1:])
  110
  [end of faker/build_docs.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/faker/build_docs.py b/faker/build_docs.py
  --- a/faker/build_docs.py
  +++ b/faker/build_docs.py
  @@ -61,9 +61,11 @@
           provider_name = doc.get_provider_name(provider)
           fname = os.path.join(DOCS_ROOT, 'providers', '%s.rst' % provider_name)
           with open(fname, 'wb') as fh:
  +            write(fh, ':github_url: hide\n\n')
               write_provider(fh, doc, provider, fakers)
   
       with open(os.path.join(DOCS_ROOT, 'providers.rst'), 'wb') as fh:
  +        write(fh, ':github_url: hide\n\n')
           write(fh, 'Providers\n')
           write(fh, '=========\n')
           write(fh, '.. toctree::\n')
  @@ -75,7 +77,7 @@
       for lang in AVAILABLE_LOCALES:
           fname = os.path.join(DOCS_ROOT, 'locales', '%s.rst' % lang)
           with open(fname, 'wb') as fh:
  -            write(fh, '\n')
  +            write(fh, ':github_url: hide\n\n')
               title = 'Language {0}\n'.format(lang)
               write(fh, title)
               write(fh, '=' * len(title))
  @@ -89,6 +91,7 @@
                   write_provider(fh, d, p, fs)
   
       with open(os.path.join(DOCS_ROOT, 'locales.rst'), 'wb') as fh:
  +        write(fh, ':github_url: hide\n\n')
           write(fh, 'Locales\n')
           write(fh, '=======\n')
           write(fh, '.. toctree::\n')
  
verification_info: {"golden_diff": "diff --git a/faker/build_docs.py b/faker/build_docs.py\n--- a/faker/build_docs.py\n+++ b/faker/build_docs.py\n@@ -61,9 +61,11 @@\n         provider_name = doc.get_provider_name(provider)\n         fname = os.path.join(DOCS_ROOT, 'providers', '%s.rst' % provider_name)\n         with open(fname, 'wb') as fh:\n+            write(fh, ':github_url: hide\\n\\n')\n             write_provider(fh, doc, provider, fakers)\n \n     with open(os.path.join(DOCS_ROOT, 'providers.rst'), 'wb') as fh:\n+        write(fh, ':github_url: hide\\n\\n')\n         write(fh, 'Providers\\n')\n         write(fh, '=========\\n')\n         write(fh, '.. toctree::\\n')\n@@ -75,7 +77,7 @@\n     for lang in AVAILABLE_LOCALES:\n         fname = os.path.join(DOCS_ROOT, 'locales', '%s.rst' % lang)\n         with open(fname, 'wb') as fh:\n-            write(fh, '\\n')\n+            write(fh, ':github_url: hide\\n\\n')\n             title = 'Language {0}\\n'.format(lang)\n             write(fh, title)\n             write(fh, '=' * len(title))\n@@ -89,6 +91,7 @@\n                 write_provider(fh, d, p, fs)\n \n     with open(os.path.join(DOCS_ROOT, 'locales.rst'), 'wb') as fh:\n+        write(fh, ':github_url: hide\\n\\n')\n         write(fh, 'Locales\\n')\n         write(fh, '=======\\n')\n         write(fh, '.. toctree::\\n')\n", "issue": "\"Edit on Github\" link broken in ReadTheDocs\nhttp://fake-factory.readthedocs.org/en/latest/locales.html\n\nClicking \"Edit on Github\" results in a 404 error.\n\nEDIT: \nhttp://fake-factory.readthedocs.org/en/latest/ has a github link to `https://github.com/joke2k/faker/blob/docs/docs/index.rst` when the correct link is\n`https://github.com/joke2k/faker/blob/master/docs/index.rst`\n(Note the doubled up `docs/docs` instead of `master/docs`)\n\n", "before_files": [{"content": "# coding=utf-8\n\nfrom __future__ import print_function, unicode_literals\n\nimport os\nimport pprint\nimport sys\n\nimport six\n\nDOCS_ROOT = os.path.abspath(os.path.join('..', 'docs'))\n\n\ndef write(fh, s):\n    return fh.write(s.encode('utf-8'))\n\n\ndef write_provider(fh, doc, provider, formatters, excludes=None):\n\n    if excludes is None:\n        excludes = []\n\n    write(fh, '\\n')\n    title = \"``{0}``\".format(doc.get_provider_name(provider))\n    write(fh, '%s\\n' % title)\n    write(fh, \"-\" * len(title))\n    write(fh, '\\n\\n::\\n')\n\n    for signature, example in formatters.items():\n        if signature in excludes:\n            continue\n        try:\n            # `pprint` can't format sets of heterogenous types.\n            if not isinstance(example, set):\n                example = pprint.pformat(example, indent=4)\n            lines = six.text_type(example).expandtabs().splitlines()\n        except UnicodeEncodeError:\n            msg = 'error on \"{0}\" with value \"{1}\"'.format(signature, example)\n            raise Exception(msg)\n        write(fh, '\\n')\n        write(fh, \"\\t{fake}\\n{example}\\n\".format(\n            fake=signature,\n            example='\\n'.join(['\\t# ' + line for line in lines]),\n        ))\n\n\ndef write_docs(*args, **kwargs):\n    from faker import Faker, documentor\n    from faker.config import DEFAULT_LOCALE, AVAILABLE_LOCALES\n\n    fake = Faker(locale=DEFAULT_LOCALE)\n\n    from faker.providers import BaseProvider\n    base_provider_formatters = [f for f in dir(BaseProvider)]\n\n    doc = documentor.Documentor(fake)\n\n    formatters = doc.get_formatters(with_args=True, with_defaults=True)\n\n    for provider, fakers in formatters:\n        provider_name = doc.get_provider_name(provider)\n        fname = os.path.join(DOCS_ROOT, 'providers', '%s.rst' % provider_name)\n        with open(fname, 'wb') as fh:\n            write_provider(fh, doc, provider, fakers)\n\n    with open(os.path.join(DOCS_ROOT, 'providers.rst'), 'wb') as fh:\n        write(fh, 'Providers\\n')\n        write(fh, '=========\\n')\n        write(fh, '.. toctree::\\n')\n        write(fh, '   :maxdepth: 2\\n\\n')\n        [write(fh, '   providers/%s\\n' % doc.get_provider_name(provider))\n         for provider, fakers in formatters]\n\n    AVAILABLE_LOCALES = sorted(AVAILABLE_LOCALES)\n    for lang in AVAILABLE_LOCALES:\n        fname = os.path.join(DOCS_ROOT, 'locales', '%s.rst' % lang)\n        with open(fname, 'wb') as fh:\n            write(fh, '\\n')\n            title = 'Language {0}\\n'.format(lang)\n            write(fh, title)\n            write(fh, '=' * len(title))\n            write(fh, '\\n')\n            fake = Faker(locale=lang)\n            d = documentor.Documentor(fake)\n\n            for p, fs in d.get_formatters(with_args=True, with_defaults=True,\n                                          locale=lang,\n                                          excludes=base_provider_formatters):\n                write_provider(fh, d, p, fs)\n\n    with open(os.path.join(DOCS_ROOT, 'locales.rst'), 'wb') as fh:\n        write(fh, 'Locales\\n')\n        write(fh, '=======\\n')\n        write(fh, '.. toctree::\\n')\n        write(fh, '   :maxdepth: 2\\n\\n')\n        [write(fh, '   locales/%s\\n' % lang) for lang in AVAILABLE_LOCALES]\n\n\n# wrappers for sphinx\ndef _main(app, *args, **kwargs):\n    return write_docs(*args, **kwargs)\n\n\ndef setup(app):\n    app.connect(str('builder-inited'), _main)\n\n\nif __name__ == \"__main__\":\n    write_docs(*sys.argv[1:])\n", "path": "faker/build_docs.py"}]}