We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Readthedocs pain
Readthedocs (RTD) is a pain to work with and keeps having timeout errors.  I started to look into whether we can build the docs on our own and push them to RTD instead of having it built on the site.  It would also make more sense to have the doc build process as part of our CI process, rather than only checked after the fact.

Has there been any discussion about moving away from RTD before (at least the build process)?  If so, was there a reason not to move?  I assume it is too late to move back to hosting the docs on github, but I thought I'd check since it might be easier to do.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `doc/conf.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 #
3 # Sphinx documentation build configuration file, created by
4 # sphinx-quickstart.py on Sat Mar  8 21:47:50 2008.
5 #
6 # This file is execfile()d with the current directory set to its containing dir.
7 #
8 # The contents of this file are pickled, so don't put values in the namespace
9 # that aren't pickleable (module imports are okay, they're removed automatically).
10 #
11 # All configuration values have a default value; values that are commented out
12 # serve to show the default value.
13 from __future__ import print_function
14 
15 import sys
16 import os
17 from datetime import date
18 
19 from sphinx_gallery.sorting import ExplicitOrder
20 
21 # Check Sphinx version
22 import sphinx
23 if sphinx.__version__ < "1.3":
24     raise RuntimeError("Sphinx 1.3 or newer required")
25 
26 # Environment variable to know if the docs are being built on rtd.
27 on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
28 #print
29 #print("Building on ReadTheDocs: {}".format(on_rtd))
30 #print
31 #print("Current working directory: {}".format(os.path.abspath(os.curdir)))
32 #print("Python: {}".format(sys.executable))
33 
34 # If your extensions are in another directory, add it here.
35 # These locations are relative to conf.py
36 
37 # General configuration
38 # ---------------------
39 
40 # Add any Sphinx extension module names here, as strings. They can be extensions
41 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
42 extensions = [
43     'sphinx.ext.autosummary',
44     'sphinx.ext.autodoc',
45     'sphinx.ext.coverage',
46     'sphinx.ext.doctest',
47     'sphinx.ext.intersphinx',
48     'sphinx.ext.mathjax',
49     'sphinx.ext.napoleon',
50     'sphinx.ext.todo',
51     'sphinx.ext.viewcode',
52     'sphinx_gallery.gen_gallery',
53     'nb2plots',
54     'texext',
55 ]
56 
57 # https://github.com/sphinx-gallery/sphinx-gallery
58 sphinx_gallery_conf = {
59     # path to your examples scripts
60     'examples_dirs': '../examples',
61     'subsection_order': ExplicitOrder(['../examples/basic',
62                                        '../examples/drawing',
63                                        '../examples/graph',
64                                        '../examples/algorithms',
65                                        '../examples/advanced',
66                                        '../examples/3d_drawing',
67                                        '../examples/pygraphviz',
68                                        '../examples/javascript',
69                                        '../examples/jit',
70                                        '../examples/subclass']),
71     # path where to save gallery generated examples
72     'gallery_dirs': 'auto_examples',
73     'backreferences_dir': 'modules/generated',
74     'expected_failing_examples': ['../examples/advanced/plot_parallel_betweenness.py']
75 }
76 
77 # generate autosummary pages
78 autosummary_generate = True
79 
80 # Add any paths that contain templates here, relative to this directory.
81 #templates_path = ['']
82 
83 # The suffix of source filenames.
84 source_suffix = '.rst'
85 
86 # The encoding of source files.
87 source_encoding = 'utf-8'
88 
89 # The master toctree document.
90 master_doc = 'index'
91 
92 # General substitutions.
93 project = 'NetworkX'
94 copyright = '2004-{}, NetworkX Developers'.format(date.today().year)
95 
96 # The default replacements for |version| and |release|, also used in various
97 # other places throughout the built documents.
98 #
99 # The short X.Y version.
100 import networkx
101 version = networkx.__version__
102 # The full version, including dev info
103 release = networkx.__version__.replace('_', '')
104 
105 # There are two options for replacing |today|: either, you set today to some
106 # non-false value, then it is used:
107 #today = ''
108 # Else, today_fmt is used as the format for a strftime call.
109 #today_fmt = '%B %d, %Y'
110 
111 # List of documents that shouldn't be included in the build.
112 # unused_docs = ['']
113 
114 # If true, '()' will be appended to :func: etc. cross-reference text.
115 #add_function_parentheses = True
116 
117 # If true, the current module name will be prepended to all description
118 # unit titles (such as .. function::).
119 add_module_names = False
120 
121 # show_authors = True
122 
123 # The name of the Pygments (syntax highlighting) style to use.
124 #pygments_style = 'friendly'
125 pygments_style = 'sphinx'
126 
127 # A list of prefixs that are ignored when creating the module index. (new in Sphinx 0.6)
128 modindex_common_prefix = ['networkx.']
129 
130 doctest_global_setup = "import networkx as nx"
131 
132 # treat ``x, y : type`` as vars x and y instead of default ``y(x,) : type``
133 napoleon_use_param = False
134 
135 # Options for HTML output
136 # -----------------------
137 
138 if not on_rtd:
139     import sphinx_rtd_theme
140     html_theme = 'sphinx_rtd_theme'
141     html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
142 
143 # html_theme_options = {
144 #    "rightsidebar": "true",
145 #    "relbarbgcolor: "black"
146 #}
147 
148 # The style sheet to use for HTML and HTML Help pages. A file of that name
149 # must exist either in Sphinx' static/ path, or in one of the custom paths
150 # given in html_static_path.
151 #html_style = ''
152 
153 # Add any paths that contain custom static files (such as style sheets) here,
154 # relative to this directory. They are copied after the builtin static files,
155 # so a file named "default.css" will overwrite the builtin "default.css".
156 html_static_path = ['_static']
157 
158 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
159 # using the given strftime format.
160 html_last_updated_fmt = '%b %d, %Y'
161 
162 # If true, SmartyPants will be used to convert quotes and dashes to
163 # typographically correct entities.
164 #html_use_smartypants = True
165 
166 # Content template for the index page.
167 #html_index = 'index.html'
168 
169 # Custom sidebar templates, maps page names to templates.
170 #html_sidebars = {}
171 
172 # Additional templates that should be rendered to pages, maps page names to
173 # templates.
174 #html_additional_pages = {'': ''}
175 
176 # If true, the reST sources are included in the HTML build as _sources/<name>.
177 html_copy_source = False
178 
179 html_use_opensearch = 'http://networkx.github.io'
180 
181 # Output file base name for HTML help builder.
182 htmlhelp_basename = 'NetworkX'
183 
184 # Options for LaTeX output
185 # ------------------------
186 
187 # The paper size ('letter' or 'a4').
188 latex_paper_size = 'letter'
189 
190 # The font size ('10pt', '11pt' or '12pt').
191 #latex_font_size = '10pt'
192 
193 # Grouping the document tree into LaTeX files. List of tuples
194 # (source start file, target name, title, author, document class [howto/manual]).
195 latex_documents = [('reference/index', 'networkx_reference.tex',
196                     'NetworkX Reference',
197                     'Aric Hagberg, Dan Schult, Pieter Swart', 'manual', 1)]
198 
199 latex_appendices = ['tutorial']
200 
201 # Intersphinx mapping
202 intersphinx_mapping = {'https://docs.python.org/': None,
203                        'https://docs.scipy.org/doc/numpy/': None,
204                        }
205 
206 # The reST default role (used for this markup: `text`) to use for all
207 # documents.
208 default_role = 'obj'
209 
210 numpydoc_show_class_members = False
211 
212 # Add the 'copybutton' javascript, to hide/show the prompt in code
213 # examples
214 def setup(app):
215     app.add_javascript('copybutton.js')
216
```
--- 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/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -199,7 +199,7 @@
 latex_appendices = ['tutorial']
 
 # Intersphinx mapping
-intersphinx_mapping = {'https://docs.python.org/': None,
+intersphinx_mapping = {'https://docs.python.org/2/': None,
                        'https://docs.scipy.org/doc/numpy/': None,
                        }

{"golden_diff": "diff --git a/doc/conf.py b/doc/conf.py\n--- a/doc/conf.py\n+++ b/doc/conf.py\n@@ -199,7 +199,7 @@\n latex_appendices = ['tutorial']\n \n # Intersphinx mapping\n-intersphinx_mapping = {'https://docs.python.org/': None,\n+intersphinx_mapping = {'https://docs.python.org/2/': None,\n                        'https://docs.scipy.org/doc/numpy/': None,\n                        }\n", "issue": "Readthedocs pain\nReadthedocs (RTD) is a pain to work with and keeps having timeout errors.  I started to look into whether we can build the docs on our own and push them to RTD instead of having it built on the site.  It would also make more sense to have the doc build process as part of our CI process, rather than only checked after the fact.\r\n\r\nHas there been any discussion about moving away from RTD before (at least the build process)?  If so, was there a reason not to move?  I assume it is too late to move back to hosting the docs on github, but I thought I'd check since it might be easier to do.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Sphinx documentation build configuration file, created by\n# sphinx-quickstart.py on Sat Mar  8 21:47:50 2008.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# The contents of this file are pickled, so don't put values in the namespace\n# that aren't pickleable (module imports are okay, they're removed automatically).\n#\n# All configuration values have a default value; values that are commented out\n# serve to show the default value.\nfrom __future__ import print_function\n\nimport sys\nimport os\nfrom datetime import date\n\nfrom sphinx_gallery.sorting import ExplicitOrder\n\n# Check Sphinx version\nimport sphinx\nif sphinx.__version__ < \"1.3\":\n    raise RuntimeError(\"Sphinx 1.3 or newer required\")\n\n# Environment variable to know if the docs are being built on rtd.\non_rtd = os.environ.get('READTHEDOCS', None) == 'True'\n#print\n#print(\"Building on ReadTheDocs: {}\".format(on_rtd))\n#print\n#print(\"Current working directory: {}\".format(os.path.abspath(os.curdir)))\n#print(\"Python: {}\".format(sys.executable))\n\n# If your extensions are in another directory, add it here.\n# These locations are relative to conf.py\n\n# General configuration\n# ---------------------\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = [\n    'sphinx.ext.autosummary',\n    'sphinx.ext.autodoc',\n    'sphinx.ext.coverage',\n    'sphinx.ext.doctest',\n    'sphinx.ext.intersphinx',\n    'sphinx.ext.mathjax',\n    'sphinx.ext.napoleon',\n    'sphinx.ext.todo',\n    'sphinx.ext.viewcode',\n    'sphinx_gallery.gen_gallery',\n    'nb2plots',\n    'texext',\n]\n\n# https://github.com/sphinx-gallery/sphinx-gallery\nsphinx_gallery_conf = {\n    # path to your examples scripts\n    'examples_dirs': '../examples',\n    'subsection_order': ExplicitOrder(['../examples/basic',\n                                       '../examples/drawing',\n                                       '../examples/graph',\n                                       '../examples/algorithms',\n                                       '../examples/advanced',\n                                       '../examples/3d_drawing',\n                                       '../examples/pygraphviz',\n                                       '../examples/javascript',\n                                       '../examples/jit',\n                                       '../examples/subclass']),\n    # path where to save gallery generated examples\n    'gallery_dirs': 'auto_examples',\n    'backreferences_dir': 'modules/generated',\n    'expected_failing_examples': ['../examples/advanced/plot_parallel_betweenness.py']\n}\n\n# generate autosummary pages\nautosummary_generate = True\n\n# Add any paths that contain templates here, relative to this directory.\n#templates_path = ['']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\nsource_encoding = 'utf-8'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General substitutions.\nproject = 'NetworkX'\ncopyright = '2004-{}, NetworkX Developers'.format(date.today().year)\n\n# The default replacements for |version| and |release|, also used in various\n# other places throughout the built documents.\n#\n# The short X.Y version.\nimport networkx\nversion = networkx.__version__\n# The full version, including dev info\nrelease = networkx.__version__.replace('_', '')\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of documents that shouldn't be included in the build.\n# unused_docs = ['']\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\nadd_module_names = False\n\n# show_authors = True\n\n# The name of the Pygments (syntax highlighting) style to use.\n#pygments_style = 'friendly'\npygments_style = 'sphinx'\n\n# A list of prefixs that are ignored when creating the module index. (new in Sphinx 0.6)\nmodindex_common_prefix = ['networkx.']\n\ndoctest_global_setup = \"import networkx as nx\"\n\n# treat ``x, y : type`` as vars x and y instead of default ``y(x,) : type``\nnapoleon_use_param = False\n\n# Options for HTML output\n# -----------------------\n\nif not on_rtd:\n    import sphinx_rtd_theme\n    html_theme = 'sphinx_rtd_theme'\n    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]\n\n# html_theme_options = {\n#    \"rightsidebar\": \"true\",\n#    \"relbarbgcolor: \"black\"\n#}\n\n# The style sheet to use for HTML and HTML Help pages. A file of that name\n# must exist either in Sphinx' static/ path, or in one of the custom paths\n# given in html_static_path.\n#html_style = ''\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\nhtml_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Content template for the index page.\n#html_index = 'index.html'\n\n# Custom sidebar templates, maps page names to templates.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# templates.\n#html_additional_pages = {'': ''}\n\n# If true, the reST sources are included in the HTML build as _sources/<name>.\nhtml_copy_source = False\n\nhtml_use_opensearch = 'http://networkx.github.io'\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'NetworkX'\n\n# Options for LaTeX output\n# ------------------------\n\n# The paper size ('letter' or 'a4').\nlatex_paper_size = 'letter'\n\n# The font size ('10pt', '11pt' or '12pt').\n#latex_font_size = '10pt'\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, document class [howto/manual]).\nlatex_documents = [('reference/index', 'networkx_reference.tex',\n                    'NetworkX Reference',\n                    'Aric Hagberg, Dan Schult, Pieter Swart', 'manual', 1)]\n\nlatex_appendices = ['tutorial']\n\n# Intersphinx mapping\nintersphinx_mapping = {'https://docs.python.org/': None,\n                       'https://docs.scipy.org/doc/numpy/': None,\n                       }\n\n# The reST default role (used for this markup: `text`) to use for all\n# documents.\ndefault_role = 'obj'\n\nnumpydoc_show_class_members = False\n\n# Add the 'copybutton' javascript, to hide/show the prompt in code\n# examples\ndef setup(app):\n    app.add_javascript('copybutton.js')\n", "path": "doc/conf.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Sphinx documentation build configuration file, created by\n# sphinx-quickstart.py on Sat Mar  8 21:47:50 2008.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# The contents of this file are pickled, so don't put values in the namespace\n# that aren't pickleable (module imports are okay, they're removed automatically).\n#\n# All configuration values have a default value; values that are commented out\n# serve to show the default value.\nfrom __future__ import print_function\n\nimport sys\nimport os\nfrom datetime import date\n\nfrom sphinx_gallery.sorting import ExplicitOrder\n\n# Check Sphinx version\nimport sphinx\nif sphinx.__version__ < \"1.3\":\n    raise RuntimeError(\"Sphinx 1.3 or newer required\")\n\n# Environment variable to know if the docs are being built on rtd.\non_rtd = os.environ.get('READTHEDOCS', None) == 'True'\n#print\n#print(\"Building on ReadTheDocs: {}\".format(on_rtd))\n#print\n#print(\"Current working directory: {}\".format(os.path.abspath(os.curdir)))\n#print(\"Python: {}\".format(sys.executable))\n\n# If your extensions are in another directory, add it here.\n# These locations are relative to conf.py\n\n# General configuration\n# ---------------------\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = [\n    'sphinx.ext.autosummary',\n    'sphinx.ext.autodoc',\n    'sphinx.ext.coverage',\n    'sphinx.ext.doctest',\n    'sphinx.ext.intersphinx',\n    'sphinx.ext.mathjax',\n    'sphinx.ext.napoleon',\n    'sphinx.ext.todo',\n    'sphinx.ext.viewcode',\n    'sphinx_gallery.gen_gallery',\n    'nb2plots',\n    'texext',\n]\n\n# https://github.com/sphinx-gallery/sphinx-gallery\nsphinx_gallery_conf = {\n    # path to your examples scripts\n    'examples_dirs': '../examples',\n    'subsection_order': ExplicitOrder(['../examples/basic',\n                                       '../examples/drawing',\n                                       '../examples/graph',\n                                       '../examples/algorithms',\n                                       '../examples/advanced',\n                                       '../examples/3d_drawing',\n                                       '../examples/pygraphviz',\n                                       '../examples/javascript',\n                                       '../examples/jit',\n                                       '../examples/subclass']),\n    # path where to save gallery generated examples\n    'gallery_dirs': 'auto_examples',\n    'backreferences_dir': 'modules/generated',\n    'expected_failing_examples': ['../examples/advanced/plot_parallel_betweenness.py']\n}\n\n# generate autosummary pages\nautosummary_generate = True\n\n# Add any paths that contain templates here, relative to this directory.\n#templates_path = ['']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\nsource_encoding = 'utf-8'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General substitutions.\nproject = 'NetworkX'\ncopyright = '2004-{}, NetworkX Developers'.format(date.today().year)\n\n# The default replacements for |version| and |release|, also used in various\n# other places throughout the built documents.\n#\n# The short X.Y version.\nimport networkx\nversion = networkx.__version__\n# The full version, including dev info\nrelease = networkx.__version__.replace('_', '')\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of documents that shouldn't be included in the build.\n# unused_docs = ['']\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\nadd_module_names = False\n\n# show_authors = True\n\n# The name of the Pygments (syntax highlighting) style to use.\n#pygments_style = 'friendly'\npygments_style = 'sphinx'\n\n# A list of prefixs that are ignored when creating the module index. (new in Sphinx 0.6)\nmodindex_common_prefix = ['networkx.']\n\ndoctest_global_setup = \"import networkx as nx\"\n\n# treat ``x, y : type`` as vars x and y instead of default ``y(x,) : type``\nnapoleon_use_param = False\n\n# Options for HTML output\n# -----------------------\n\nif not on_rtd:\n    import sphinx_rtd_theme\n    html_theme = 'sphinx_rtd_theme'\n    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]\n\n# html_theme_options = {\n#    \"rightsidebar\": \"true\",\n#    \"relbarbgcolor: \"black\"\n#}\n\n# The style sheet to use for HTML and HTML Help pages. A file of that name\n# must exist either in Sphinx' static/ path, or in one of the custom paths\n# given in html_static_path.\n#html_style = ''\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\nhtml_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Content template for the index page.\n#html_index = 'index.html'\n\n# Custom sidebar templates, maps page names to templates.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# templates.\n#html_additional_pages = {'': ''}\n\n# If true, the reST sources are included in the HTML build as _sources/<name>.\nhtml_copy_source = False\n\nhtml_use_opensearch = 'http://networkx.github.io'\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'NetworkX'\n\n# Options for LaTeX output\n# ------------------------\n\n# The paper size ('letter' or 'a4').\nlatex_paper_size = 'letter'\n\n# The font size ('10pt', '11pt' or '12pt').\n#latex_font_size = '10pt'\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, document class [howto/manual]).\nlatex_documents = [('reference/index', 'networkx_reference.tex',\n                    'NetworkX Reference',\n                    'Aric Hagberg, Dan Schult, Pieter Swart', 'manual', 1)]\n\nlatex_appendices = ['tutorial']\n\n# Intersphinx mapping\nintersphinx_mapping = {'https://docs.python.org/2/': None,\n                       'https://docs.scipy.org/doc/numpy/': None,\n                       }\n\n# The reST default role (used for this markup: `text`) to use for all\n# documents.\ndefault_role = 'obj'\n\nnumpydoc_show_class_members = False\n\n# Add the 'copybutton' javascript, to hide/show the prompt in code\n# examples\ndef setup(app):\n    app.add_javascript('copybutton.js')\n", "path": "doc/conf.py"}]}