returns information about module
971561
def status(self):
        ''''''
        self.status_callcount += 1
        self.last_bored = time.time() # status entertains us
        return("status called %(status_callcount)d times.  My target positions=%(packets_mytarget)u  Other target positions=%(packets_mytarget)u" %
               {"status_callcount": self.status_callcount,
                "packets_mytarget": self.packets_mytarget,
                "packets_othertarget": self.packets_othertarget,
               })
40897
def main_module_name() -> str:
    """"""
    if not hasattr(main_module, '__file__'):
        # running from interactive shell
        return None

    main_filename = os.path.basename(main_module.__file__)
    module_name, ext = os.path.splitext(main_filename)
    return module_name
1076822
def is_module_loaded(module):
    """"""
    matches = re.findall('^%s[ ]+' % module, lsmod(), re.M)
    return len(matches) > 0
221416
def _get_info(self, formula_def):
        '''
        
        '''
        fields = (
            'name',
            'os',
            'os_family',
            'release',
            'version',
            'dependencies',
            'os_dependencies',
            'os_family_dependencies',
            'summary',
            'description',
        )
        for item in fields:
            if item not in formula_def:
                formula_def[item] = 'None'

        if 'installed' not in formula_def:
            formula_def['installed'] = 'Not installed'

        return ('Name: {name}\n'
                'Version: {version}\n'
                'Release: {release}\n'
                'Install Date: {installed}\n'
                'Supported OSes: {os}\n'
                'Supported OS families: {os_family}\n'
                'Dependencies: {dependencies}\n'
                'OS Dependencies: {os_dependencies}\n'
                'OS Family Dependencies: {os_family_dependencies}\n'
                'Summary: {summary}\n'
                'Description:\n'
                '{description}').format(**formula_def)
416616
def modules(self):
        

        if not self.get_objects_by_type('module'):
            self.inventory()
        return {int(c.index): c for c in self.get_objects_by_type('module')}
549568
def getBriefModuleInfoFromFile(fileName):
    """"""
    modInfo = BriefModuleInfo()
    _cdmpyparser.getBriefModuleInfoFromFile(modInfo, fileName)
    modInfo.flush()
    return modInfo
362957
def readmodule(module, path=None):
    ''''''

    res = {}
    for key, value in _readmodule(module, path or []).items():
        if isinstance(value, Class):
            res[key] = value
    return res
14507
def get_base_modules():
    "  "

    return sorted(filter(
                  lambda x: op.isdir(op.join(MOD_DIR, x)),
                  listdir(MOD_DIR)))
58400
def get_pluggable_module_information(self, id_or_uri):
        
        uri = self._client.build_uri(id_or_uri) + "/pluggableModuleInformation"
        return self._client.get(uri)
345256
def is_a_module(self, module_type):
        
        if hasattr(self, 'type'):
            return module_type in self.type
        return module_type in self.module_types
131938
def moduleInfo( module ):
        
        data = module.__dict__
        
        html = []
        html.append( '<h2>%s</h2>' % data.get('__name__', 'Unknown') )
        html.append( '<hr/>' )
        ver = data.get('__version__', '0')
        html.append( '<small>version: %s</small>' % ver)
        html.append( '<br/>' )
        html.append( nativestring(data.get('__doc__', '')) )
        html.append( '<br/><br/><b>Authors</b><ul/>' )
        
        for author in data.get('__authors__', []):
            html.append( '<li>%s</li>' % author )
            
        html.append( '</ul>' )
        html.append( '<br/><br/><b>Depends on:</b>' )
        for depends in data.get('__depends__', []):
            html.append( '<li>%s</li>' % depends )
            
        html.append( '</ul>' )
        html.append( '' )
        html.append( '<br/><br/><b>Credits</b></ul>' )
        
        for credit in data.get('__credits__', []):
            html.append('<li>%s: %s</li>' % credit)
            
        html.append( '</ul>' )
        
        opts = (data.get('__maintainer__', ''), data.get('__email__', ''))
        html.append('<br/><br/><small>maintained by: %s email: %s</small>' % opts)
        
        opts = (data.get('__copyright__', ''), data.get('__license__', ''))
        html.append('<br/><small>%s | license: %s</small>' % opts)
        
        return '\n'.join(html)
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]
7262
def get_func(func_name, module_pathname):
    

    if sys.version_info[0] >= 3:
        if sys.version_info[1] >= 6:
            import importlib.util
            spec = importlib.util.spec_from_file_location('module_name', module_pathname)
            cells_module = importlib.util.module_from_spec(spec)
            spec.loader.exec_module(cells_module)
            return getattr(cells_module, func_name)
        elif sys.version_info[1] >= 4:
            import importlib.machinery
            module = importlib.machinery.SourceFileLoader('module_name', module_pathname).load_module()
            return getattr(module, func_name)

    fatal('Python version {} not supported'.format(sys.version))
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()
574158
def show_info(self):
        
        sender = self.sender()
        tree = sender.parent()
        index = tree.selectedIndexes()
        info = ''
        if index != []:
            index = index[0]
            name = str(index.model().itemFromIndex(index).text())
            self.selected_element_name = name



            if name in self.elements_old:
                info = self.elements_old[name].__doc__

            #TODO: check if this is portable
            elif name in self.elements_from_file:
                class_name = self.elements_from_file[name]['class']
                if 'filepath' in self.elements_from_file[name]:
                    filepath = self.elements_from_file[name]['filepath']
                if 'info' in self.elements_from_file[name]:
                    info = self.elements_from_file[name]['info']
                #
                # path_to_src_scripts = filepath[:filepath.find('\\pylabcontrol\\scripts\\')]
                # module_name = path_to_src_scripts[path_to_src_scripts.rfind('\\')+1:]
                # module = __import__('{:s}.pylabcontrol.{:s}'.format(module_name, self.elements_type), fromlist=[class_name])
                # info = getattr(module, class_name).__doc__



            if info is None:
                info = name

            if tree == self.tree_infile:
                self.lbl_info.setText(info)
                self.tree_loaded.clearSelection()

            elif tree == self.tree_loaded:
                self.lbl_info.setText(info)
                self.tree_infile.clearSelection()
832930
def info(self):
        """"""
        if self._composeinfo is not None:
            return self._composeinfo

        paths = [
            "metadata/composeinfo.json",
        ]
        self._composeinfo = self._load_metadata(paths, productmd.composeinfo.ComposeInfo)
        return self._composeinfo
1090498
def modules(self):
        """"""
        if self._modules is not None:
            return self._modules

        paths = [
            "metadata/modules.json",
        ]
        self._modules = self._load_metadata(paths, productmd.modules.Modules)
        return self._modules