Return the value of the ``./c:grouping{val=?}`` attribute, taking
        defaults into account when items are not present.
437849
def grouping_val(self):
        
        grouping = self.grouping
        if grouping is None:
            return ST_Grouping.STANDARD
        val = grouping.val
        if val is None:
            return ST_Grouping.STANDARD
        return val
498342
def get(self, fallback=not_set):
        

        envvar_value = self._get_envvar_value()
        if envvar_value is not not_set:
            return envvar_value

        if self.has_value:
            if self._value is not not_set:
                return self._value
            else:
                return copy.deepcopy(self.default)
        elif fallback is not not_set:
            return fallback
        elif self.required:
            raise RequiredValueMissing(name=self.name, item=self)
        return fallback
387963
def get_attr(item, name, default=None):
    '''  '''
    try:
        val = item[name]
    except (KeyError, TypeError):
        try:
            val = getattr(item, name)
        except AttributeError:
            val = default
    return val
193756
def get_group_value(self, token, match):
        """"""
        try:
            value = match.group('{}_{}'.format(token.name, self.group))
        except IndexError:
            value = ''
        return self.func(value) if callable(self.func) else value
1026363
def get_min_value(self):
        

        value = self.get_default_value()

        if self.attribute_type is str:
            min_value = value[:self.min_length - 1]

        elif self.attribute_type is int:
            min_value = self.min_length - 1

        else:
            raise TypeError('Attribute %s can not have a minimum value' % self.local_name)

        return min_value
225831
def get(self, item, default_value=None):
        

        found, name = self._contains_and_name(item)
        if found:
            return self._record_map[name]['value']
        else:
            return default_value
176367
def _find(self, pair, default=None):
        
        from fontTools.ufoLib.kerning import lookupKerningValue
        font = self.font
        groups = font.groups
        return lookupKerningValue(pair, self, groups, fallback=default)
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
1095771
def get_value(self, attributes,key = None):
        

        value = attributes
        if key is None:
            key = self._splitted_key

        # A splitted key like 'a.b.c' goes into nested properties
        # and the value is retrieved recursively
        for i,elem in enumerate(key):
            if isinstance(value, (list,tuple)):
                #if this is a list, we return all matching values for the given list items
                return [self.get_value(v,key[i:]) for v in value]
            else:
                value = value[elem]

        return value
944721
def by_value(self, value, default=None):
        
        try:
            return [k for k, v in self.items() if v == value][0]
        except IndexError:
            if default is not None:
                return default
            raise ValueError('%s' % value)
60495
def OnGetItemAttr(self, item):
        """"""
        if self.indicated > -1 and item == self.indicated:
            return self.indicated_attribute
        return None
1329166
def retrieve_value(self, name, default_value=None):
        """"""
        value = self.spine.send_query("retrieveSetting", self.group, name, processes=["kervi-main"])
        if value is None:
            return default_value
        elif isinstance(value, list) and len(value) == 0:
            return default_value
        elif isinstance(default_value, int):
            return int(value)
        elif isinstance(default_value, float):
            return float(value)
        else:
            return value
341404
def int(self, item, default=None):
        
        try:
            item = self.__getattr__(item)
        except AttributeError as err:
            if default is not None:
                return default
            raise err
        return int(item)
350900
def value_or_default(self, value):
        '''  '''
        if value is None:
            if callable(self.default):
                return self.default()
            else:
                return self.default

        return value
916595
def get_lookup_value(self, value):
        
        choices = self._field_choices()
        if choices:
            if isinstance(value, list):
                return [c[0] for c in choices if c[1] in value]
            else:
                for c in choices:
                    if c[1] == value:
                        return c[0]
        return value
347551
def find_val(self, eq, val):
        """"""
        if eq not in ('f', 'g', 'q'):
            return
        elif eq in ('f', 'q'):
            key = 'unamex'
        elif eq == 'g':
            key = 'unamey'
        idx = 0
        for m, n in zip(self.system.varname.__dict__[key], self.__dict__[eq]):
            if n == val:
                return m, idx
            idx += 1
        return
434708
def _check_default(value, parameter, default_chars):
    ''''''
    # not using a set here because it fails when value is unhashable
    if value in default_chars:
        if parameter.default is inspect.Parameter.empty:
            raise ValueError('Value was empty, but no default value is given in view function for parameter: {} ({})'.format(parameter.position, parameter.name))
        return parameter.default
    return value