Compute the modules data that will be displayed in various tables on the module summary page.
516468
public void computeModulesData() {
        CommentHelper ch = utils.getCommentHelper(mdle);
        // Get module dependencies using the module's transitive closure.
        Map<ModuleElement, String> dependentModules = utils.getDependentModules(mdle);
        // Add all dependent modules to indirect modules set. We will remove the modules,
        // listed using the requires directive, from this set to come up with the table of indirect
        // required modules.
        dependentModules.forEach((module, mod) -> {
            if (shouldDocument(module)) {
                indirectModules.put(module, new StringContent(mod));
            }
        }
1274570
def load_modules(self):
        """"""
        if self.INTERFACES_MODULE is None:
            raise NotImplementedError("A module containing interfaces modules "
                                      "should be setup in INTERFACES_MODULE !")
        else:
            for module, permission in self.modules.items():
                i = getattr(self.INTERFACES_MODULE,
                            module).Interface(self, permission)
                self.interfaces[module] = i
921852
def show(module):
    '''
    
    '''
    ret = {}
    ret['name'] = module

    # This section parses out details from CPAN, if possible
    cmd = 'cpan -D {0}'.format(module)
    out = __salt__['cmd.run'](cmd).splitlines()
    mode = 'skip'
    info = []
    for line in out:
        if line.startswith('-------------'):
            mode = 'parse'
            continue
        if mode == 'skip':
            continue
        info.append(line)

    if len(info) == 6:
        # If the module is not installed, we'll be short a line
        info.insert(2, '')
    if len(info) < 6:
        # This must not be a real package
        ret['error'] = 'This package does not seem to exist'
        return ret

    ret['description'] = info[0].strip()
    ret['cpan file'] = info[1].strip()
    if info[2].strip():
        ret['installed file'] = info[2].strip()
    else:
        ret['installed file'] = None
    comps = info[3].split(':')
    if len(comps) > 1:
        ret['installed version'] = comps[1].strip()
    if 'installed version' not in ret or not ret['installed version']:
        ret['installed version'] = None
    comps = info[4].split(':')
    comps = comps[1].split()
    ret['cpan version'] = comps[0].strip()
    ret['author name'] = info[5].strip()
    ret['author email'] = info[6].strip()

    # Check and see if there are cpan build directories
    config = show_config()
    build_dir = config.get('build_dir', None)
    if build_dir is not None:
        ret['cpan build dirs'] = []
        builds = os.listdir(build_dir)
        pfile = module.replace('::', '-')
        for file_ in builds:
            if file_.startswith(pfile):
                ret['cpan build dirs'].append(os.path.join(build_dir, file_))

    return ret
52323
def show_info(self):
        """"""

        deltas = self.__get_delta_files()

        table = [['Version', 'Name', 'Type', 'Status']]

        for dir_ in deltas:
            print('delta files in dir: ', dir_)

            for delta in deltas[dir_]:
                line = [delta.get_version(), delta.get_name()]
                if delta.get_type() == DeltaType.PRE_PYTHON:
                    line.append('pre py')
                elif delta.get_type() == DeltaType.PRE_SQL:
                    line.append('pre sql')
                elif delta.get_type() == DeltaType.PYTHON:
                    line.append('delta py')
                elif delta.get_type() == DeltaType.SQL:
                    line.append('delta sql')
                elif delta.get_type() == DeltaType.POST_PYTHON:
                    line.append('post py')
                elif delta.get_type() == DeltaType.POST_SQL:
                    line.append('post sql')

                if self.__is_applied(delta):
                    line.append('Applied')
                else:
                    line.append('Pending')

                table.append(line)

        self.__print_table(table)

        print('')
        print('Applied upgrades in database')

        query = """SELECT
                version,
                description,
                type,
                installed_by,
                installed_on,
                success
                FROM {}
                """.format(self.upgrades_table)

        self.cursor.execute(query)
        records = self.cursor.fetchall()

        table = [['Version', 'Name', 'Type', 'Installed by', 'Installed on',
                  'Status']]

        for i in records:
            line = [str(i[0]), str(i[1])]
            delta_type = i[2]
            if delta_type == 0:
                line.append('baseline')
            elif delta_type == DeltaType.PRE_PYTHON:
                line.append('pre py')
            elif delta_type == DeltaType.PRE_SQL:
                line.append('pre sql')
            elif delta_type == DeltaType.PYTHON:
                line.append('delta py')
            elif delta_type == DeltaType.SQL:
                line.append('delta sql')
            elif delta_type == DeltaType.POST_PYTHON:
                line.append('post py')
            elif delta_type == DeltaType.POST_SQL:
                line.append('post sql')

            line.append(str(i[3]))
            line.append(str(i[4]))

            success = str(i[5])
            if success == 'True':
                line.append('Success')
            else:
                line.append('Failed')

            table.append(line)

        self.__print_table(table)
68200
def collect_modules(self):
        
        try:
            res = {}
            m = sys.modules
            for k in m:
                # Don't report submodules (e.g. django.x, django.y, django.z)
                # Skip modules that begin with underscore
                if ('.' in k) or k[0] == '_':
                    continue
                if m[k]:
                    try:
                        d = m[k].__dict__
                        if "version" in d and d["version"]:
                            res[k] = self.jsonable(d["version"])
                        elif "__version__" in d and d["__version__"]:
                            res[k] = self.jsonable(d["__version__"])
                        else:
                            res[k] = get_distribution(k).version
                    except DistributionNotFound:
                        pass
                    except Exception:
                        logger.debug("collect_modules: could not process module: %s" % k)

        except Exception:
            logger.debug("collect_modules", exc_info=True)
        else:
            return res
814995
protected void addModulesList(Collection<ModuleElement> modules, String text, String tableSummary, Content body) {
        Content table = (configuration.isOutputHtml5())
                ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text)))
                : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text)));
        table.addContent(getSummaryTableHeader(moduleTableHeader, "col"));
        Content tbody = new HtmlTree(HtmlTag.TBODY);
        addModulesList(modules, tbody);
        table.addContent(tbody);
        Content anchor = getMarkerAnchor(text);
        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, anchor);
        div.addContent(table);
        if (configuration.allowTag(HtmlTag.MAIN)) {
            htmlTree.addContent(div);
        } else {
            body.addContent(div);
        }
    }
928349
def fetch_items(self, category, **kwargs):
        
        from_date = kwargs['from_date']

        logger.info("Fetching modules from %s", str(from_date))

        from_date_ts = datetime_to_utc(from_date).timestamp()

        nmodules = 0
        stop_fetching = False

        raw_pages = self.client.modules()

        for raw_modules in raw_pages:
            modules = [mod for mod in self.parse_json(raw_modules)]

            for module in modules:
                # Check timestamps to stop fetching more modules
                # because modules fetched sorted by 'updated_at'
                # from newest to oldest.
                updated_at_ts = self.metadata_updated_on(module)

                if from_date_ts > updated_at_ts:
                    stop_fetching = True
                    break

                owner = module['owner']['username']
                name = module['name']
                module['releases'] = self.__fetch_and_parse_releases(owner, name)
                module['owner_data'] = self.__get_or_fetch_owner(owner)

                yield module
                nmodules += 1

            if stop_fetching:
                break

        logger.info("Fetch process completed: %s modules fetched", nmodules)
762367
function(moduleIds) {
		for (var i = moduleIds.length; i--;) {
			var moduleId = moduleIds[i],
				module = getModule(moduleId);

			if (module == null) {
				module = _modules[moduleId] = {};
				_fetchFunc(moduleId);
			}
		}
	}
1251319
def create_output_modules(self):
        
        py3_config = self.config["py3_config"]
        i3modules = self.i3status_thread.i3modules
        output_modules = self.output_modules
        # position in the bar of the modules
        positions = {}
        for index, name in enumerate(py3_config["order"]):
            if name not in positions:
                positions[name] = []
            positions[name].append(index)

        # py3status modules
        for name in self.modules:
            if name not in output_modules:
                output_modules[name] = {}
                output_modules[name]["position"] = positions.get(name, [])
                output_modules[name]["module"] = self.modules[name]
                output_modules[name]["type"] = "py3status"
                output_modules[name]["color"] = self.mappings_color.get(name)
        # i3status modules
        for name in i3modules:
            if name not in output_modules:
                output_modules[name] = {}
                output_modules[name]["position"] = positions.get(name, [])
                output_modules[name]["module"] = i3modules[name]
                output_modules[name]["type"] = "i3status"
                output_modules[name]["color"] = self.mappings_color.get(name)

        self.output_modules = output_modules
707802
def display(self):
        
        data = []
        first_row = ['Stat']
        first_row.extend(self._names)
        data.append(first_row)

        stats = self._stats()

        for stat in stats:
            k, n, f = stat
            # blank row
            if k is None:
                row = [''] * len(data[0])
                data.append(row)
                continue

            row = [n]
            for key in self._names:
                raw = getattr(self[key], k)

                # if rf is a series print nan
                if k == 'rf' and not type(raw) == float:
                    row.append(np.nan)
                elif f is None:
                    row.append(raw)
                elif f == 'p':
                    row.append(fmtp(raw))
                elif f == 'n':
                    row.append(fmtn(raw))
                elif f == 'dt':
                    row.append(raw.strftime('%Y-%m-%d'))
                else:
                    raise NotImplementedError('unsupported format %s' % f)
            data.append(row)

        print(tabulate(data, headers='firstrow'))
1240503
def ModuleHelp(self, module):
    
    helplist = []
    self.__RenderOurModuleKeyFlags(module, helplist)
    return '\n'.join(helplist)
193651
def get_imported_modules(self, module):
    """"""
    for name, member in inspect.getmembers(module):
      if inspect.ismodule(member):
        yield name, member
1205758
def load_modules(self, data=None, proxy=None):
        '''
        
        '''
        self.functions = self.wrapper
        self.utils = salt.loader.utils(self.opts)
        self.serializers = salt.loader.serializers(self.opts)
        locals_ = salt.loader.minion_mods(self.opts, utils=self.utils)
        self.states = salt.loader.states(self.opts, locals_, self.utils, self.serializers)
        self.rend = salt.loader.render(self.opts, self.functions)
872996
def __RenderOurModuleFlags(self, module, output_lines, prefix=''):
    """"""
    flags = self._GetFlagsDefinedByModule(module)
    if flags:
      self.__RenderModuleFlags(module, flags, output_lines, prefix)
589055
def classes_in_module(module) -> List:
        
        md = module.__dict__
        return [
            md[c] for c in md if (
                    isinstance(md[c], type) and
                    issubclass(md[c], ETKModule
                               ) and
                    md[c].__module__ == module.__name__)
        ]
1034499
def append_summary_to_module_docstring(module):
  
  pairs = [(name, getattr(module, name)) for name in module.__all__]
  kws = dict(key_header="Name", summary_type="module contents")
  module.__doc__ = docstring_with_summary(module.__doc__, pairs, **kws)
698506
def generate_module_content(self, module):
        
        if isinstance(module, Module):
            return module.render()
        else:  # pragma: no cover
            raise Exception("%r is not a Module object" % module)