original_docstring: Generate a module level API documentation of a python package.
  
      Description
      --------
  -
      Generates markdown API files for each module in a Python package whereas
      the structure is as follows:
      `package/package.subpackage/package.subpackage.module.md`
  
      Parameters
      --------
  -
      package : Python package object
      api_dir : str
          Output directory path for the top-level package directory
      clean : bool (default: False)
          Removes previously existing API directory if True.
      printlog : bool (default: True)
          Prints a progress log to the standard output screen if True.
      ignore_packages : iterable or None (default: None)
          Iterable (list, set, tuple) that contains the names of packages
          and subpackages to ignore or skip. For instance, if the
          images subpackage in mlearner is supposed to be split, provide the
          argument `{mlearner.image}`.
  
      
docstring: Generate a module level API documentation of a python package.
  Description
  
  Generates markdown API files for each module in a Python package whereas
  the structure is as follows:
  `package/package.subpackage/package.subpackage.module.md`
  
  Parameters
  
  package : Python package object
  api_dir : str
  Output directory path for the top-level package directory
  clean : bool (default: False)
  Removes previously existing API directory if True.
  printlog : bool (default: True)
  Prints a progress log to the standard output screen if True.
  ignore_packages : iterable or None (default: None)
  Iterable (list, set, tuple) that contains the names of packages
  and subpackages to ignore or skip. For instance, if the
  images subpackage in mlearner is supposed to be split, provide the
  argument `{mlearner.image}`.
docstring_tokens: Generate a module level API documentation of a python package . Description Generates markdown API files for each module in a Python package whereas the structure is as follows : ` package / package . subpackage / package . subpackage . module . md ` Parameters package : Python package object api_dir : str Output directory path for the top - level package directory clean : bool ( default : False ) Removes previously existing API directory if True . printlog : bool ( default : True ) Prints a progress log to the standard output screen if True . ignore_packages : iterable or None ( default : None ) Iterable ( list set tuple ) that contains the names of packages and subpackages to ignore or skip . For instance if the images subpackage in mlearner is supposed to be split provide the argument ` { mlearner . image } ` .
code: def generate_api_docs(package, api_dir, clean=False,
                        printlog=True, ignore_packages=None):
      
      """Generate a module level API documentation of a python package.
  
      Description
      --------
  -
      Generates markdown API files for each module in a Python package whereas
      the structure is as follows:
      `package/package.subpackage/package.subpackage.module.md`
  
      Parameters
      --------
  -
      package : Python package object
      api_dir : str
          Output directory path for the top-level package directory
      clean : bool (default: False)
          Removes previously existing API directory if True.
      printlog : bool (default: True)
          Prints a progress log to the standard output screen if True.
      ignore_packages : iterable or None (default: None)
          Iterable (list, set, tuple) that contains the names of packages
          and subpackages to ignore or skip. For instance, if the
          images subpackage in mlearner is supposed to be split, provide the
          argument `{mlearner.image}`.
  
      """
      if printlog:
          print('\n\nGenerating Module Files\n%s\n' % (50 * '='))
  
      prefix = package.__name__ + "."
  
      # clear the previous version
      if clean:
          if os.path.isdir(api_dir):
              shutil.rmtree(api_dir)
  
      # get subpackages
      api_docs = {}
      for importer, pkg_name, is_pkg in pkgutil.iter_modules(
              package.__path__, prefix):
  
          if ignore_packages is not None and pkg_name in ignore_packages:
              if printlog:
                  print('ignored %s' % pkg_name)
              continue
          if is_pkg:
              subpackage = __import__(pkg_name, fromlist="dummy")
              prefix = subpackage.__name__ + "."
  
              # get functions and classes
              classes, functions = get_functions_and_classes(subpackage)
  
              target_dir = os.path.join(api_dir, subpackage.__name__)
  
              # create the subdirs
              if not os.path.isdir(target_dir):
                  os.makedirs(target_dir)
                  if printlog:
                      print('created %s' % target_dir)
  
              # create markdown documents in memory
              for obj in classes + functions:
                  md_path = os.path.join(target_dir, obj[0]) + '.md'
                  if md_path not in api_docs:
                      api_docs[md_path] = object_to_markdownpage(obj_name=obj[0],
                                                                 obj=obj[1],
                                                                 s='')
                  else:
                      api_docs[md_path] += object_to_markdownpage(obj_name=(
                                                                  obj[0]),
                                                                  obj=obj[1],
                                                                  s='')
  
      # write to files
      for d in sorted(api_docs):
          prev = ''
          if os.path.isfile(d):
              with open(d, 'r') as f:
                  prev = f.read()
              if prev == api_docs[d]:
                  msg = 'skipped'
              else:
                  msg = 'updated'
          else:
              msg = 'created'
  
          if msg != 'skipped':
              with open(d, 'w') as f:
                  f.write(api_docs[d])
  
          if printlog:
              print('%s %s' % (msg, d))
code_tokens: def generate_api_docs ( package , api_dir , clean = False , printlog = True , ignore_packages = None ) : if printlog : print ( '\n\nGenerating Module Files\n%s\n' % ( 50 * '=' ) ) prefix = package . __name__ + "." if clean : if os . path . isdir ( api_dir ) : shutil . rmtree ( api_dir ) api_docs = { } for importer , pkg_name , is_pkg in pkgutil . iter_modules ( package . __path__ , prefix ) : if ignore_packages is not None and pkg_name in ignore_packages : if printlog : print ( 'ignored %s' % pkg_name ) continue if is_pkg : subpackage = __import__ ( pkg_name , fromlist = "dummy" ) prefix = subpackage . __name__ + "." classes , functions = get_functions_and_classes ( subpackage ) target_dir = os . path . join ( api_dir , subpackage . __name__ ) if not os . path . isdir ( target_dir ) : os . makedirs ( target_dir ) if printlog : print ( 'created %s' % target_dir ) for obj in classes + functions : md_path = os . path . join ( target_dir , obj [ 0 ] ) + '.md' if md_path not in api_docs : api_docs [ md_path ] = object_to_markdownpage ( obj_name = obj [ 0 ] , obj = obj [ 1 ] , s = '' ) else : api_docs [ md_path ] += object_to_markdownpage ( obj_name = ( obj [ 0 ] ) , obj = obj [ 1 ] , s = '' ) for d in sorted ( api_docs ) : prev = '' if os . path . isfile ( d ) : with open ( d , 'r' ) as f : prev = f . read ( ) if prev == api_docs [ d ] : msg = 'skipped' else : msg = 'updated' else : msg = 'created' if msg != 'skipped' : with open ( d , 'w' ) as f : f . write ( api_docs [ d ] ) if printlog : print ( '%s %s' % ( msg , d ) )
short_docstring: Generate a module level API documentation of a python package.
short_docstring_tokens: Generate a module level API documentation of a python package .
comment: """Generate a module level API documentation of a python package.
  
      Description
      --------
  -
      Generates markdown API files for each module in a Python package whereas
      the structure is as follows:
      `package/package.subpackage/package.subpackage.module.md`
  
      Parameters
      --------
  -
      package : Python package object
      api_dir : str
          Output directory path for the top-level package directory
      clean : bool (default: False)
          Removes previously existing API directory if True.
      printlog : bool (default: True)
          Prints a progress log to the standard output screen if True.
      ignore_packages : iterable or None (default: None)
          Iterable (list, set, tuple) that contains the names of packages
          and subpackages to ignore or skip. For instance, if the
          images subpackage in mlearner is supposed to be split, provide the
          argument `{mlearner.image}`.
  
      """$SEP$# clear the previous version$SEP$# get subpackages$SEP$# get functions and classes$SEP$# create the subdirs$SEP$# create markdown documents in memory$SEP$# write to files