21
21
import sys
22
22
import shutil
23
23
from unittest .mock import MagicMock
24
+
24
25
sys .path .append (os .path .abspath (os .path .join (__file__ , ".." , ".." , ".." )))
25
26
26
27
# Mechanism to mock out modules
27
28
class ModuleMock (object ):
28
29
def __init__ (self , * args , ** kwargs ):
29
30
pass
30
31
32
+
31
33
# Putting all of our dirty hacks together
32
34
class Mock (MagicMock ):
33
35
__metaclass__ = type
@@ -59,13 +61,18 @@ def __getattr__(cls, name):
59
61
"torch.utils" ,
60
62
"torch.utils.data" ,
61
63
"torch.utils.cpp_extension" ,
62
- "numpy"
64
+ "numpy" ,
63
65
]
64
66
sys .modules .update ((mod_name , Mock ()) for mod_name in MOCK_MODULES )
65
67
66
68
import sphinx_rtd_theme
67
- examples_source = os .path .abspath (os .path .join (os .path .dirname (__file__ ), ".." , ".." , "examples" , "tutorial" ))
68
- examples_dest = os .path .abspath (os .path .join (os .path .dirname (__file__ ), "examples" , "tutorial" ))
69
+
70
+ examples_source = os .path .abspath (
71
+ os .path .join (os .path .dirname (__file__ ), ".." , ".." , "examples" , "tutorial" )
72
+ )
73
+ examples_dest = os .path .abspath (
74
+ os .path .join (os .path .dirname (__file__ ), "examples" , "tutorial" )
75
+ )
69
76
70
77
if os .path .exists (examples_dest ):
71
78
shutil .rmtree (examples_dest )
@@ -91,36 +98,38 @@ def __getattr__(cls, name):
91
98
# Add any Sphinx extension module names here, as strings. They can be
92
99
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
93
100
# ones.
94
- extensions = ['sphinx.ext.autodoc' ,
95
- 'sphinx.ext.mathjax' ,
96
- 'sphinx.ext.viewcode' ,
97
- 'nbsphinx' ]
101
+ extensions = [
102
+ "sphinx.ext.autodoc" ,
103
+ "sphinx.ext.mathjax" ,
104
+ "sphinx.ext.viewcode" ,
105
+ "nbsphinx" ,
106
+ ]
98
107
99
108
# Add any paths that contain templates here, relative to this directory.
100
- templates_path = [' ntemplates' ]
109
+ templates_path = [" ntemplates" ]
101
110
102
111
# The suffix(es) of source filenames.
103
112
# You can specify multiple suffix as a list of string:
104
113
#
105
114
# source_suffix = ['.rst', '.md']
106
- source_suffix = ' .rst'
115
+ source_suffix = " .rst"
107
116
108
117
# The master toctree document.
109
- master_doc = ' index'
118
+ master_doc = " index"
110
119
111
120
# General information about the project.
112
- project = ' QPyTorch'
113
- copyright = ' 2019, Tianyi Zhang, Zhiqiu Lin, Guandao Yang, Christopher De Sa'
114
- author = ' Tianyi Zhang, Zhiqiu Lin, Guandao Yang, Christopher De Sa'
121
+ project = " QPyTorch"
122
+ copyright = " 2019, Tianyi Zhang, Zhiqiu Lin, Guandao Yang, Christopher De Sa"
123
+ author = " Tianyi Zhang, Zhiqiu Lin, Guandao Yang, Christopher De Sa"
115
124
116
125
# The version info for the project you're documenting, acts as replacement for
117
126
# |version| and |release|, also used in various other places throughout the
118
127
# built documents.
119
128
#
120
129
# The short X.Y version.
121
- version = ' 0.0.1'
130
+ version = " 0.0.1"
122
131
# The full version, including alpha/beta/rc tags.
123
- release = ' 0.0.1 alpha'
132
+ release = " 0.0.1 alpha"
124
133
125
134
# The language for content autogenerated by Sphinx. Refer to documentation
126
135
# for a list of supported languages.
@@ -135,7 +144,7 @@ def __getattr__(cls, name):
135
144
exclude_patterns = []
136
145
137
146
# The name of the Pygments (syntax highlighting) style to use.
138
- pygments_style = ' sphinx'
147
+ pygments_style = " sphinx"
139
148
140
149
# If true, `todo` and `todoList` produce output, else they produce nothing.
141
150
todo_include_todos = False
@@ -146,7 +155,7 @@ def __getattr__(cls, name):
146
155
# The theme to use for HTML and HTML Help pages. See the documentation for
147
156
# a list of builtin themes.
148
157
#
149
- html_theme = ' sphinx_rtd_theme'
158
+ html_theme = " sphinx_rtd_theme"
150
159
html_theme_path = [sphinx_rtd_theme .get_html_theme_path ()]
151
160
html_theme_options = {
152
161
"collapse_navigation" : False ,
@@ -162,13 +171,13 @@ def __getattr__(cls, name):
162
171
# Add any paths that contain custom static files (such as style sheets) here,
163
172
# relative to this directory. They are copied after the builtin static files,
164
173
# so a file named "default.css" will overwrite the builtin "default.css".
165
- html_static_path = [' nstatic' ]
174
+ html_static_path = [" nstatic" ]
166
175
167
176
168
177
# -- Options for HTMLHelp output ------------------------------------------
169
178
170
179
# Output file base name for HTML help builder.
171
- htmlhelp_basename = ' QPyTorchdoc'
180
+ htmlhelp_basename = " QPyTorchdoc"
172
181
173
182
174
183
# -- Options for LaTeX output ---------------------------------------------
@@ -177,15 +186,12 @@ def __getattr__(cls, name):
177
186
# The paper size ('letterpaper' or 'a4paper').
178
187
#
179
188
# 'papersize': 'letterpaper',
180
-
181
189
# The font size ('10pt', '11pt' or '12pt').
182
190
#
183
191
# 'pointsize': '10pt',
184
-
185
192
# Additional stuff for the LaTeX preamble.
186
193
#
187
194
# 'preamble': '',
188
-
189
195
# Latex figure (float) alignment
190
196
#
191
197
# 'figure_align': 'htbp',
@@ -195,19 +201,21 @@ def __getattr__(cls, name):
195
201
# (source start file, target name, title,
196
202
# author, documentclass [howto, manual, or own class]).
197
203
latex_documents = [
198
- (master_doc , 'QPyTorch.tex' , 'QPyTorch Documentation' ,
199
- 'Tianyi Zhang, Zhiqiu Lin, Christopher De Sa' , 'manual' ),
204
+ (
205
+ master_doc ,
206
+ "QPyTorch.tex" ,
207
+ "QPyTorch Documentation" ,
208
+ "Tianyi Zhang, Zhiqiu Lin, Christopher De Sa" ,
209
+ "manual" ,
210
+ ),
200
211
]
201
212
202
213
autodoc_inherit_docstrings = False
203
214
# -- Options for manual page output ---------------------------------------
204
215
205
216
# One entry per manual page. List of tuples
206
217
# (source start file, name, description, authors, manual section).
207
- man_pages = [
208
- (master_doc , 'qpytorch' , 'QPyTorch Documentation' ,
209
- [author ], 1 )
210
- ]
218
+ man_pages = [(master_doc , "qpytorch" , "QPyTorch Documentation" , [author ], 1 )]
211
219
212
220
213
221
# -- Options for Texinfo output -------------------------------------------
@@ -216,7 +224,13 @@ def __getattr__(cls, name):
216
224
# (source start file, target name, title, author,
217
225
# dir menu entry, description, category)
218
226
texinfo_documents = [
219
- (master_doc , 'QPyTorch' , 'QPyTorch Documentation' ,
220
- author , 'QPyTorch' , 'One line description of project.' ,
221
- 'Miscellaneous' ),
227
+ (
228
+ master_doc ,
229
+ "QPyTorch" ,
230
+ "QPyTorch Documentation" ,
231
+ author ,
232
+ "QPyTorch" ,
233
+ "One line description of project." ,
234
+ "Miscellaneous" ,
235
+ ),
222
236
]
0 commit comments