@@ -70,10 +70,11 @@ def _generate_exclude_pattern(include_api=True, single_doc=None):
70
70
return exclude_patterns
71
71
72
72
73
- def _generate_temp_docstring_file (method ):
73
+ def _generate_temp_docstring_file (methods ):
74
74
"""
75
75
"""
76
- fname = os .path .join (SOURCE_PATH , 'generated' , '{}.rst' .format (method ))
76
+ fnames = [os .path .join (SOURCE_PATH , 'generated' , '{}.rst' .format (method ))
77
+ for method in methods ]
77
78
78
79
# # remove the target file to make sure it is updated again (to build
79
80
# # latest version)
@@ -92,20 +93,21 @@ def _generate_temp_docstring_file(method):
92
93
except OSError :
93
94
pass
94
95
95
- if os .path .exists (fname ):
96
- # link the target file
97
- try :
98
- # os.symlink(fname, os.path.join(SOURCE_PATH, 'generated_temp',
99
- # '{}.rst'.format(method)),
100
- # target_is_directory=False)
101
- # copying to make sure sphinx always thinks it is new
102
- # and needs to be re-generated (to pick source code changes)
103
- shutil .copy (fname , os .path .join (SOURCE_PATH , 'generated_temp' ))
104
- linked = True
105
- except : # noqa
96
+ for fname in fnames :
97
+ if os .path .exists (fname ):
98
+ # link the target file
99
+ try :
100
+ # os.symlink(fname, os.path.join(SOURCE_PATH, 'generated_temp',
101
+ # '{}.rst'.format(method)),
102
+ # target_is_directory=False)
103
+ # copying to make sure sphinx always thinks it is new
104
+ # and needs to be re-generated (to pick source code changes)
105
+ shutil .copy (fname , os .path .join (SOURCE_PATH , 'generated_temp' ))
106
+ linked = True
107
+ except : # noqa
108
+ linked = False
109
+ else :
106
110
linked = False
107
- else :
108
- linked = False
109
111
110
112
s = """Built docstrings
111
113
================
@@ -114,7 +116,7 @@ def _generate_temp_docstring_file(method):
114
116
{toctree}
115
117
{name}
116
118
117
- """ .format (name = method ,
119
+ """ .format (name = ' \n ' . join ( methods ) ,
118
120
toctree = ':toctree: generated_temp/\n ' if not linked else '' )
119
121
120
122
with open (os .path .join (SOURCE_PATH , "temp.rst" ), 'w' ) as f :
@@ -327,6 +329,7 @@ def main():
327
329
argparser .add_argument ('--docstring' ,
328
330
metavar = 'FILENAME' ,
329
331
type = str ,
332
+ nargs = '*' ,
330
333
default = None ,
331
334
help = ('method or function name to compile, '
332
335
'e.g. "DataFrame.join"' ))
@@ -346,8 +349,13 @@ def main():
346
349
_generate_index (single_doc = 'temp.rst' )
347
350
DocBuilder (args .num_jobs , exclude_patterns ).build_docstring ()
348
351
# open generated page in new browser tab
349
- url = os .path .join ("file://" , DOC_PATH , "build" , "html" ,
350
- "generated_temp" , "{}.html" .format (args .docstring ))
352
+ if len (args .docstring ) == 1 :
353
+ url = os .path .join (
354
+ "file://" , DOC_PATH , "build" , "html" ,
355
+ "generated_temp" , "{}.html" .format (args .docstring [0 ]))
356
+ else :
357
+ url = os .path .join (
358
+ "file://" , DOC_PATH , "build" , "html" , "temp.html" )
351
359
webbrowser .open (url , new = 2 )
352
360
# clean-up generated files
353
361
os .remove ('source/temp.rst' )
0 commit comments