Obtain the unit selected by user.

        :returns: Metadata of the selected unit.
        :rtype: dict, None
763635
def selected_unit(self):
        
        item = self.lstUnits.currentItem()
        try:
            return definition(item.data(QtCore.Qt.UserRole))
        except (AttributeError, NameError):
            return None
466600
def get_base_equivalent(self, unit_system=None):
        
        from unyt.unit_registry import _sanitize_unit_system

        unit_system = _sanitize_unit_system(unit_system, self)
        try:
            conv_data = _check_em_conversion(
                self.units, registry=self.registry, unit_system=unit_system
            )
        except MKSCGSConversionError:
            raise UnitsNotReducible(self.units, unit_system)
        if any(conv_data):
            new_units, _ = _em_conversion(self, conv_data, unit_system=unit_system)
        else:
            try:
                new_units = unit_system[self.dimensions]
            except MissingMKSCurrent:
                raise UnitsNotReducible(self.units, unit_system)
        return Unit(new_units, registry=self.registry)
783548
def all_units_idle(self):
        
        for unit in self.units.values():
            unit_status = unit.data['agent-status']['current']
            if unit_status != 'idle':
                return False
        return True
922501
def get_all_units(self, params=None):
        
        if not params:
            params = {}
        return self._iterate_through_pages(self.get_units_per_page, resource=UNITS, **{'params': params})
573135
def serialize(self):
        
        pickle = super(ResourceParameter, self).serialize()
        pickle['frequency'] = self.frequency
        pickle['unit'] = self._unit.serialize()
        return pickle
652073
def get_class_name(self):
        
        if self.class_idx_value is None:
            self.class_idx_value = self.CM.get_type(self.class_idx)

        return self.class_idx_value
596029
def getSelectedRadioButton(self):
        """"""
        radioButtonListInGroup = PygWidgetsRadioButton.__PygWidgets__Radio__Buttons__Groups__Dicts__[self.group]
        for radioButton in radioButtonListInGroup:
            if radioButton.getValue():
                selectedNickname = radioButton.getNickname()
                return selectedNickname

        raise Exception('No radio button was selected')
73695
def as_dict(self):
        
        #TODO/FIXME: add selected information
        if self.hidden:
            rdict = {}
        else:
            def_selected = self.selected()
            comps = [
                {
                    'name': comp.name,
                    'default': comp.name in self.defaults,
                    'options': comp.get_ordered_options() if isinstance(comp, Optionable) else None
                }
                for comp in self
            ]
            rdict = {
                'name': self.name,
                'required': self.required,
                'multiple': self.multiple,
                'args': self.in_name,
                'returns': self.out_name,
                'components': comps
            }
        return rdict
866684
def unit_system_id(self):
        
        if self._unit_system_id is None:
            hash_data = bytearray()
            for k, v in sorted(self.lut.items()):
                hash_data.extend(k.encode("utf8"))
                hash_data.extend(repr(v).encode("utf8"))
            m = md5()
            m.update(hash_data)
            self._unit_system_id = str(m.hexdigest())
        return self._unit_system_id
946838
def get_units(username):
    
    connection, ldap_base = _get_LDAP_connection()

    # Search the user dn
    connection.search(
        search_base=ldap_base,
        search_filter='(uid={}@*)'.format(username),
    )

    # For each user dn give me the unit
    dn_list = [connection.response[index]['dn'] for index in range(len(connection.response))]

    units = []
    # For each unit search unit information and give me the unit id
    for dn in dn_list:
        unit = dn.split(",ou=")[1]
        connection.search(search_base=ldap_base, search_filter='(ou={})'.format(unit), attributes=['uniqueidentifier'])
        units.append(get_attribute(connection.response, 'uniqueIdentifier'))

    return units
334254
def units(self):
        
        self._units, value = self.get_attr_string(self._units, 'units')
        return value
805107
def _get_wx_units(self, params, name):
        
        units = ""
        for param in params:
            if str(name) == str(param['name']):
                units = param['units']
        return units
25899
private TimeUnit getPollUnit() {
    String unit = mProperties.getProperty(CSV_KEY_UNIT);
    if (unit == null) {
      unit = CSV_DEFAULT_UNIT;
    }
    return TimeUnit.valueOf(unit.toUpperCase());
  }
1126331
def temp_unit(self):
        """"""
        if CONST.UNIT_FAHRENHEIT in self._get_status(CONST.TEMP_STATUS_KEY):
            return CONST.UNIT_FAHRENHEIT
        elif CONST.UNIT_CELSIUS in self._get_status(CONST.TEMP_STATUS_KEY):
            return CONST.UNIT_CELSIUS
        return None
62513
def speech(self) -> str:
        
        if not self.data:
            self.update()
        return speech.metar(self.data, self.units)
511329
def get_state_machine_selection(self):
        
        if self._selected_sm_model:
            return self._selected_sm_model.selection, self._selected_sm_model.selection.states
        else:
            return None, set()
310437
def list_units(self):
        
        for page in self._request('Units.List'):
            for unit in page.get('units', []):
                yield Unit(client=self, data=unit)