:return: a single value from lists, tuples or sets with one item;
    otherwise, the value itself if not empty or the default if it is.
356589
def reduce_value(value, default=EMPTY_STR):
    

    if hasattr(value, '__len__'):
        vlen = len(value)

        if vlen == 0:
            return default
        elif vlen == 1:
            if isinstance(value, set):
                return value.pop()
            elif isinstance(value, _reduce_types):
                return value[0]

    return default if value is None else value
413976
def _not_none(items):
    """"""
    if not isinstance(items, (tuple, list)):
        items = (items,)
    return all(item is not _none for item in items)
390581
def get_value(self, default=None):
        
        if default is None:
            default = ''

        try:
            text = self.currentText()

        except ValueError:
            lg.debug('Cannot convert "' + str(text) + '" to list. ' +
                     'Using default ' + str(default))
            text = default
            self.set_value(text)

        return text
997819
def get(self, option, default=None):
        ''''''
        val = self[option]
        return (val is None and default) or val
563208
def values(self):
        ""
        return tuple(set(self.new.values()).union(self.old.values()))
25406
def set(self, value):
        '''
        
        '''
        with self._lock.exclusive:
            self._value = value
            return value
915785
def value(self, key, default=None):
        
        curr = self._stack[-1]
        return curr.get(key, default)
573707
def get_default_value(self):
        
        default = self.default_value
        if isinstance(default, collections.Callable):
            default = default()
        return default
1124359
def value(self):
        
        try:
            value = self.lastValue
        except IndexError:
            value = "NaN"
        except ValueError:
            value = "NaN"
        return value
841069
def require(self, value):
        

        if value is not None:
            assert type(value) in (tuple, list), "'{0}' attribute: '{1}' type is not 'tuple' or 'list'!".format(
                "require", value)
        self.__require = value
350900
def value_or_default(self, value):
        '''  '''
        if value is None:
            if callable(self.default):
                return self.default()
            else:
                return self.default

        return value
137085
def get(self, key, default=None):
        
        try:
            val = self
            if "." not in key:
                return self[key]
            for k in key.split('.'):
                if k.isdigit():
                    k = int(k)
                val = val[k]
            return val
        except (TypeError, KeyError, IndexError) as e:
            return default
1347616
def one_item(self, item, detach:bool=False, denorm:bool=False, cpu:bool=False):
        ""
        ds = self.single_ds
        with ds.set_item(item):
            return self.one_batch(ds_type=DatasetType.Single, detach=detach, denorm=denorm, cpu=cpu)
803263
def from_tuple(self, t):
        
        if len(t) > 1:
            self.id = t[0]
            self.sitting = t[1]
        else:
            self.sitting = t[0]
            self.id = None
        return self
23985
def has_value(cls, value: int) -> bool:
        """"""
        return any(value == item.value for item in cls)
177387
def value(self) -> Union[bool, None]:
        
        self.simplify()
        if self.is_true:
            return True
        elif self.is_false:
            return False
        else:
            return None
1137268
def match_item(key, value, item):
    
    if isinstance(value, (list, tuple)):
        return any(match_item(key, sub_value, item) for sub_value in value)
    else:
        return key not in item or str(item.get(key)).lower() == str(value).lower()