Performs deep clone of given model.
12582
protected M deepClone(Key<M> result) {
    M newModel = IcedUtils.deepCopy(self());
    newModel._key = result;
    // Do not clone model metrics
    newModel._output.clearModelMetrics();
    newModel._output._training_metrics = null;
    newModel._output._validation_metrics = null;
    // Clone trees
    Key[][] treeKeys = newModel._output._treeKeys;
    for (int i = 0; i < treeKeys.length; i++) {
      for (int j = 0; j < treeKeys[i].length; j++) {
        if (treeKeys[i][j] == null) continue;
        CompressedTree ct = DKV.get(treeKeys[i][j]).get();
        CompressedTree newCt = IcedUtils.deepCopy(ct);
        newCt._key = CompressedTree.makeTreeKey(i, j);
        DKV.put(treeKeys[i][j] = newCt._key,newCt);
      }
    }
    // Clone Aux info
    Key[][] treeKeysAux = newModel._output._treeKeysAux;
    if (treeKeysAux!=null) {
      for (int i = 0; i < treeKeysAux.length; i++) {
        for (int j = 0; j < treeKeysAux[i].length; j++) {
          if (treeKeysAux[i][j] == null) continue;
          CompressedTree ct = DKV.get(treeKeysAux[i][j]).get();
          CompressedTree newCt = IcedUtils.deepCopy(ct);
          newCt._key = Key.make(createAuxKey(treeKeys[i][j].toString()));
          DKV.put(treeKeysAux[i][j] = newCt._key,newCt);
        }
      }
    }
    return newModel;
  }
917546
def clone_object(old_object)
      object = build_from(old_object)
      assign_attributes_for(object, get_model_attributes_from(old_object))

      object
    end
320661
function cloner(deep, item) {
  if (!item ||
      typeof item !== 'object' ||
      item instanceof Error ||
      item instanceof MonkeyDefinition ||
      item instanceof Monkey ||
      ('ArrayBuffer' in global && item instanceof ArrayBuffer))
    return item;

  // Array
  if (type.array(item)) {
    if (deep) {
      const a = new Array(item.length);

      for (let i = 0, l = item.length; i < l; i++)
        a[i] = cloner(true, item[i]);
      return a;
    }

    return slice(item);
  }

  // Date
  if (item instanceof Date)
    return new Date(item.getTime());

  // RegExp
  if (item instanceof RegExp)
    return cloneRegexp(item);

  // Object
  if (type.object(item)) {
    const o = {};

    // NOTE: could be possible to erase computed properties through `null`.
    const props = Object.getOwnPropertyNames(item);
    for (let i = 0, l = props.length; i < l; i++) {
      const name = props[i];
      const k = Object.getOwnPropertyDescriptor(item, name);
      if (k.enumerable === true) {
        if (k.get && k.get.isLazyGetter) {
          Object.defineProperty(o, name, {
            get: k.get,
            enumerable: true,
            configurable: true
          });
        }
        else {
          o[name] = deep ? cloner(true, item[name]) : item[name];
        }
      }
      else if (k.enumerable === false) {
        Object.defineProperty(o, name, {
          value: deep ? cloner(true, k.value) : k.value,
          enumerable: false,
          writable: true,
          configurable: true
        });
      }
    }
    return o;
  }

  return item;
}
516933
def cloneNode(self, deep: bool=False) -> AbstractNode:
        
        if deep:
            return self._clone_node_deep()
        return self._clone_node()
817187
def clone_data( self, source ):
        
        klass = self.__class__
        assert isinstance( source, klass )

        for name in klass._fields:
            self._field_data[name] = getattr( source, name )
518948
def clone(self, klass=None, memo=None, **kwargs):
        
        obj = Empty()
        obj.__class__ = klass or self.__class__

        obj.resource = self.resource

        obj.filters = self.filters.copy()
        obj.order_by = self.order_by

        obj.low_mark = self.low_mark
        obj.high_mark = self.high_mark

        obj.__dict__.update(kwargs)

        return obj
256011
function() {
        var self = this;
        var clone = new Model();
        
        Object.keys(self).forEach(function(key) {
            clone[key] = self[key];
        });
        
        Array.prototype.slice.call(arguments).forEach(function(tuple) {
            clone[tuple[0]] = tuple[1];
        });
        
        return clone;
    }
514812
def clone(cls, srcpath, destpath):
        """"""
        try:
            os.makedirs(destpath)
        except OSError as e:
            if not e.errno == errno.EEXIST:
                raise
        cmd = [SVNADMIN, 'dump', '--quiet', '.']
        dump = subprocess.Popen(
               cmd, cwd=srcpath, stdout=subprocess.PIPE,
               stderr=subprocess.PIPE,
        )
        repo = cls.create(destpath)
        repo.load(dump.stdout)
        stderr = dump.stderr.read()
        dump.stdout.close()
        dump.stderr.close()
        dump.wait()
        if dump.returncode != 0:
            raise subprocess.CalledProcessError(dump.returncode, cmd, stderr)
        return repo
72130
def clone(self, config, **kwargs):
        """"""
        gta = GTAnalysis(config, **kwargs)
        gta._roi = copy.deepcopy(self.roi)
        return gta
193443
function clone(object, deep) {
		if (!object) { return object; }
		var clone = object.prototype
						? Object.create(object.prototype.constructor) : {};

		for(var key in object) {
			if (!object.hasOwnProperty(key)) { continue; }
			clone[key] = deep ? clone(object[key], deep) : object[key];
		}
		return clone;
	}
338635
function(models, out)
  {
    var target = out || this.cloneEmpty();

    for (var i = 0; i < this.length; i++)
    {
      var a = this[ i ];
      var key = a.$key();
      var exists = false;

      if ( models instanceof ModelCollection )
      {
        exists = models.has( key );
      }
      else
      {
        for (var k = 0; k < models.length && !exists; k++)
        {
          var modelKey = this.buildKeyFromInput( models[ k ] );

          exists = (key === modelKey);
        }
      }

      if (!exists)
      {
        target.push( a );
      }
    }

    return target;
  }
1012977
def clone(orig, n):
    
    if n == 0:
        return layerize(noop())
    layers = [orig]
    for i in range(n - 1):
        layers.append(copy.deepcopy(orig))
        layers[-1].set_id()
    return FeedForward(layers)
1361977
function deepClone(inputDict){

    if (!inputDict)
        return null;

    const clonedDict = {};

    for (let key in inputDict){

        if (typeof(inputDict[key]) == 'object'){

            clonedDict[key] = deepClone(inputDict[key]);
        
        }
        else{

            clonedDict[key] = inputDict[key];

        }

    }

    return clonedDict;

}
473336
private static int[][] deepClone(int[][] array) {
        int[][] result = new int[array.length][];
        for (int i = 0; i < result.length; i++) {
            result[i] = array[i].clone();
        }
        return result;
    }
353773
def clone(self):
        """"""
        # XXX copy lookupname/callcontext ?
        clone = InferenceContext(self.path, inferred=self.inferred)
        clone.callcontext = self.callcontext
        clone.boundnode = self.boundnode
        clone.extra_context = self.extra_context
        return clone
1066817
def _clone(self, **attrs):
        

        with xact():
            # Gather objs we'll need save after
            old_m2ms = self._gather_m2ms()
            old_reverses = self._gather_reverses()

            for k, v in attrs.items():
                setattr(self, k, v)

            # Do the clone
            self.prep_for_clone()
            self.validate_unique()
            # Prevent last save from changing
            self.save(last_save=self.last_save)

            # save m2ms
            self._set_m2ms(old_m2ms)
            # Prevent last save from changing
            self.save(last_save=self.last_save)

            # save reverses
            self._clone_reverses(old_reverses)
508014
def clone(self, fp):
        """"""
        return self.__class__(fp,
                              self._mangle_from_,
                              None, # Use policy setting, which we've adjusted
                              policy=self.policy)