示例#1
0
    def get_available_types(self, groups=None):
        """Return a list of available types."""
        with self._lock:
            typset = set(self._classes.keys())
            types = []

            if groups is None:
                ifaces = set([v[0] for v in plugin_groups.values()])
            else:
                ifaces = set(
                    [v[0] for k, v in plugin_groups.items() if k in groups])

            for typ in typset:
                finfo = self._classes[typ]
                meta = finfo.classes[typ]

                if ifaces.intersection(meta['ifaces']):
                    meta = {
                        'bases': meta['bases'],
                        'ifaces': meta['ifaces'],
                        'version': meta['version'],
                        '_context': 'In Project',
                    }
                    types.append((typ, meta))
            return types
示例#2
0
    def get_available_types(self, groups=None):
        """Return a list of available types that cause predicate(classname, metadata) to
        return True.
        """
        with self._lock:
            graph = self.analyzer.graph
            typset = set(graph.nodes())
            types = []

            if groups is None:
                ifaces = set([v[0] for v in plugin_groups.values()])
            else:
                ifaces = set(
                    [v[0] for k, v in plugin_groups.items() if k in groups])

            for typ in typset:
                if typ.startswith(
                        'openmdao.'):  # don't include any standard lib types
                    continue
                if 'classinfo' in graph.node[typ]:
                    meta = graph.node[typ]['classinfo'].meta
                    if ifaces.intersection(self.analyzer.get_interfaces(typ)):
                        meta = meta.copy()
                        meta['_context'] = 'In Project'
                        types.append((typ, meta))
            return types
 def get_available_types(self, groups=None):
     """Return a list of available types."""
     with self._lock:
         typset = set(self._classes.keys())
         types = []
     
         if groups is None:
             ifaces = set([v[0] for v in plugin_groups.values()])
         else:
             ifaces = set([v[0] for k,v in plugin_groups.items() if k in groups])
     
         for typ in typset:
             finfo = self._classes[typ]
             meta = finfo.classes[typ]
             if ifaces.intersection(meta['ifaces']):
                 meta = { 
                     'ifaces': meta['ifaces'],
                     'version': meta['version'],
                     '_context': 'In Project',
                 }
                 types.append((typ, meta))
         return types