def _MakePackagePages(self, package, showprivate=False, nested=False, showinh=False):
        """An internal helper to generate all of the pages for a given package

        Args:
            package (module): The top-level package to document
            showprivate (bool): A flag for whether or not to display private members
            nested (bool): Foor internal use ONLY

        Returns:
            str: The file names ready to be appended to a top-level toctree
        """

        def checkNoNested(mod):
            try:
                all = mod.__all__
            except AttributeError:
                return False
            mems = inspect.getmembers(mod, inspect.ismodule)
            mems = [m for m in mems if m[0] in mod.__all__]

            if len(mems) > 0:
                return False
            return True

        # Get package module members
        mods = inspect.getmembers(package, inspect.ismodule)
        # Split into modules and sub-packages
        nmods, pvt, npkgs = [], [], []
        for mod in mods:
            # Deal with private modules
            if checkNoNested(mod[1]):
                if mod[0][0] == '_': pvt.append(mod)
                else: nmods.append(mod)
            else: npkgs.append(mod)
        if showprivate: nmods += pvt


        # for each member that has a nested module
            # recurse and keep track of index files for that package
        files = []
        ignore = []
        for pkg in npkgs:
            pt = '%s/%s/%s' % (self.path, package.__name__.replace('.', '/'), pkg[1].__name__.split('.')[-1])
            if os.path.exists(pt): shutil.rmtree(pt)
            os.makedirs(pt)
            ignore += inspect.getmembers(pkg[1])
            f = self._MakePackagePages(pkg[1], showprivate=showprivate, nested=True, showinh=showinh)
            files.append(f.split(package.__name__.replace('.', '/')+'/')[1])

        if nested:
            try:
                name = package.__displayname__
            except AttributeError:
                name = package.__name__
            # Create index file here
            index = r'''
%s
%s

.. toctree::
   :maxdepth: 5

    ''' % (name, '*' * len(name))
            # include sub packages first
            index += '\n   '.join(files)
            # then include modules
            index += '\n   ' + self._ProduceContent(nmods, showprivate=showprivate, showinh=showinh)
            findex = 'content/%s/index.rst' % (package.__name__.replace('.', '/'))

            # Write the file
            with open(findex, 'w') as f:
                if package.__doc__: f.write(package.__doc__)
                f.write(index)

            # return filename for index file at package level
            return '\n   ' + findex

        # Not nested: return all files
        names = '\n   %s/%s/' % ( self.path, package.__name__.replace('.', '/'))
        nmods = [m for m in nmods if m not in ignore]
        return names.join(self._ProduceContent(nmods, showprivate=showprivate, showinh=showinh).split('\n   ')+files)
def _MakePackagePages ( self , package , showprivate = False , nested = False , showinh = False ) : def checkNoNested ( mod ) : try : all = mod . __all__ except AttributeError : return False mems = inspect . getmembers ( mod , inspect . ismodule ) mems = [ m for m in mems if m [ 0 ] in mod . __all__ ] if len ( mems ) > 0 : return False return True mods = inspect . getmembers ( package , inspect . ismodule ) nmods , pvt , npkgs = [ ] , [ ] , [ ] for mod in mods : if checkNoNested ( mod [ 1 ] ) : if mod [ 0 ] [ 0 ] == '_' : pvt . append ( mod ) else : nmods . append ( mod ) else : npkgs . append ( mod ) if showprivate : nmods += pvt files = [ ] ignore = [ ] for pkg in npkgs : pt = '%s/%s/%s' % ( self . path , package . __name__ . replace ( '.' , '/' ) , pkg [ 1 ] . __name__ . split ( '.' ) [ - 1 ] ) if os . path . exists ( pt ) : shutil . rmtree ( pt ) os . makedirs ( pt ) ignore += inspect . getmembers ( pkg [ 1 ] ) f = self . _MakePackagePages ( pkg [ 1 ] , showprivate = showprivate , nested = True , showinh = showinh ) files . append ( f . split ( package . __name__ . replace ( '.' , '/' ) + '/' ) [ 1 ] ) if nested : try : name = package . __displayname__ except AttributeError : name = package . __name__ index = r'''
%s
%s
.. toctree::
   :maxdepth: 5
    ''' % ( name , '*' * len ( name ) ) index += '\n   ' . join ( files ) index += '\n   ' + self . _ProduceContent ( nmods , showprivate = showprivate , showinh = showinh ) findex = 'content/%s/index.rst' % ( package . __name__ . replace ( '.' , '/' ) ) with open ( findex , 'w' ) as f : if package . __doc__ : f . write ( package . __doc__ ) f . write ( index ) return '\n   ' + findex names = '\n   %s/%s/' % ( self . path , package . __name__ . replace ( '.' , '/' ) ) nmods = [ m for m in nmods if m not in ignore ] return names . join ( self . _ProduceContent ( nmods , showprivate = showprivate , showinh = showinh ) . split ( '\n   ' ) + files )
An internal helper to generate all of the pages for a given package

        Args:
            package (module): The top-level package to document
            showprivate (bool): A flag for whether or not to display private members
            nested (bool): Foor internal use ONLY

        Returns:
            str: The file names ready to be appended to a top-level toctree