Handle references.
776806
def reference(self, t, i, in_group=False):
        """"""

        current = []

        if not in_group and t == "m":
            current.append(self._re_start_wb)
        elif not in_group and t == "M":
            current.append(self._re_end_wb)
        elif not in_group and t == "R":
            current.append(self._re_line_break)
        elif not in_group and t == "X":
            no_mark = self.unicode_props("^m", None, in_group=False)[0]
            mark = self.unicode_props("m", None, in_group=False)[0]
            current.extend(self._grapheme_cluster % (no_mark, mark, mark))
        elif t == "e":
            current.append(self._re_escape)
        elif t == "l":
            current.extend(self.letter_case_props(_LOWER, in_group))
            self.found_property = True
        elif t == "L":
            current.extend(self.letter_case_props(_LOWER, in_group, negate=True))
            self.found_property = True
        elif t == "c":
            current.extend(self.letter_case_props(_UPPER, in_group))
            self.found_property = True
        elif t == "C":
            current.extend(self.letter_case_props(_UPPER, in_group, negate=True))
            self.found_property = True
        elif t == 'p':
            prop = self.get_unicode_property(i)
            current.extend(self.unicode_props(prop[0], prop[1], in_group=in_group))
            if in_group:
                self.found_property = True
        elif t == 'P':
            prop = self.get_unicode_property(i)
            current.extend(self.unicode_props(prop[0], prop[1], in_group=in_group, negate=True))
            if in_group:
                self.found_property = True
        elif t == "N":
            text = self.get_named_unicode(i)
            current.extend(self.unicode_name(text, in_group))
            if in_group:
                self.found_named_unicode = True
        else:
            current.extend(["\\", t])
        return current
566368
def relative_ref(*parts):
    

    def relative_ref(_value, context, **_params):
        return reference.Relative(*(parts + (context["key"], )))

    return relative_ref
407542
def _add_reference(self, obj, ident=0):
        
        log_debug(
            "## New reference handle 0x{0:X}: {1} -> {2}".format(
                len(self.references) + self.BASE_REFERENCE_IDX,
                type(obj).__name__,
                repr(obj),
            ),
            ident,
        )
        self.references.append(obj)
1030735
def enforce_relationship_refs(instance):
    """"""
    if instance['type'] != 'bundle' or 'objects' not in instance:
        return

    rel_references = set()

    """Find and store all ids"""
    for obj in instance['objects']:
        if obj['type'] != 'relationship':
            rel_references.add(obj['id'])

    """Check if id has been encountered"""
    for obj in instance['objects']:
        if obj['type'] == 'relationship':
            if obj['source_ref'] not in rel_references:
                yield JSONError("Relationship object %s makes reference to %s "
                                "Which is not found in current bundle "
                                % (obj['id'], obj['source_ref']), 'enforce-relationship-refs')

            if obj['target_ref'] not in rel_references:
                yield JSONError("Relationship object %s makes reference to %s "
                                "Which is not found in current bundle "
                                % (obj['id'], obj['target_ref']), 'enforce-relationship-refs')
280366
private void connectReferences() {
        // ready to associate initalized beans with references
        for (Bean bean : beans.values()) {
            for (JpaRef ref : refs.get(bean.getId())) {
                BeanId target = ref.getTarget();
                Bean targetBean = beans.get(target);
                target.setBean(targetBean);
                bean.addReference(ref.getPropertyName(), target);
            }
        }
    }
485491
def _is_reference(bpe):
    """"""
    if isinstance(bpe, _bp('ProteinReference')) or \
        isinstance(bpe, _bpimpl('ProteinReference')) or \
        isinstance(bpe, _bp('SmallMoleculeReference')) or \
        isinstance(bpe, _bpimpl('SmallMoleculeReference')) or \
        isinstance(bpe, _bp('RnaReference')) or \
        isinstance(bpe, _bpimpl('RnaReference')) or \
        isinstance(bpe, _bp('EntityReference')) or \
        isinstance(bpe, _bpimpl('EntityReference')):
        return True
    else:
        return False
790242
def set_references(self, references):
        
        super(CompositeLogger, self).set_references(references)
        # descriptor = Descriptor(None, "logger", None, None, None)
        loggers = references.get_optional(Descriptor(None, "logger", None, None, None))
        for logger in loggers:
            if isinstance(logger, ILogger):
                self._loggers.append(logger)
740755
def _get_ref(data, position, obj_end, opts, element_name):
    """"""
    collection, position = _get_string(
        data, position, obj_end, opts, element_name)
    oid, position = _get_oid(data, position, obj_end, opts, element_name)
    return DBRef(collection, oid), position
282727
def _references_content(ref_files):
  """"""
  example_spec = {
      "url": tf.FixedLenFeature([], tf.string),
      "content": tf.FixedLenFeature([], tf.string),
  }
  data = {}
  for ex in generator_utils.tfrecord_iterator(
      ref_files, gzipped=True, example_spec=example_spec):
    data[ex["url"]] = text_encoder.to_unicode(ex["content"])
  return data
1164221
public void setReferences(IReferences references) {
		Object contextInfo = references.getOneOptional(new Descriptor("pip-services3", "context-info", "*", "*", "1.0"));
		if (contextInfo instanceof ContextInfo && contextInfo != null && _source == null)
			_source = ((ContextInfo) contextInfo).getName();
	}
455720
def __clear_references(self, request, remove_request=True):
        """"""
        # remove request itself
        if remove_request:
            with self.__requests:
                self.__requests.pop(request.id_)
        # remove request type specific references
        if not request.success:
            with self.__pending_subs:
                self.__pending_subs.pop(request.id_, None)
            with self.__pending_controls:
                self.__pending_controls.pop(request.id_, None)
1115556
def replace_references(self, node):
        
        href = node.getAttribute('href')
        if href is None:
            return
        id = href.getValue()
        ref = self.catalog.get(id)
        if ref is None:
            log.error('soap multiref: %s, not-resolved', id)
            return
        node.append(ref.children)
        node.setText(ref.getText())
        for a in ref.attributes:
            if a.name != 'id':
                node.append(a)
        node.remove(href)
1220277
def reference(self, t, i, in_group=False):
        """"""

        current = []

        if not in_group and t == "R":
            current.append(self._re_line_break)
        elif t == 'e':
            current.extend(self._re_escape)
        else:
            current.extend(["\\", t])
        return current
626680
def handle_entityref(self, name):
        
        self.log.debug( u'Encountered entity  : {0}'.format(name) )
        if not self.removeEntity:
            self.data.append('&%s;' % name)
528413
def _dereference(cls, documents, references):
        """"""

        # Dereference each reference
        for path, projection in references.items():

            # Check there is a $ref in the projection, else skip it
            if '$ref' not in projection:
                continue

            # Collect Ids of documents to dereference
            ids = set()
            for document in documents:
                value = cls._path_to_value(path, document)
                if not value:
                    continue

                if isinstance(value, list):
                    ids.update(value)

                elif isinstance(value, dict):
                    ids.update(value.values())

                else:
                    ids.add(value)

            # Find the referenced documents
            ref = projection.pop('$ref')
            frames = ref.many(
                {'_id': {'$in': list(ids)}},
                projection=projection
                )
            frames = {f._id: f for f in frames}

            # Add dereferenced frames to the document
            for document in documents:
                value = cls._path_to_value(path, document)
                if not value:
                    continue

                if isinstance(value, list):
                    # List of references
                    value = [frames[id] for id in value if id in frames]

                elif isinstance(value, dict):
                    # Dictionary of references
                    value = {key: frames.get(id) for key, id in value.items()}

                else:
                    value = frames.get(value, None)

                child_document = document
                keys = cls._path_to_keys(path)
                for key in keys[:-1]:
                    child_document = child_document[key]
                child_document[keys[-1]] = value
83054
def _find_references(model_name, references=None):
    
    references = references or []
    references.append(model_name)

    ref = MODELS[model_name].get('reference')
    if ref is not None:
        _find_references(ref, references)

    parent_models = [m for m in references]
    parent_models.reverse()

    return parent_models
1359562
def add_reference(self, source, target, **kwargs):
        
        # Tweak keyword arguments for addReference
        addRef_kw = kwargs.copy()
        addRef_kw.setdefault("referenceClass", self.referenceClass)
        if "schema" in addRef_kw:
            del addRef_kw["schema"]
        uid = api.get_uid(target)
        rc = api.get_tool("reference_catalog")
        # throws IndexError if uid is invalid
        rc.addReference(source, uid, self.relationship, **addRef_kw)
        # link the version of the reference
        self.link_version(source, target)