Resolve intermediate key references.
192715
private KeyScope resolveIntermediate(final KeyScope scope) {
        final Map<String, KeyDef> keys = new HashMap<>(scope.keyDefinition);
        for (final Map.Entry<String, KeyDef> e: scope.keyDefinition.entrySet()) {
            final KeyDef res = resolveIntermediate(scope, e.getValue(), Collections.singletonList(e.getValue()));
            keys.put(e.getKey(), res);
        }
        final List<KeyScope> children = new ArrayList<>();
        for (final KeyScope child: scope.childScopes) {
            final KeyScope resolvedChild = resolveIntermediate(child);
            children.add(resolvedChild);
        }
        return new KeyScope(scope.id, scope.name, keys, children);
    }
902536
def extract_keypairs(lines, regexer):
    """"""
    updates = {}
    for line in lines:
        # for consistency we must match the replacer and strip whitespace / newlines
        match = regexer.match(line.strip())
        if not match:
            continue
        k_v = match.groupdict()
        updates[k_v[Constants.KEY_GROUP]] = k_v[Constants.VALUE_GROUP]
    return updates
1130733
function resolveRef(schemaObj, resolvedValues) {
            // the array store referenced value
            var refVal = schemaObj.refVal;
            // the map store full ref id and index of the referenced value in refVal
            // example: { 'test#definitions/option' : 1, 'test#definitions/repo' : 2 }
            var refs = schemaObj.refs;
            // the map to store schema value with sub reference
            var subRefs = {};

            _.forEach(refs, function (index, refId) {
                // if reference id already resolved then continue the loop
                if (refId in resolvedValues) {
                    return true; // continue
                }

                var refValue = refVal[index];
                // if no further nested reference, add to resolved map
                if (_.isEmpty(refValue.refs)) {
                    resolvedValues[refId] = refValue;
                    return true;
                }

                // add schema value with sub reference to map to resolve later
                subRefs[refId] = refValue;
            });

            // resolve sub reference recursively
            _.forEach(subRefs, function (subRef, refId) {
                resolvedValues[refId] = 1;
                resolvedValues[refId] = resolveRef(subRef, resolvedValues);
            });

            return schemaObj.schema;
        }
224230
def _ReferenceFromPairs(pairs, reference=None, app=None, namespace=None):
  
  if reference is None:
    reference = entity_pb.Reference()
  path = reference.mutable_path()
  last = False
  for kind, idorname in pairs:
    if last:
      raise datastore_errors.BadArgumentError(
          'Incomplete Key entry must be last')
    t = type(kind)
    if t is str:
      pass
    elif t is unicode:
      kind = kind.encode('utf8')
    else:
      if issubclass(t, type):
        # Late import to avoid cycles.
        from .model import Model
        modelclass = kind
        if not issubclass(modelclass, Model):
          raise TypeError('Key kind must be either a string or subclass of '
                          'Model; received %r' % modelclass)
        kind = modelclass._get_kind()
        t = type(kind)
      if t is str:
        pass
      elif t is unicode:
        kind = kind.encode('utf8')
      elif issubclass(t, str):
        pass
      elif issubclass(t, unicode):
        kind = kind.encode('utf8')
      else:
        raise TypeError('Key kind must be either a string or subclass of Model;'
                        ' received %r' % kind)
    # pylint: disable=superfluous-parens
    if not (1 <= len(kind) <= _MAX_KEYPART_BYTES):
      raise ValueError('Key kind string must be a non-empty string up to %i'
                       'bytes; received %s' %
                       (_MAX_KEYPART_BYTES, kind))
    elem = path.add_element()
    elem.set_type(kind)
    t = type(idorname)
    if t is int or t is long:
      # pylint: disable=superfluous-parens
      if not (1 <= idorname < _MAX_LONG):
        raise ValueError('Key id number is too long; received %i' % idorname)
      elem.set_id(idorname)
    elif t is str:
      # pylint: disable=superfluous-parens
      if not (1 <= len(idorname) <= _MAX_KEYPART_BYTES):
        raise ValueError('Key name strings must be non-empty strings up to %i '
                         'bytes; received %s' %
                         (_MAX_KEYPART_BYTES, idorname))
      elem.set_name(idorname)
    elif t is unicode:
      idorname = idorname.encode('utf8')
      # pylint: disable=superfluous-parens
      if not (1 <= len(idorname) <= _MAX_KEYPART_BYTES):
        raise ValueError('Key name unicode strings must be non-empty strings up'
                         ' to %i bytes; received %s' %
                         (_MAX_KEYPART_BYTES, idorname))
      elem.set_name(idorname)
    elif idorname is None:
      last = True
    elif issubclass(t, (int, long)):
      # pylint: disable=superfluous-parens
      if not (1 <= idorname < _MAX_LONG):
        raise ValueError('Key id number is too long; received %i' % idorname)
      elem.set_id(idorname)
    elif issubclass(t, basestring):
      if issubclass(t, unicode):
        idorname = idorname.encode('utf8')
      # pylint: disable=superfluous-parens
      if not (1 <= len(idorname) <= _MAX_KEYPART_BYTES):
        raise ValueError('Key name strings must be non-empty strings up to %i '
                         'bytes; received %s' % (_MAX_KEYPART_BYTES, idorname))
      elem.set_name(idorname)
    else:
      raise TypeError('id must be either a numeric id or a string name; '
                      'received %r' % idorname)
  # An empty app id means to use the default app id.
  if not app:
    app = _DefaultAppId()
  # Always set the app id, since it is mandatory.
  reference.set_app(app)
  # An empty namespace overrides the default namespace.
  if namespace is None:
    namespace = _DefaultNamespace()
  # Only set the namespace if it is not empty.
  if namespace:
    reference.set_name_space(namespace)
  return reference
400415
private void resolve(LinkRelation rel) {
    Iterator<LinkRelationRef> refs = rel.getLinkRelationRefs().iterator();
    while (refs.hasNext()) {
      LinkRelationRef ref = refs.next();
      LinkRelation referencedRel = linkRelations.stream()
          .filter(item -> StringUtils.equals(item.getRel(), ref.getRel()))
          .findFirst().orElse(null);
      if (referencedRel == null) {
        refs.remove();
      }
      else {
        if (StringUtils.isBlank(ref.getShortDescription())) {
          ref.setShortDescription(referencedRel.getShortDescription());
        }
      }
    }
  }
1278213
function resolveReferences() {

        for (let key in _variableCollection) {

            let referenceVariables = extractVariables(_variableCollection[key]);

            for (let current = 0; current < referenceVariables.length; current++) {
                if (_.isEmpty(_variableCollection[_.camelCase(referenceVariables[current].variable)]) === false) {
                    _variableCollection[key] = _variableCollection[key].replace(referenceVariables[current].origin, _variableCollection[_.camelCase(referenceVariables[current].variable)]);
                }
            }
        }
    }
352030
def resolve(self, *pargs, **kwargs):
        """"""
        self._cached = (pargs, kwargs)
        self._try_then()
885131
def generic_find_fk_constraint_names(table, columns, referenced, insp):
    """"""
    names = set()

    for fk in insp.get_foreign_keys(table):
        if fk['referred_table'] == referenced and set(fk['referred_columns']) == columns:
            names.add(fk['name'])

    return names
727037
def _initialize_references(model_class, name, bases, attrs):
    """"""
    model_class._references = {}
    h = {}
    deferred = []
    for k, v in attrs.iteritems():
        if isinstance(v, ReferenceField):
            model_class._references[k] = v
            v.name = v.name or k
            att = Attribute(name=v.attname)
            h[v.attname] = att
            setattr(model_class, v.attname, att)
            refd = _initialize_referenced(model_class, v)
            if refd:
                deferred.append(refd)
    attrs.update(h)
    return deferred
698915
function resolvePrimaryKey(row, context) {
    const resAttrNode = context.resourceAttrNode;
    const indexKey = resAttrNode.resolvedPrimaryKey[resAttrNode.primaryDataSource];

    function dereferenceKeyAttr(keyAttr) {
        const keyVal = row[keyAttr];
        if (keyVal === undefined) {
            const attrPath = context.attrPath.length > 0 ? context.attrPath.join('.') : '{root}';
            throw new DataError(
                `Result-row of "${attrPath}" (DataSource "${
                    resAttrNode.primaryDataSource
                }") misses primary key attribute "${keyAttr}"`
            );
        }
        return keyVal;
    }

    if (indexKey.length === 1) {
        context.primaryKey = '' + dereferenceKeyAttr(indexKey[0]);
    } else {
        context.primaryKey = indexKey.map(dereferenceKeyAttr).join(keySeparator);
    }

    // link rows from secondary DataSources by primary key:
    // row from joinVia-DataSource is passed via context here
    context.secondaryRows = context.secondaryRows || {};

    Object.keys(resAttrNode.dataSources).forEach(dataSourceName => {
        if (dataSourceName === resAttrNode.primaryDataSource) return;
        if (resAttrNode.joinVia && dataSourceName === resAttrNode.joinVia) return;
        if (!('resultId' in resAttrNode.dataSources[dataSourceName])) return;

        const secondaryResult = context.rawResults[resAttrNode.dataSources[dataSourceName].resultId];
        if (typeof secondaryResult.indexedData[context.primaryKey] === 'undefined') {
            context.api.log.debug(
                new DataError(
                    `Secondary DataSource "${dataSourceName}" of "` +
                        (context.attrPath.length > 0 ? context.attrPath.join('.') : '{root}') +
                        `": row with key "${context.primaryKey}" not found`
                )
            );
            context.secondaryRows[dataSourceName] = null;
        } else {
            context.secondaryRows[dataSourceName] = secondaryResult.indexedData[context.primaryKey];
        }
    });
}
509594
def resolve_or_missing(self, key):
        
        if self._legacy_resolve_mode:
            rv = self.resolve(key)
            if isinstance(rv, Undefined):
                rv = missing
            return rv
        return resolve_or_missing(self, key)
807724
public HsqlList resolveColumnReferences(RangeVariable[] rangeVarArray,
            HsqlList unresolvedSet) {
        return resolveColumnReferences(rangeVarArray, rangeVarArray.length,
                                       unresolvedSet, true);
    }
442895
def references(self):
        
        return self.connection.query("""
        SELECT concat('`', table_schema, '`.`', table_name, '`') as referencing_table, column_name
        FROM information_schema.key_column_usage
        WHERE referenced_table_name="{tab}" and referenced_table_schema="{db}"
        """.format(tab=self.table_name, db=self.database), as_dict=True)
1254461
def resolve_json_reference(reference, deep_dereference: false, base_path: nil)
      # Try to extract JSON from file or webpage
      reference = join_paths(base_path, reference)
      resolved_reference = load_json(reference)
      if deep_dereference == true
        dereference_descriptor(resolved_reference, base_path: base_path)
      else
        resolved_reference
      end
    end
23186
async def resolve(self, host: str,
                      port: int, family: int) -> List[Dict[str, Any]]:
        """"""
930658
public function getKeys()
    {
        if ($this->_keys === null) {
            $this->_keys = $this->getResolvedPathInfo($this->request)->resolvedValues;
        }
        
        return $this->_keys;
    }
659336
def resolve(self):
        
        if self.source and self.target:
            for key in self.source.keys():
                if (key not in self.dont_carry_over_options
                        and not self.target.has(key)):
                    self.target.set(key, self.source.get(key))