@@ -423,42 +423,3 @@ def get_doc_object(obj, what=None, doc=None, config={}, builder=None):
423423 if doc is None :
424424 doc = pydoc .getdoc (obj )
425425 return SphinxObjDoc (obj , doc , config = config )
426-
427-
428- if __name__ == '__main__' :
429- import argparse
430- import importlib
431- import ast
432-
433- descr = 'Test numpydoc docstring generation for a given object'
434- ap = argparse .ArgumentParser (description = descr )
435- ap .add_argument ('import_path' , help = 'e.g. numpy.ndarray' )
436-
437- def _parse_config (s ):
438- key , _ , value = s .partition ('=' )
439- value = ast .literal_eval (value )
440- return key , value
441-
442- ap .add_argument ('-c' , '--config' , type = _parse_config ,
443- action = 'append' ,
444- help = 'key=val where val will be parsed by literal_eval, '
445- 'e.g. -c use_plots=True. Multiple -c can be used.' )
446- args = ap .parse_args ()
447-
448- parts = args .import_path .split ('.' )
449-
450- for split_point in range (len (parts ), 0 , - 1 )[::- 1 ]:
451- try :
452- path = '.' .join (parts [:split_point ])
453- obj = importlib .import_module (path )
454- except ImportError :
455- continue
456- break
457- else :
458- raise ImportError ('Could not resolve {!r} to an importable object'
459- '' .format (args .import_path ))
460-
461- for part in parts [split_point :]:
462- obj = getattr (obj , part )
463-
464- print (get_doc_object (obj , config = dict (args .config or [])))
0 commit comments