Create forward references for all circular references
        :return:
350035
def resolve_circular_references(self) -> None:
        
        circulars = self.circular_references()
        for c in circulars:
            fwdref = JSGForwardRef(c)
            self.grammarelts[fwdref.label] = fwdref
            self.forward_refs[c] = fwdref.label
1191834
def _get_forward_relationships(opts):
    
    forward_relations = OrderedDict()
    for field in [field for field in opts.fields if field.serialize and field.rel]:
        forward_relations[field.name] = RelationInfo(
            model_field=field,
            related_model=_resolve_model(field.rel.to),
            to_many=False,
            to_field=_get_to_field(field),
            has_through_model=False
        )

    # Deal with forward many-to-many relationships.
    for field in [field for field in opts.many_to_many if field.serialize]:
        forward_relations[field.name] = RelationInfo(
            model_field=field,
            related_model=_resolve_model(field.rel.to),
            to_many=True,
            # manytomany do not have to_fields
            to_field=None,
            has_through_model=(
                not field.rel.through._meta.auto_created
            )
        )

    return forward_relations
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
273713
def forwards(self, orm):
        ""
        from django.contrib.auth.models import Group

        projects = orm['samples.Project'].objects.all()

        # Create group for each project
        for project in projects:
            name = PROJECT_GROUP_TEMPLATE.format(project.name)
            Group.objects.get_or_create(name=name)
566368
def relative_ref(*parts):
    

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

    return relative_ref
1359432
def _decref_dependencies_recursive(self, term, refcounts, garbage):
        
        # Edges are tuple of (from, to).
        for parent, _ in self.graph.in_edges([term]):
            refcounts[parent] -= 1
            # No one else depends on this term. Remove it from the
            # workspace to conserve memory.
            if refcounts[parent] == 0:
                garbage.add(parent)
                self._decref_dependencies_recursive(parent, refcounts, garbage)
53103
def references(self):
        
        return [
            (tail, head)
            for tail in self.vertices
            for head in self.children(tail)
        ]
101428
def _forward(self, x_dot_parameters):
        
        return forward(self._lattice, x_dot_parameters, 
                       self.state_machine.n_states)
1228066
def gen_references(self) -> str:
        
        rval = []
        for cls in self.schema.classes.values():
            pkeys = self.primary_keys_for(cls)
            for pk in pkeys:
                pk_slot = self.schema.slots[pk]
                classname = camelcase(cls.name) + camelcase(pk)
                if cls.is_a and getattr(self.schema.classes[cls.is_a], pk, None):
                    parent = self.range_type_name(pk_slot, cls.is_a)
                else:
                    parent = self.python_name_for(pk_slot.range)
                rval.append(f'class {classname}({parent}):\n\tpass')
        return '\n\n\n'.join(rval)
1130095
def _forward_iterator(self):
        ""
        path = [(self, 0, Bits())]
        while path:
            node, idx, prefix = path.pop()
            if idx==0 and node.value is not None and not node.prune_value:
                yield (self._unpickle_key(prefix), self._unpickle_value(node.value))
            if idx<len(node.children):
                path.append((node, idx+1, prefix))
                link = node.children[idx]
                if not link.pruned:
                    path.append((link.node, 0, prefix + link.prefix))
1193728
def forwards(self, orm):
        ""
        # Project labels
        names = list(orm['samples.Project'].objects.values_list('label', flat=True))
        orm['samples.Cohort'].objects.filter(name__in=names).update(published=True)

        # World cohort
        orm['samples.Cohort'].objects.filter(name=DEFAULT_COHORT_NAME).update(published=True)
38096
def _get_reference(self):
        """"""
        sha, target_ref_path = self._get_ref_info(self.repo, self.path)
        if target_ref_path is None:
            raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha))
        return self.from_path(self.repo, target_ref_path)
1113863
def copy_with_new_relations(self, new_relations):
        """"""
        result = self.__class__(self.forward.items())
        result.add_relations(new_relations.items())
        result.previous_ends1 = set(new_relations.values())
        return result
89883
function dereference (parser, options) {
  // console.log('Dereferencing $ref pointers in %s', parser.$refs._root$Ref.path);
  var dereferenced = crawl(parser.schema, parser.$refs._root$Ref.path, "#", [], parser.$refs, options);
  parser.$refs.circular = dereferenced.circular;
  parser.schema = dereferenced.value;
}
1219893
def _references(self, i, sequence=False):
        """"""

        value = ''

        c = next(i)
        if c == '\\':
            # \\
            if sequence and self.bslash_abort:
                raise PathNameException
            value = c
        elif c == '/':
            # \/
            if sequence:
                raise PathNameException
            i.rewind(1)
        else:
            # \a, \b, \c, etc.
            pass
        return value
102225
def forwards(self, orm):
        ""
        for category in orm['document_library.DocumentCategory'].objects.all():
            category.is_published = True
            category.save()
119701
def _completed_families(self, reference_name, rightmost_boundary):
        ''''''
        in_progress = self._right_coords_in_progress[reference_name]
        while len(in_progress):
            right_coord = in_progress[0]
            if right_coord < rightmost_boundary:
                in_progress.pop(0)
                left_families = self._coordinate_family.pop((reference_name, right_coord), {})
                for family in sorted(left_families.values(),
                                     key=lambda x:x[0].left.reference_start):
                    family.sort(key=lambda x: x.query_name)
                    self.pending_pair_count -= len(family)
                    yield family
            else:
                break