<s> from mock import Mock <EOL> import sys <EOL> import os <EOL> MOCK_MODULES = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> sys . modules . update ( ( mod_name , Mock ( ) ) for mod_name in MOCK_MODULES ) <EOL> from numpydoc . docscrape_sphinx import SphinxDocString <EOL> from numpydoc . docscrape import NumpyDocString , Reader <EOL> import textwrap <EOL> import openmdao <EOL> def generate_docs ( ) : <EOL> index_top = """<STR_LIT>""" <EOL> package_top = """<STR_LIT>""" <EOL> package_bottom = """<STR_LIT>""" <EOL> ref_sheet_bottom = """<STR_LIT>""" <EOL> dir = os . path . dirname ( __file__ ) <EOL> if os . path . isdir ( os . path . join ( dir , "<STR_LIT>" ) ) : <EOL> import shutil <EOL> shutil . rmtree ( os . path . join ( dir , "<STR_LIT>" ) ) <EOL> os . mkdir ( os . path . join ( dir , "<STR_LIT>" ) ) <EOL> os . mkdir ( os . path . join ( dir , "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> IGNORE_LIST = [ '<STR_LIT>' , '<STR_LIT:test>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> packages = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> for listing in os . listdir ( os . path . join ( dir , "<STR_LIT:..>" ) ) : <EOL> if os . path . isdir ( os . path . join ( "<STR_LIT:..>" , listing ) ) : <EOL> if listing not in IGNORE_LIST and listing not in packages : <EOL> packages . append ( listing ) <EOL> index_filename = os . path . join ( dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> index = open ( index_filename , "<STR_LIT:w>" ) <EOL> index . write ( index_top ) <EOL> for package in packages : <EOL> sub_packages = [ ] <EOL> package_filename = os . path . join ( dir , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" + package + "<STR_LIT>" ) <EOL> package_name = "<STR_LIT>" + package <EOL> for sub_listing in sorted ( os . listdir ( os . path . join ( "<STR_LIT:..>" , package ) ) ) : <EOL> if ( os . path . isdir ( sub_listing ) and sub_listing != "<STR_LIT:test>" ) or ( sub_listing . endswith ( "<STR_LIT>" ) and not sub_listing . startswith ( '<STR_LIT:_>' ) ) : <EOL> sub_packages . append ( sub_listing . rsplit ( '<STR_LIT:.>' ) [ <NUM_LIT:0> ] ) <EOL> if len ( sub_packages ) > <NUM_LIT:0> : <EOL> index . write ( "<STR_LIT>" + package + "<STR_LIT:\n>" ) <EOL> package_dirname = os . path . join ( dir , "<STR_LIT>" , "<STR_LIT>" , package ) <EOL> os . mkdir ( package_dirname ) <EOL> package_file = open ( package_filename , "<STR_LIT:w>" ) <EOL> package_file . write ( package_name + "<STR_LIT:\n>" ) <EOL> package_file . write ( "<STR_LIT:->" * len ( package_name ) + "<STR_LIT:\n>" ) <EOL> package_file . write ( package_top ) <EOL> for sub_package in sub_packages : <EOL> SKIP_SUBPACKAGES = [ '<STR_LIT>' ] <EOL> if sub_package not in SKIP_SUBPACKAGES : <EOL> package_file . write ( "<STR_LIT:U+0020>" + package + "<STR_LIT:/>" + sub_package + "<STR_LIT:\n>" ) <EOL> ref_sheet_filename = os . path . join ( package_dirname , sub_package + "<STR_LIT>" ) <EOL> ref_sheet = open ( ref_sheet_filename , "<STR_LIT:w>" ) <EOL> filename = sub_package + "<STR_LIT>" <EOL> ref_sheet . write ( "<STR_LIT>" + filename + "<STR_LIT>" ) <EOL> ref_sheet . write ( "<STR_LIT>" + package_name + "<STR_LIT:.>" + filename + "<STR_LIT>" ) <EOL> ref_sheet . write ( filename + "<STR_LIT:\n>" ) <EOL> ref_sheet . write ( "<STR_LIT:+>" * len ( filename ) + "<STR_LIT>" ) <EOL> ref_sheet . write ( "<STR_LIT>" + package_name + "<STR_LIT:.>" + sub_package ) <EOL> ref_sheet . write ( ref_sheet_bottom ) <EOL> ref_sheet . close ( ) <EOL> package_file . write ( package_bottom ) <EOL> package_file . close ( ) <EOL> index . close ( ) <EOL> generate_docs ( ) <EOL> def _parse ( self ) : <EOL> self . _doc . reset ( ) <EOL> self . _parse_summary ( ) <EOL> for ( section , content ) in self . _read_sections ( ) : <EOL> if not section . startswith ( '<STR_LIT:..>' ) : <EOL> section = '<STR_LIT:U+0020>' . join ( [ s . capitalize ( ) for s in section . split ( '<STR_LIT:U+0020>' ) ] ) <EOL> if section in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) : <EOL> self [ section ] = self . _parse_param_list ( content ) <EOL> elif section . startswith ( '<STR_LIT>' ) : <EOL> self [ '<STR_LIT:index>' ] = self . _parse_index ( section , content ) <EOL> elif section == '<STR_LIT>' : <EOL> self [ '<STR_LIT>' ] = self . _parse_see_also ( content ) <EOL> else : <EOL> self [ section ] = content <EOL> def __str__ ( self , indent = <NUM_LIT:0> , func_role = "<STR_LIT>" ) : <EOL> out = [ ] <EOL> out += self . _str_signature ( ) <EOL> out += self . _str_index ( ) + [ '<STR_LIT>' ] <EOL> out += self . _str_summary ( ) <EOL> out += self . _str_extended_summary ( ) <EOL> out += self . _str_param_list ( '<STR_LIT>' ) <EOL> out += self . _str_options ( '<STR_LIT>' ) <EOL> out += self . _str_options ( '<STR_LIT>' ) <EOL> out += self . _str_returns ( ) <EOL> for param_list in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) : <EOL> out += self . _str_param_list ( param_list ) <EOL> out += self . _str_warnings ( ) <EOL> out += self . _str_see_also ( func_role ) <EOL> out += self . _str_section ( '<STR_LIT>' ) <EOL> out += self . _str_references ( ) <EOL> out += self . _str_examples ( ) <EOL> for param_list in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> out += self . _str_member_list ( param_list ) <EOL> out = self . _str_indent ( out , indent ) <EOL> return '<STR_LIT:\n>' . join ( out ) <EOL> def __init__ ( self , docstring , config = { } ) : <EOL> docstring = textwrap . dedent ( docstring ) . split ( '<STR_LIT:\n>' ) <EOL> self . _doc = Reader ( docstring ) <EOL> self . _parsed_data = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:index>' : { } <EOL> } <EOL> self . _parse ( ) <EOL> def _str_options ( self , name ) : <EOL> out = [ ] <EOL> if self [ name ] : <EOL> out += self . _str_field_list ( name ) <EOL> out += [ '<STR_LIT>' ] <EOL> for param , param_type , desc in self [ name ] : <EOL> if param_type : <EOL> out += self . _str_indent ( [ '<STR_LIT>' % ( param . strip ( ) , <EOL> param_type ) ] ) <EOL> else : <EOL> out += self . _str_indent ( [ '<STR_LIT>' % param . strip ( ) ] ) <EOL> if desc : <EOL> out += [ '<STR_LIT>' ] <EOL> out += self . _str_indent ( desc , <NUM_LIT:8> ) <EOL> out += [ '<STR_LIT>' ] <EOL> return out <EOL> NumpyDocString . __init__ = __init__ <EOL> SphinxDocString . _str_options = _str_options <EOL> SphinxDocString . _parse = _parse <EOL> SphinxDocString . __str__ = __str__ <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . abspath ( '<STR_LIT:..>' ) ) <EOL> absp = os . path . join ( '<STR_LIT:..>' , '<STR_LIT>' ) <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . abspath ( absp ) ) <EOL> extensions = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> numpydoc_show_class_members = False <EOL> templates_path = [ '<STR_LIT>' ] <EOL> source_suffix = '<STR_LIT>' <EOL> master_doc = '<STR_LIT:index>' <EOL> project = u'<STR_LIT>' <EOL> copyright = u'<STR_LIT>' <EOL> author = u'<STR_LIT>' <EOL> version = openmdao . __version__ <EOL> release = openmdao . __version__ + '<STR_LIT>' <EOL> language = None <EOL> exclude_patterns = [ '<STR_LIT>' ] <EOL> pygments_style = '<STR_LIT>' <EOL> todo_include_todos = False <EOL> html_theme = '<STR_LIT>' <EOL> html_theme_path = [ '<STR_LIT:.>' ] <EOL> html_logo = '<STR_LIT>' <EOL> html_favicon = '<STR_LIT>' <EOL> html_last_updated_fmt = '<STR_LIT>' <EOL> htmlhelp_basename = '<STR_LIT>' <EOL> latex_elements = { <EOL> } <EOL> latex_documents = [ <EOL> ( master_doc , '<STR_LIT>' , u'<STR_LIT>' , <EOL> u'<STR_LIT>' , '<STR_LIT>' ) , <EOL> ] <EOL> man_pages = [ <EOL> ( master_doc , '<STR_LIT>' , u'<STR_LIT>' , <EOL> [ author ] , <NUM_LIT:1> ) <EOL> ] <EOL> texinfo_documents = [ <EOL> ( master_doc , '<STR_LIT>' , u'<STR_LIT>' , <EOL> author , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) , <EOL> ] </s>
