Returns a DisplayList with the available Instruments
            registered in Bika-Setup. Only active Instruments are
            fetched. Used to fill the Instruments MultiSelectionWidget
964971
def _getAvailableInstrumentsDisplayList(self):
        
        bsc = getToolByName(self, 'bika_setup_catalog')
        items = [(i.UID, i.Title)
                 for i in bsc(portal_type='Instrument',
                              is_active=True)]
        items.sort(lambda x, y: cmp(x[1], y[1]))
        return DisplayList(list(items))
239599
def get_display_types():
    
    display_types = OrderedDict()
    for namespace in get_supported_libraries():
        display_types[namespace] = get_choices('luma.{0}.device'.format(
            namespace))

    return display_types
46433
def selected_items
      ((m = marked_items).any? ? m : Array(current_item)).reject {|i| %w(. ..).include? i.name}
    end
973845
def setup():
    
    global _displayhooks, _excepthooks
    if _displayhooks is not None:
        return

    _displayhooks = []
    _excepthooks = []

    # store any current hooks
    if sys.displayhook != sys.__displayhook__:
        _displayhooks.append(weakref.ref(sys.displayhook))

    if sys.excepthook != sys.__excepthook__:
        _excepthooks.append(weakref.ref(sys.excepthook))

    # replace the current hooks
    sys.displayhook = displayhook
    sys.excepthook = excepthook
496450
def midi_outputs(self):
        
        return self.client.get_ports(is_midi=True, is_physical=True, is_output=True)
1089899
def _get_list_widget(
        self,
        filters,
        actions=None,
        order_column="",
        order_direction="",
        page=None,
        page_size=None,
        widgets=None,
        **args
    ):

        
        widgets = widgets or {}
        actions = actions or self.actions
        page_size = page_size or self.page_size
        if not order_column and self.base_order:
            order_column, order_direction = self.base_order
        joined_filters = filters.get_joined_filters(self._base_filters)
        count, lst = self.datamodel.query(
            joined_filters,
            order_column,
            order_direction,
            page=page,
            page_size=page_size,
        )
        pks = self.datamodel.get_keys(lst)

        # serialize composite pks
        pks = [self._serialize_pk_if_composite(pk) for pk in pks]

        widgets["list"] = self.list_widget(
            label_columns=self.label_columns,
            include_columns=self.list_columns,
            value_columns=self.datamodel.get_values(lst, self.list_columns),
            order_columns=self.order_columns,
            formatters_columns=self.formatters_columns,
            page=page,
            page_size=page_size,
            count=count,
            pks=pks,
            actions=actions,
            filters=filters,
            modelview_name=self.__class__.__name__,
        )
        return widgets
992191
def get_components(self, root='C', visible=False):
        
        root_val = note_to_val(root)
        components = [v + root_val for v in self.components]

        if visible:
            components = [val_to_note(c, scale=root) for c in components]

        return components
225177
def get_combo(self, symbol):
        
        for parent, legs in self.instrument_combos.items():
            if symbol == parent or symbol in legs.keys():
                return {
                    "parent": self.get_instrument(parent),
                    "legs": legs,
                }
        return {
            "parent": None,
            "legs": {},
        }
136764
def get_service_categories(self, restricted=True):
        
        bsc = api.get_tool("bika_setup_catalog")
        query = {
            "portal_type": "AnalysisCategory",
            "is_active": True,
            "sort_on": "sortable_title",
        }
        categories = bsc(query)
        client = self.get_client()
        if client and restricted:
            restricted_categories = client.getRestrictedCategories()
            restricted_category_ids = map(
                lambda c: c.getId(), restricted_categories)
            # keep correct order of categories
            if restricted_category_ids:
                categories = filter(
                    lambda c: c.getId in restricted_category_ids, categories)
        return categories
441363
def loaded_instruments(self) -> Dict[str, Optional['InstrumentContext']]:
        
        return {mount.name.lower(): instr for mount, instr
                in self._instruments.items()}
869309
def parse_setlist_items(setlist_item_array = nil)
        return [] unless setlist_item_array
        setlist_item_array.inject([]) do |setlist_items, item|
          setlist_items << Songkickr::SetlistItem.new(item)
        end
      end
925795
def to_display_list(pairs, sort_by="key", allow_empty=True):
    
    dl = DisplayList()

    if isinstance(pairs, basestring):
        pairs = [pairs, pairs]
    for pair in pairs:
        # pairs is a list of lists -> add each pair
        if isinstance(pair, (tuple, list)):
            dl.add(*pair)
        # pairs is just a single pair -> add it and stop
        if isinstance(pair, basestring):
            dl.add(*pairs)
            break

    # add the empty option
    if allow_empty:
        dl.add("", "")

    # sort by key/value
    if sort_by == "key":
        dl = dl.sortedByKey()
    elif sort_by == "value":
        dl = dl.sortedByValue()

    return dl
905671
def ListAdapters(self):
    '''
    '''
    adapters = []

    for obj in mockobject.objects.keys():
        if obj.startswith('/org/bluez/') and 'dev_' not in obj:
            adapters.append(dbus.ObjectPath(obj, variant_level=1))

    return dbus.Array(adapters, variant_level=1)
213878
def _getInstrumentsVoc(self):
        
        cfilter = {'portal_type': 'Instrument', 'is_active': True}
        if self.getMethod():
            cfilter['getMethodUIDs'] = {"query": self.getMethod().UID(),
                                        "operator": "or"}
        bsc = getToolByName(self, 'bika_setup_catalog')
        items = [('', 'No instrument')] + [
            (o.UID, o.Title) for o in
            bsc(cfilter)]
        o = self.getInstrument()
        if o and o.UID() not in [i[0] for i in items]:
            items.append((o.UID(), o.Title()))
        items.sort(lambda x, y: cmp(x[1], y[1]))
        return DisplayList(list(items))
776960
def get_sngl_chisqs(self, instruments=None):
		
		if len(self) and instruments is None:
			instruments = map(str, \
			                instrument_set_from_ifos(self[0].ifos))
		elif instruments is None:
			instruments = []
		return dict((ifo, self.get_sngl_chisq(ifo))\
		            for ifo in instruments)
733442
def get_sigmasqs(self, instruments=None):
		
		if len(self):
			if not instruments:
				instruments = map(str, \
					instrument_set_from_ifos(self[0].ifos))
			return dict((ifo, self.get_sigmasq(ifo))\
				    for ifo in instruments)
		else:
			return dict()
1259481
def getContainers(self):
        
        _containers = []
        for container in self.bika_setup.bika_containers.objectValues():
            containertype = container.getContainerType()
            if containertype and containertype.UID() == self.UID():
                _containers.append(container)
        return _containers