Define recursive ascent.
170082
function rec_up(nid){

	//print('rec_up on: ' + nid);

    	var results = new Array();
    	var new_parent_edges = anchor.get_parent_edges(nid, pid);

	// Capture edge list for later adding.
	for( var e = 0; e < new_parent_edges.length; e++ ){
	    seen_edge_list.push(new_parent_edges[e]);
	}

	// Pull extant nodes from edges. NOTE: This is a retread
	// of what happens in get_parent_nodes to avoid another
	// call to get_parent_edges (as all this is now
	// implemented).
	var new_parents = new Array();
	for( var n = 0; n < new_parent_edges.length; n++ ){
	    // Make sure that any found edges are in our
	    // world.
	    var obj_id = new_parent_edges[n].object_id();
	    var temp_node = anchor.get_node(obj_id);
	    if( temp_node ){
		new_parents.push( temp_node );
	    }
	}

	// Make sure we're in there too.
	var tmp_node = anchor.get_node(nid);
	if( tmp_node ){
	    new_parents.push( tmp_node );
	}

	// Recur on unseen things and mark the current as seen.
    	if( new_parents.length != 0 ){
    	    for( var i = 0; i < new_parents.length; i++ ){
    		// Only do things we haven't ever seen before.
    		var new_anc = new_parents[i];
    		var new_anc_id = new_anc.id();
    		if( ! seen_node_hash[ new_anc_id ] ){
    		    seen_node_hash[ new_anc_id ] = new_anc;
    		    rec_up(new_anc_id);	
    		}
    	    }
    	}
    	return results;
    }
475261
def translate(line, ascent, offs=0):
    
    # TODO: why do I have thuis factor here?
    ascent *= -2
    offs *= -2

    l0 = length(line)

    # change relative to line:
    t0 = offs  # -h+offs
    t1 = l0 * ascent + offs
    return translate2P(line, t0, t1)
1123448
def descend(self, remote, force=False):
        
        remote_dirs = remote.split('/')
        for directory in remote_dirs:
            try:
                self.conn.cwd(directory)
            except Exception:
                if force:
                    self.conn.mkd(directory)
                    self.conn.cwd(directory)
        return self.conn.pwd()
1218432
def chown(self, path, user, group, recursive=False):
        
        args = {
            'path': path,
            'user': user,
            'group': group,
            'recursive': recursive,
        }

        return self._client.json('filesystem.chown', args)
911669
public void takeNoteOfGradient(IntDoubleVector gradient) {
        gradient.iterate(new FnIntDoubleToVoid() {            
            @Override
            public void call(int index, double value) {
                gradSumSquares[index] += value * value;
                assert !Double.isNaN(gradSumSquares[index]);
            }
        });
    }
60319
def _recursive_bezier(self, x1, y1, x2, y2, x3, y3, attr, row, level=0):
        ''
        m_approximation_scale = 10.0
        m_distance_tolerance = (0.5 / m_approximation_scale) ** 2
        m_angle_tolerance = 1 * 2*math.pi/360  # 15 degrees in rads
        curve_angle_tolerance_epsilon = 0.01
        curve_recursion_limit = 32
        curve_collinearity_epsilon = 1e-30

        if level > curve_recursion_limit:
            return

        # Calculate all the mid-points of the line segments

        x12   = (x1 + x2) / 2
        y12   = (y1 + y2) / 2
        x23   = (x2 + x3) / 2
        y23   = (y2 + y3) / 2
        x123  = (x12 + x23) / 2
        y123  = (y12 + y23) / 2

        dx = x3-x1
        dy = y3-y1
        d = abs(((x2 - x3) * dy - (y2 - y3) * dx))

        if d > curve_collinearity_epsilon:
            # Regular care
            if d*d <= m_distance_tolerance * (dx*dx + dy*dy):
                # If the curvature doesn't exceed the distance_tolerance value, we tend to finish subdivisions.
                if m_angle_tolerance < curve_angle_tolerance_epsilon:
                    self.point(x123, y123, attr, row)
                    return

                # Angle & Cusp Condition
                da = abs(math.atan2(y3 - y2, x3 - x2) - math.atan2(y2 - y1, x2 - x1))
                if da >= math.pi:
                    da = 2*math.pi - da

                if da < m_angle_tolerance:
                    # Finally we can stop the recursion
                    self.point(x123, y123, attr, row)
                    return
        else:
            # Collinear case
            dx = x123 - (x1 + x3) / 2
            dy = y123 - (y1 + y3) / 2
            if dx*dx + dy*dy <= m_distance_tolerance:
                self.point(x123, y123, attr, row)
                return

        # Continue subdivision
        self._recursive_bezier(x1, y1, x12, y12, x123, y123, attr, row, level + 1)
        self._recursive_bezier(x123, y123, x23, y23, x3, y3, attr, row, level + 1)
957685
def k_depth(d, depth, _counter=1):
        
        if depth == 0:
            yield d[_meta]["_rootname"]
        else:
            if _counter == depth:
                for key in DictTree.k(d):
                    yield key
            else:
                _counter += 1
                for node in DictTree.v(d):
                    for key in DictTree.k_depth(node, depth, _counter):
                        yield key
135204
def traverse(self, predicate=lambda i, d: True,
                 prune=lambda i, d: False, depth=-1, branch_first=True,
                 visit_once=False, ignore_self=1):
        """"""
        return super(Tree, self).traverse(predicate, prune, depth, branch_first, visit_once, ignore_self)
88856
def traverse
      # We use a non-recursive implementation to traverse the tree. This stack
      # keeps track of all the known still to be checked nodes.
      stack = [ [ self, 0 ] ]

      while !stack.empty?
        node, position = stack.pop

        # Call the payload method. The position marks where we are in the node
        # with respect to the traversal. 0 means we've just entered the node
        # for the first time and are about to descent to the first child.
        # Position 1 is after the 1st child has been processed and before the
        # 2nd child is being processed. If we have N children, the last
        # position is N after we have processed the last child and are about
        # to return to the parent node.
        yield(node, position, stack)

        if position <= @tree.order
          # Push the next position for this node onto the stack.
          stack.push([ node, position + 1 ])

          if !node.is_leaf && node.children[position]
            # If we have a child node for this position, push the linked node
            # and the starting position onto the stack.
            stack.push([ node.children[position], 0 ])
          end
        end
      end
    end
874668
def _recursive_update(d1, d2):
    

    for k in set(d1).intersection(d2):
        if isinstance(d1[k], dict) and isinstance(d2[k], dict):
            d1[k] = _recursive_update(d1[k], d2[k])
        else:
            d1[k] = d2[k]

    for k in set(d2).difference(d1):
        d1[k] = d2[k]

    return d1
853501
def walk_up_tree(root):
    """"""
    for child in root.children:
        for el in walk_up_tree(child):
            yield el

    yield root
428952
private GeometryIndex recursiveCreate(GeometryIndex index, int lastValue, GeometryIndexType lastType) {
		if (index.hasChild()) {
			return new GeometryIndex(index.getType(), index.getValue(), recursiveCreate(index.getChild(), lastValue,
					lastType));
		} else {
			GeometryIndexType type = lastType == null ? index.getType() : lastType;
			return new GeometryIndex(type, lastValue, null);
		}
	}
1161494
private void climb(long key, @Nullable QueueType queue, boolean isFull) {
    if (queue == null) {
      climber.onMiss(key, isFull);
    } else {
      climber.onHit(key, queue, isFull);
    }

    double probationSize = maximumSize - windowSize - protectedSize;
    Adaptation adaptation = climber.adapt(windowSize, probationSize, protectedSize, isFull);
    if (adaptation.type == INCREASE_WINDOW) {
      increaseWindow(adaptation.amount);
    } else if (adaptation.type == DECREASE_WINDOW) {
      decreaseWindow(adaptation.amount);
    }
  }
1305747
def recurse(self):
        
        json = self._json(self._get(self._api, params={'recursive': '1'}),
                          200)
        return Tree(json, self._session) if json else None
907476
function recursiveMkDir(dir) {
    if (!fs.existsSync(dir)) {
        recursiveMkDir(path.dirname(dir));
        fs.mkdirSync(dir);
    }
}
628599
def recursive_repr(func):
    """"""
    repr_running = set()

    @wraps(func)
    def wrapper(self):
        "Return ellipsis on recursive re-entry to function."
        key = id(self), get_ident()

        if key in repr_running:
            return '...'

        repr_running.add(key)

        try:
            return func(self)
        finally:
            repr_running.discard(key)

    return wrapper
425759
def mkdir_recursive(dirname):
    """"""
    parent = os.path.dirname(dirname)
    if parent != "":
        if not os.path.exists(parent):
            mkdir_recursive(parent)
        if not os.path.exists(dirname):
            os.mkdir(dirname)
    elif not os.path.exists(dirname):
        os.mkdir(dirname)