Process connections and transform them into recast neighbour flags
342024
void build(int nodeOffset, GraphMeshData graphData, List<int[]> connections) {
		for (int n = 0; n < connections.size(); n++) {
			int[] nodeConnections = connections.get(n);
			MeshData tile = graphData.getTile(n);
			Poly node = graphData.getNode(n);
			for (int connection : nodeConnections) {
				MeshData neighbourTile = graphData.getTile(connection - nodeOffset);
				if (neighbourTile != tile) {
					buildExternalLink(tile, node, neighbourTile);
				} else {
					Poly neighbour = graphData.getNode(connection - nodeOffset);
					buildInternalLink(tile, node, neighbourTile, neighbour);
				}
			}
		}
	}
1018667
def relabel(self, i):
        '''
        
        '''
        min_distance = 2*len(self.get_node_list()) + 1
        for j in self.get_neighbors(i):
            if (self.get_node_attr(j, 'distance') < min_distance and
                (self.get_edge_attr(i, j, 'flow') <
                 self.get_edge_attr(i, j, 'capacity'))):
                min_distance = self.get_node_attr(j, 'distance')
        for j in self.get_in_neighbors(i):
            if (self.get_node_attr(j, 'distance') < min_distance and
                self.get_edge_attr(j, i, 'flow') > 0):
                min_distance = self.get_node_attr(j, 'distance')
        self.set_node_attr(i, 'distance', min_distance + 1)
1243537
protected void processRemoterElements(TypeSpec.Builder classBuilder, ElementVisitor elementVisitor, MethodSpec.Builder methodBuilder) {
        processRemoterElements(classBuilder, getRemoterInterfaceElement(), 0, elementVisitor, methodBuilder);
    }
885357
def post_process(relations, opts)
      Process::CircularDeps.new(relations).process_all!
      Process::InheritDoc.new(relations).process_all!
      Process::Versions.new(relations, opts).process_all!
      Process::ReturnValues.new(relations).process_all!
      Process::Fires.new(relations).process_all!
      Process::Components.new(relations).process_all!
      Process::Lint.new(relations).process_all!
      Process::NoDoc.new(relations).process_all!
      relations
    end
560106
def from_merge_origin(cls, tc):
        """"""
        other_tc = tc.tbl.tc(
            tc.row_idx + tc.rowSpan - 1,  # ---other_row_idx
            tc.col_idx + tc.gridSpan - 1  # ---other_col_idx
        )
        return cls(tc, other_tc)
679933
def _get_connected_subgraphs(vertices, vertices_neighbours):
    
    remaining_vertices = set(vertices)
    subgraphs = []
    while remaining_vertices:
        subgraph = set(_dfs(remaining_vertices.pop(), vertices_neighbours))
        remaining_vertices.difference_update(subgraph)
        subgraphs.append(subgraph)

    return subgraphs
908970
private void createMissingSpanningRelations(SDocumentGraph graph,
    FastInverseMap<Long, SNode> nodeByRankID,
    TreeMap<Long, SToken> tokenByIndex,
    Map<String, ComponentEntry> componentForSpan,
    AtomicInteger numberOfRelations)
  {

    // add the missing spanning relations for each continuous span of the graph
    for (SSpan span : graph.getSpans())
    {
      long pre=1;
      RelannisNodeFeature featSpan = RelannisNodeFeature.extract(span);      
      ComponentEntry spanComponent = componentForSpan.get(span.getId());
      if (spanComponent != null && featSpan != null 
        && featSpan.getLeftToken() >= 0 && featSpan.getRightToken() >= 0)
      {
        for (long i = featSpan.getLeftToken(); i <= featSpan.getRightToken();
          i++)
        {
          SToken tok = tokenByIndex.get(i);
          if (tok != null)
          {
            boolean missing = true;
            List<SRelation<SNode, SNode>> existingRelations = graph.getRelations(span.getId(),
              tok.getId());
            if (existingRelations != null)
            {
              for (Relation e : existingRelations)
              {
                if (e instanceof SSpanningRelation)
                {
                  missing = false;
                  break;
                }
              }
            } // end if relations exist

            if (missing)
            {
              String type = "c";

              SLayer layer
                = findOrAddSLayer(spanComponent.getNamespace(), graph);

              createNewRelation(graph, span, tok, null, type,
                spanComponent.getId(), layer,
                pre++, nodeByRankID, numberOfRelations);
            }
          } // end if token exists
        } // end for each covered token index
      }
    } // end for each span
  }
1056825
def unpack_flags(value, flags):
    """"""
    try:
        return [flags[value]]
    except KeyError:
        return [flags[k] for k in sorted(flags.keys()) if k & value > 0]
842921
def reshape(attrs, inputs, proto_obj):
    """"""
    if len(inputs) == 1:
        return 'reshape', attrs, inputs[0]
    reshape_shape = list(proto_obj._params[inputs[1].name].asnumpy())
    reshape_shape = [int(i) for i in reshape_shape]
    new_attrs = {'shape': reshape_shape}
    return 'reshape', new_attrs, inputs[:1]
36009
function normalizeConnectArgs (args) {
  var options = {}

  if (args[0] !== null && typeof args[0] === 'object') {
    // connect(options, [cb])
    options = args[0]
  } else if (isPipeName(args[0])) {
    // connect(path, [cb])
    throw new Error('Pipes are not supported in Chrome Apps.')
  } else {
    // connect(port, [host], [cb])
    options.port = args[0]
    if (typeof args[1] === 'string') {
      options.host = args[1]
    }
  }

  var cb = args[args.length - 1]
  return typeof cb === 'function' ? [options, cb] : [options]
}
18676
private void process(Node root, boolean hotSwap) {
    checkState(contextStack.isEmpty());
    contextStack.push(LexicalContext.newGlobalContext(root));
    if (hotSwap) {
      TranspilationPasses.hotSwapTranspile(compiler, root, transpiledFeatures, this);
    } else {
      TranspilationPasses.processTranspile(compiler, root, transpiledFeatures, this);
    }
    TranspilationPasses.maybeMarkFeaturesAsTranspiledAway(compiler, transpiledFeatures);
    checkState(contextStack.element().function == null);
    contextStack.remove();
    checkState(contextStack.isEmpty());
  }
433260
def inputConnections(self, cls=None):
        
        scene = self.scene()
        if not scene:
            return []
        
        if not cls:
            cls = XNodeConnection
        
        output = []
        for item in scene.items():
            if not isinstance(item, cls):
                continue
            
            if item.inputNode() == self:
                output.append(item)
        
        return output
1277897
void merge(Settings other) {
    for (int i = 0; i < COUNT; i++) {
      if (!other.isSet(i)) continue;
      set(i, other.flags(i), other.get(i));
    }
  }
645341
def tcp_reassembly(frame):
    """"""
    if 'TCP' in frame:
        ip = (frame['IPv4'] if 'IPv4' in frame else frame['IPv6']).info
        tcp = frame['TCP'].info
        data = dict(
            bufid=(
                ip.src,                                     # source IP address
                ip.dst,                                     # destination IP address
                tcp.srcport,                                # source port
                tcp.dstport,                                # destination port
            ),
            num=frame.info.number,                          # original packet range number
            ack=tcp.ack,                                    # acknowledgement
            dsn=tcp.seq,                                    # data sequence number
            syn=tcp.flags.syn,                              # synchronise flag
            fin=tcp.flags.fin,                              # finish flag
            rst=tcp.flags.rst,                              # reset connection flag
            payload=bytearray(tcp.packet.payload or b''),   # raw bytearray type payload
        )
        raw_len = len(data['payload'])                      # payload length, header excludes
        data['first'] = tcp.seq                             # this sequence number
        data['last'] = tcp.seq + raw_len                    # next (wanted) sequence number
        data['len'] = raw_len                               # payload length, header excludes
        return True, data
    return False, None
320569
def connected_components(self) -> (dict, dict):
        """"""
        inclusions = utils.completed_graph(self.inclusions)  # allow bottom-up movement
        edges = utils.completed_graph(self.edges) if self.oriented else self.edges
        cc = {}  # maps cc root with nodes in the cc
        subroots = defaultdict(set)  # maps cc root with other roots of the cc
        walked_roots = set()  # all roots that have been walked already
        for root in self.roots:
            if root in walked_roots: continue  # this cc have been done already
            # walk in the graph starting at root
            cc[root] = set([root])
            walked = cc[root]
            stack = list(edges.get(root, ())) + list(inclusions.get(root, ()))
            while len(stack) > 0:
                *stack, curr = stack
                walked.add(curr)
                if curr in self.roots:  # don't do the walk for already found roots
                    walked_roots.add(curr)
                    subroots[root].add(curr)
                for succ in it.chain(edges.get(curr, ()), inclusions.get(curr, ())):
                    if succ not in walked:
                        stack.append(succ)
        return cc, dict(subroots)
1345993
function normalizeConnectArgs(args)
{
	if( typeof args[0]==='object' && args[0]!==null )
		return args[0]
	else if( typeof args[0]==='string' && !(Number(args[0]) >= 0) )
		return {path: args[0]}
	var options= {port: args[0]}
	if( typeof args[1]==='string' )
		options.host= args[1]
	return options
}
350844
function tryRepairConnectionStart(moved, other, newDocking, points) {
  return _tryRepairConnectionSide(moved, other, newDocking, points);
}