Function for creating content in each .rst file for a module.

    :param module_name: name of the module.
    :type module_name: str

    :returns: A content for auto module.
    :rtype: str
177599
def create_module_rst_file(module_name):
    

    return_text = 'Module:  ' + module_name
    dash = '=' * len(return_text)
    return_text += '\n' + dash + '\n\n'
    return_text += '.. automodule:: ' + module_name + '\n'
    return_text += '   :members:\n\n'

    return return_text
1099878
def _import_module(module_name):
    
    fromlist = []
    dot_position = module_name.rfind('.')
    if dot_position > -1:
        fromlist.append(
            module_name[dot_position+1:len(module_name)]
        )

    # Import module
    module = __import__(module_name, globals(), locals(), fromlist, 0)

    return module
1029332
def get_modules(package_name, module_names):
  
  def get_module(name):
    return __import__(".".join([package_name, name]), fromlist=[package_name])
  return [get_module(name) for name in module_names]
340435
def load_module(self, module):
        
        cases = self.get_test_cases_from_module(module)
        suites = [self.load_case(case) for case in cases]
        return self.create_suite(suites)
551983
def autodoc_module(module):
    
    doc = getattr(module, '__doc__')
    if doc is None:
        doc = ''
    members = []
    for name, member in inspect.getmembers(module):
        if ((not name.startswith('_')) and
                (inspect.getmodule(member) is module)):
            members.append((name, member))
    members = sorted(members, key=_number_of_line)
    if members:
        lines = ['\n\nModule :mod:`~%s` implements the following members:\n'
                 % module.__name__]
        for (name, member) in members:
            if inspect.isfunction(member):
                type_ = 'func'
            elif inspect.isclass(member):
                type_ = 'class'
            else:
                type_ = 'obj'
            lines.append('      * :%s:`~%s` %s'
                         % (type_, name, objecttools.description(member)))
        doc = doc + '\n\n' + '\n'.join(lines) + '\n\n' + 80*'_'
        module.__doc__ = doc
256705
def update(self, module_name=None):
        
        if not module_name:
            return self._module.force_update()
        else:
            module_info = self._get_module_info(module_name)
            if module_info:
                module_info["module"].force_update()
569107
def get_module_name(module: types.ModuleType) -> str:
    
    try:
        return module.__spec__.name
    except AttributeError:
        return module.__name__
1181853
def import_module(module_name):
    """"""
    import sys, os
    import importlib
    sys.path.append(os.path.dirname(__file__))
    return importlib.import_module(module_name)
734162
def load(self, module_name):
        
        module_name, path = self.lookup(module_name)
        if path:
            with open(path, 'rb') as f:
                return module_name, f.read().decode('utf-8')
        return None, None
955770
def _get_module(module_name=None, module=None, register=True):
    
    if module is None and module_name is not None:
        try:
            module = sys.modules[module_name]
        except KeyError as ex:
            print(ex)
            raise KeyError(('module_name=%r must be loaded before ' +
                            'receiving injections') % module_name)
    elif module is not None and module_name is None:
        pass
    else:
        raise ValueError('module_name or module must be exclusively specified')
    if register is True:
        _add_injected_module(module)
    return module
796679
def __recursive_import(module_name):
    
    names = module_name.split(".")
    path = None
    module = None
    while len(names) > 0:
        if module:
            path = module.__path__
        name = names.pop(0)
        (module_file, pathname, description) = imp.find_module(name, path)
        module = imp.load_module(name, module_file, pathname, description)
    return module
800139
def write_module_file(name, path, package):
    '''
    '''
    file_path = join(path, '%s.rst' % name)
    mod_file = open(file_path, 'w')

    mod_file.write('%s\n' % AUTOGEN)
    mod_file.write('%s\n' % name.title())
    mod_file.write('=' * len(name))
    mod_file.write('\n\n')
    mod_file.write('.. toctree::\n')
    mod_file.write('   :maxdepth: 1\n\n')
    mod_file.write('.. automodule:: %s.%s\n' % (package, name))
    mod_file.write('   :members:\n')
    mod_file.write('   :undoc-members:\n')
    mod_file.write('   :show-inheritance:\n')
605492
def get_module_config(self, name):
    
    if self.exists("modules"):
      if name in self._json["modules"] and not isinstance(self._json["modules"][name], str):
        return self._json["modules"][name]
    return None
576894
def make_module_reload_func(module_name=None, module_prefix='[???]', module=None):
    
    module = _get_module(module_name, module, register=False)
    if module_name is None:
        module_name = str(module.__name__)
    def rrr(verbose=True):
        """ Dynamic module reloading """
        if not __RELOAD_OK__:
            raise Exception('Reloading has been forced off')
        try:
            import imp
            if verbose and not QUIET:
                builtins.print('RELOAD: ' + str(module_prefix) + ' __name__=' + module_name)
            imp.reload(module)
        except Exception as ex:
            print(ex)
            print('%s Failed to reload' % module_prefix)
            raise
    # this doesn't seem to set anything on import *
    #_inject_funcs(module, rrr)
    return rrr
338557
def define_plugin_entry(name, module_name):
    
    if isinstance(name, tuple):
        entry, name = name
    else:
        entry = name
    return '%s = %s:%s' % (entry, module_name, name)
735856
def create_py3_docs():
    
    # we want the correct .rst 'type' for our data
    trans = {"methods": "function", "exceptions": "exception", "constants": "attribute"}
    data = get_py3_info()
    for k, v in data.items():
        output = []
        for name, desc in v:
            output.append("")
            output.append(".. _%s:" % name)  # reference for linking
            output.append("")
            output.append(".. py:%s:: %s" % (trans[k], name))
            output.append("")
            output.extend(auto_undent(desc))
        with open("../doc/py3-%s-info.inc" % k, "w") as f:
            f.write("\n".join(output))
222428
def load_from_name(module_name):
    
    global _CONFIG_CACHE
    if module_name not in _CONFIG_CACHE:
        settings = OrderedDict()
        if isinstance(module_name, six.string_types):
            settings = _load_from_module(_import_module(module_name))
        _CONFIG_CACHE[module_name] = settings
    return _CONFIG_CACHE[module_name]