Given a tuple of baseclasses and a dictionary that takes precedence
  over any value in the bases, finds a value with the specified *name*
  and returns it. Raises #KeyError if the value can not be found.
430862
def mro_resolve(name, bases, dict):
  

  if name in dict:
    return dict[name]
  for base in bases:
    if hasattr(base, name):
      return getattr(base, name)
    try:
      return mro_resolve(name, base.__bases__, {})
    except KeyError:
      pass
  raise KeyError(name)
1095371
def get_sdc_by_name(self, name):
        
        for sdc in self.sdc:
            if sdc.name == name:
                return sdc
        raise KeyError("SDC of that name not found")
1341973
def dict_find_key(dd, value):
    
    key = next(key for key, val in dd.items() if val == value)
    return key
693507
def find(value):
        
        value = str(value).lower()
        rtn_dict = RegistryDictionary()
        for attr in dir(MODULE.rdfclass):
            if value in attr.lower():
                try:
                    item = getattr(MODULE.rdfclass, attr)
                    if issubclass(item, RdfClassBase):
                        rtn_dict[attr] = item
                except TypeError:
                    pass
        return rtn_dict
728415
def get_rank_value(cls, name):
    
    if name in cls._RANK_NAMES.values():
      return getattr(cls, name, None)
    return None
536044
def type_named(obj, name):
    
    # if obj is a member of the named class, return True
    name = str(name)
    if obj.__class__.__name__ == name:
        return obj.__class__
    for base in type_bases(obj):
        if base.__name__ == name:
            return base
    raise ValueError('Unable to extract class of name ' + name)
753363
def find(self, name):
    
    for i in range(0, len(self)):
      if self[i].name == name:
        return i
    return -1
751081
def _find_Generic_super_origin(subclass, superclass_origin):
    
    stack = [subclass]
    param_map = {}
    while len(stack) > 0:
        bs = stack.pop()
        if is_Generic(bs):
            if not bs.__origin__ is None and len(bs.__origin__.__parameters__) > 0:
                for i in range(len(bs.__args__)):
                    ors = bs.__origin__.__parameters__[i]
                    if bs.__args__[i] != ors and isinstance(bs.__args__[i], TypeVar):
                        param_map[ors] = bs.__args__[i]
            if (bs.__origin__ is superclass_origin or \
                    (bs.__origin__ is None and bs is superclass_origin)):
                prms = []
                try:
                    if len(bs.__origin__.__parameters__) > len(bs.__parameters__):
                        prms.extend(bs.__origin__.__parameters__)
                    else:
                        prms.extend(bs.__parameters__)
                except:
                    prms.extend(bs.__parameters__)
                for i in range(len(prms)):
                    while prms[i] in param_map:
                        prms[i] = param_map[prms[i]]
                return prms
            try:
                stack.extend(bs.__orig_bases__)
            except AttributeError:
                stack.extend(bs.__bases__)
    return None
1361888
def lookup(cls, name):
        
        try:
            field = cls.FIELDS[name]
        except KeyError:
            # Is it a custom attribute?
            field = TorrentProxy.add_manifold_attribute(name)

        return {"matcher": field._matcher} if field else None
993499
def lookup_value(self, api_name, key):
        
        if api_name in self._cache:
            return self._cache[api_name].get(key, None)
        return None
1174772
def lookup(node, name):
    
    if isinstance(
        node, (astroid.List, astroid.Tuple, astroid.Const, astroid.Dict, astroid.Set)
    ):
        return _builtin_lookup(node, name)
    if isinstance(node, astroid.Instance):
        return _lookup_in_mro(node, name)
    if isinstance(node, astroid.ClassDef):
        return _class_lookup(node, name)

    raise exceptions.AttributeInferenceError(attribute=name, target=node)
718971
def get(self, name, *subkey):
        
        if subkey == []:
            return self.get_atomic(name)
        else:
            return self.get_subkey(name, tuple(subkey))
224509
def _get_simple(self, name):
        
        for item in reversed(self._stack):
            result = _get_value(item, name)
            if result is not _NOT_FOUND:
                return result

        raise KeyNotFoundError(name, "part missing")
514035
def get_value(self, name):
        
        # first clean up the name
        name = self._clean_up_name(name)

        # now get the parameter object
        x = self._find_parameter(name.split('/'))

        # quit if it pooped.
        if x == None: return None

        # get the value and test the bounds
        value  = x.value()
        
        # handles the two versions of pyqtgraph
        bounds = None
    
        # For lists, just make sure it's a valid value
        if x.opts['type'] == 'list':

            # If it's not one from the master list, choose
            # and return the default value.            
            if not value in x.opts['values']:
                
                # Only choose a default if there exists one                
                if len(x.opts('values')):                              
                    self.set_value(name, x.opts['values'][0])                
                    return x.opts['values'][0]
                
                # Otherwise, just return None and do nothing                
                else: return None

        # For strings, make sure the returned value is always a string.
        elif x.opts['type'] in ['str']: return str(value)
                
        # Otherwise assume it is a value with bounds or limits (depending on 
        # the version of pyqtgraph)    
        else:        
            if   'limits' in x.opts: bounds = x.opts['limits']
            elif 'bounds' in x.opts: bounds = x.opts['bounds']
            if not bounds == None:
                if not bounds[1]==None and value > bounds[1]: value = bounds[1]
                if not bounds[0]==None and value < bounds[0]: value = bounds[0]
            
        # return it        
        return value
1249433
def _dict_lookup(cls, item, **kwargs):
        '''
        
        '''
        log.debug('item == %s', item)
        value_lookup = kwargs.get('value_lookup', False)
        if 'lookup' in kwargs:
            for k, v in six.iteritems(kwargs['lookup']):
                if value_lookup:
                    if six.text_type(v).lower() == six.text_type(item).lower():
                        log.debug('returning key %s', k)
                        return k
                else:
                    if six.text_type(k).lower() == six.text_type(item).lower():
                        log.debug('returning value %s', v)
                        return v
        return 'Invalid Value'
1142012
def base_warfare(name, bases, attributes):
    

    assert len(bases) == 1, "{0} | '{1}' object has multiple bases!".format(__name__, name)

    base = foundations.common.get_first_item(bases)
    for name, value in attributes.iteritems():
        if name != "__metaclass__":
            setattr(base, name, value)
    return base
1298875
def get(self, name: str):
        
        dep = None
        try:
            dep = self._registry[name]
        except KeyError:
            raise DependencyNotFoundError(name) from None
        value = self.cached(dep)
        if value is None:
            value = dep.factory()
            self.cache(dep, value)
        return value