Returns a toytree copy with all nodes multiplied by a constant 
        sampled uniformly between (multiplier, 1/multiplier).
505142
def node_multiplier(self, multiplier=0.5, seed=None):
        
        random.seed(seed)
        ctree = self._ttree.copy()
        low, high = sorted([multiplier, 1. / multiplier])
        mult = random.uniform(low, high)
        for node in ctree.treenode.traverse():
            node.dist = node.dist * mult
        ctree._coords.update()
        return ctree
419800
def copy(self):
        """"""
        other = Version(None)
        other.tokens = self.tokens[:]
        other.seps = self.seps[:]
        return other
264026
function collectExponents(node) {
  const polynomialTermList = node.args.map(n => new Node.PolynomialTerm(n));

  // If we're multiplying polynomial nodes together, they all share the same
  // symbol. Get that from the first node.
  const symbolNode = polynomialTermList[0].getSymbolNode();

  // The new exponent will be a sum of exponents (an operation, wrapped in
  // parens) e.g. x^(3+4+5)
  const exponentNodeList = polynomialTermList.map(p => p.getExponentNode(true));
  const newExponent = Node.Creator.parenthesis(
    Node.Creator.operator('+', exponentNodeList));
  const newNode = Node.Creator.polynomialTerm(symbolNode, newExponent, null);
  return Node.Status.nodeChanged(
    ChangeTypes.COLLECT_EXPONENTS, node, newNode);
}
445569
def node_to_evenly_discretized(node):
    
    if not all([node.attrib["minMag"], node.attrib["binWidth"],
                node.nodes[0].text]):
        return None
    # Text to float
    rates = [float(x) for x in node.nodes[0].text.split()]
    return mfd.evenly_discretized.EvenlyDiscretizedMFD(
        float(node.attrib["minMag"]),
        float(node.attrib["binWidth"]),
        rates)
864864
function factorMultiplicands(node) {
  const newNode = clone(node);
  const radicandNode = getRadicandNode(node);

  let children = [];
  let factored = false;
  radicandNode.args.forEach(child => {
    if (Node.PolynomialTerm.isPolynomialTerm(child)) {
      const polyTerm = new Node.PolynomialTerm(child);
      const coeffNode = polyTerm.getCoeffNode();
      const polyTermNoCoeff = Node.Creator.polynomialTerm(
        polyTerm.getSymbolNode(), polyTerm.getExponentNode(), null);
      if (coeffNode) {
        const factorNodes = getFactorNodes(coeffNode);
        if (factorNodes.length > 1) {
          factored = true;
        }
        children = children.concat(factorNodes);
      }
      children.push(polyTermNoCoeff);
    }
    else {
      const factorNodes = getFactorNodes(child);
      if (factorNodes.length > 1) {
        factored = true;
      }
      children = children.concat(factorNodes);
    }
  });

  if (factored) {
    newNode.args[0] = Node.Creator.operator('*', children);
    return Node.Status.nodeChanged(
      ChangeTypes.FACTOR_INTO_PRIMES, node, newNode);
  }

  return Node.Status.noChange(node);
}
1006840
@Override
	@SuppressWarnings("unchecked")
	public Tuple4<T0, T1, T2, T3> copy() {
		return new Tuple4<>(this.f0,
			this.f1,
			this.f2,
			this.f3);
	}
922000
@Override
	@SuppressWarnings("unchecked")
	public Tuple5<T0, T1, T2, T3, T4> copy() {
		return new Tuple5<>(this.f0,
			this.f1,
			this.f2,
			this.f3,
			this.f4);
	}
42458
function copy() {
  const nodes = [];
  const cnodes = [];
  const mapping = {};
  this.each((node) => {
    nodes.push(node);
    const cnode = new Node(node.id, node.data);
    cnodes.push(cnode);
    mapping[cnode.id] = cnode;
  });

  cnodes.forEach((cnode, i) => {
    const node = nodes[i];
    cnode.children = node.children.map((c) => mapping[c.id]);
  });

  if (this.id === undefined) {
    const root = new Node(undefined, undefined);
    root.children = this.children.map((c) => mapping[c.id]);
  } else {
    return mapping[this.id];
  }
}
947893
Node cloneProps(Node n) {
    if (!n.hasProps()) {
      n.clonePropsFrom(templateNode);
    }
    for (Node child : n.children()) {
      cloneProps(child);
    }
    return n;
  }
378643
def ptake(n: int, xs: Iterable[T]) -> Iterable[T]:
    
    return tqdm(take(n, xs), total=n)
1127309
static <K, V> Node<K, V>[] doubleCapacity(Node<K, V>[] oldTable) {
    // TODO: don't do anything if we're already at MAX_CAPACITY
    int oldCapacity = oldTable.length;
    @SuppressWarnings("unchecked") // Arrays and generics don't get along.
    Node<K, V>[] newTable = new Node[oldCapacity * 2];
    AvlIterator<K, V> iterator = new AvlIterator<K, V>();
    AvlBuilder<K, V> leftBuilder = new AvlBuilder<K, V>();
    AvlBuilder<K, V> rightBuilder = new AvlBuilder<K, V>();

    // Split each tree into two trees.
    for (int i = 0; i < oldCapacity; i++) {
      Node<K, V> root = oldTable[i];
      if (root == null) {
        continue;
      }

      // Compute the sizes of the left and right trees.
      iterator.reset(root);
      int leftSize = 0;
      int rightSize = 0;
      for (Node<K, V> node; (node = iterator.next()) != null; ) {
        if ((node.hash & oldCapacity) == 0) {
          leftSize++;
        } else {
          rightSize++;
        }
      }

      // Split the tree into two.
      leftBuilder.reset(leftSize);
      rightBuilder.reset(rightSize);
      iterator.reset(root);
      for (Node<K, V> node; (node = iterator.next()) != null; ) {
        if ((node.hash & oldCapacity) == 0) {
          leftBuilder.add(node);
        } else {
          rightBuilder.add(node);
        }
      }

      // Populate the enlarged array with these new roots.
      newTable[i] = leftSize > 0 ? leftBuilder.root() : null;
      newTable[i + oldCapacity] = rightSize > 0 ? rightBuilder.root() : null;
    }
    return newTable;
  }
792741
def copy(self):
        """"""
        new_vec = Vector2()
        new_vec.X = self.X
        new_vec.Y = self.Y
        return new_vec
845869
def bsp_split_recursive(
    node: tcod.bsp.BSP,
    randomizer: Optional[tcod.random.Random],
    nb: int,
    minHSize: int,
    minVSize: int,
    maxHRatio: int,
    maxVRatio: int,
) -> None:
    
    node.split_recursive(
        nb, minHSize, minVSize, maxHRatio, maxVRatio, randomizer
    )
1241886
def clone(self, ignore=()):
        
        nodes = [
            clone(node, self.substitutions, ignore)
            for node in toposorted(self.nodes, self.edges)
        ]
        return DAG(nodes=nodes, substitutions=self.substitutions).build_edges()
158215
@SuppressWarnings("unchecked") //
  public static <E> ImmutableMultiset<E> of(E e1, E e2) {
    return copyOfInternal(e1, e2);
  }
261986
function convertMultiplicationToExponent(node) {
  const newNode = clone(node);

  const radicandNode = getRadicandNode(node);

  if (Node.Type.isParenthesis(radicandNode)) {
    const child = radicandNode.content;
    if (isMultiplicationOfEqualNodes(child)) {
      const baseNode = child.args[0];
      const exponentNode = Node.Creator.constant(child.args.length);
      newNode.args[0] = Node.Creator.operator('^', [baseNode, exponentNode]);
      return Node.Status.nodeChanged(
        ChangeTypes.CONVERT_MULTIPLICATION_TO_EXPONENT, node, newNode);
    }
  }
  else if (Node.Type.isOperator(radicandNode, '*')) {
    const children = [];
    radicandNode.args.forEach(child => {
      if (Node.Type.isParenthesis(child)) {
        const grandChild = child.content;
        if (isMultiplicationOfEqualNodes(grandChild)) {
          const baseNode = grandChild.args[0];
          const exponentNode = Node.Creator.constant(grandChild.args.length);
          children.push(Node.Creator.operator('^', [baseNode, exponentNode]));
          return;
        }
      }
      children.push(child);
    });

    newNode.args[0] = Node.Creator.operator('*', children);
    return Node.Status.nodeChanged(
      ChangeTypes.CONVERT_MULTIPLICATION_TO_EXPONENT, node, newNode);
  }

  return Node.Status.noChange(node);
}
738625
function(tree, n, m) {
    return tree[n].fc < tree[m].fc ||
      (tree[n].fc == tree[m].fc && zip_depth[n] <= zip_depth[m]);
}