Common code for fetching a key or value from a remapping dict.
160526
def _FetchRemapping(type_name, mapping_type, python_name=None, json_name=None,
                    mappings=None):
    """"""
    if python_name and json_name:
        raise exceptions.InvalidDataError(
            'Cannot specify both python_name and json_name '
            'for %s remapping' % mapping_type)
    if not (python_name or json_name):
        raise exceptions.InvalidDataError(
            'Must specify either python_name or json_name for %s remapping' % (
                mapping_type,))
    field_remappings = mappings.get(type_name, {})
    if field_remappings:
        if python_name:
            return field_remappings.get(python_name)
        elif json_name:
            if json_name in list(field_remappings.values()):
                return [k for k in field_remappings
                        if field_remappings[k] == json_name][0]
    return None
735472
def get(self, key):
        
        keystr = str(key)
        res = None

        try:
            res = self.ctx[keystr]
        except KeyError:
            for k, v in self.ctx.items():
                if "name" in v and v["name"].lower() == keystr.lower():
                    res = v
                    break

        return res
729377
function Dict_get(key1, key2, key3) {
      var value;
      var xref = this.xref;
      if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map ||
          typeof key2 === 'undefined') {
        return xref ? xref.fetchIfRef(value) : value;
      }
      if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map ||
          typeof key3 === 'undefined') {
        return xref ? xref.fetchIfRef(value) : value;
      }
      value = this.map[key3] || null;
      return xref ? xref.fetchIfRef(value) : value;
    }
706050
def _remap_key(key):
    
    if key in KNOWN_PARAMS:
        return key
    if key.lower() in known_params:
        return KNOWN_PARAMS[known_params.index(key.lower())]
    return key
407525
def __get_value_from_data(self, key, data):
        
        if key.isdigit():
            return data[int(key)]

        if key not in data:
            raise KeyError("Key not exists")

        return data.get(key)
188026
def keys(self, **kwargs):
        
        warnings.warn('Use of `rel.fetch.keys()` notation is deprecated. '
                      'Please use `rel.fetch("KEY")` or `rel.fetch(dj.key)` for equivalent result', stacklevel=2)
        yield from self._expression.proj().fetch(as_dict=True, **kwargs)
1091009
def get(self, key):
        ""
        if key in self.keys():
            return self[key]
        else:
            res = None
            for v in self.values():
                # This could get weird if the actual expected returned value
                # is None, especially in teh case of overlap. Any ambiguity
                # would be resolved by get_path(s).
                if hasattr(v, 'get'):
                    res = v.get(key)
                if res is not None:
                    break
            return res
1155126
def generic_var(self, key, value=None):
        
        return self._get_or_set('{0}{1}'.format(self._GENERIC_VAR_KEY_PREFIX, key), value)
1285813
def getkey(mapping, value, default=None, use_id=False):
    '''
    '''
    if use_id:
        for key, val in mapping.items():
            if val is value:
                return key
    else:
        for key, val in mapping.items():
            if val == value:
                return key
    return default
1235454
def get_keys(self, keymap):
        """"""
        keys = dict(modifiers=[], regular=[])

        # loop on keymap bytes
        for keymap_index, keymap_byte in enumerate(keymap):
            try:
                keymap_values = self._keymap_values_dict[keymap_index]
            except KeyError:
                continue

            # loop on keymap_values for that keymap byte
            for key, value in keymap_values.items():
                if not keymap_byte & key:
                    continue
                elif value in self._modifiers:
                    keys['modifiers'].append(value)
                elif not keys['regular']:
                    keys['regular'].append(value)

        return keys
561482
def get_key(self, key):
        
        return self.__mapping.get(self.type(key), self.__getitem__)(key)
1064149
def get (self, key, def_val=None):
        """"""
        assert isinstance(key, basestring)
        return dict.get(self, key.lower(), def_val)
1069852
def get_value(self, key):
        # type: (str) -> Any
        
        try:
            return self._dictionary[key]
        except KeyError:
            raise ConfigurationError("No such key - {}".format(key))
343076
def get(self, key):
        
        if key == None or key == '':
            return None
        elif key.find('.') > 0:
            return RecursiveObjectReader.get_property(self, key)
        else:
            return super(Parameters, self).get(key)
100976
def _transform_key_value(self, key, value, map_dict):
        '''
        '''

        if key in self.tcl_list_patterns:
            value = self._parse_tcl_list(key, value)

        if key in map_dict:
            key = map_dict[key]

        return key, value
397313
def hmget(self, name, keys, *args):
        
        member_encode = self.memberparse.encode
        keys = [k for k in self._parse_values(keys, args)]
        with self.pipe as pipe:
            f = Future()
            res = pipe.hmget(self.redis_key(name),
                             [member_encode(k) for k in keys])

            def cb():
                f.set([self._value_decode(keys[i], v)
                       for i, v in enumerate(res.result)])

            pipe.on_execute(cb)
            return f
911739
def fetch_value(key)
      val = fetch_nested(key)
      return val if self[:no_pruning].include?(key)
      Prunable::VALUES.include?(val) ? Prunable::Value : val
    end