Copies this object (shallow or deep).

        :param deep: boolean indicating whether to do a deep copy (or a
                     shallow copy).
507054
def copy(self, deep=False):
        
        cause = self._cause
        if cause is not None:
            cause = cause.copy(deep=deep)
        exc_info = utils.copy_exc_info(self.exc_info, deep=deep)
        exc_args = self.exception_args
        exc_kwargs = self.exception_kwargs
        if deep:
            exc_args = copy.deepcopy(exc_args)
            exc_kwargs = copy.deepcopy(exc_kwargs)
        else:
            exc_args = tuple(exc_args)
            exc_kwargs = exc_kwargs.copy()
        # These are just simple int/strings, so deep copy doesn't really
        # matter/apply here (as they are immutable anyway).
        exc_type_names = tuple(self._exc_type_names)
        generated_on = self._generated_on
        if generated_on:
            generated_on = tuple(generated_on)
        # NOTE(harlowja): use `self.__class__` here so that we can work
        # with subclasses (assuming anyone makes one).
        return self.__class__(exc_info=exc_info,
                              exception_str=self.exception_str,
                              traceback_str=self.traceback_str,
                              exc_args=exc_args,
                              exc_kwargs=exc_kwargs,
                              exc_type_names=exc_type_names,
                              cause=cause, generated_on=generated_on)
1326930
def copy(self, **kwargs):
        
        for k in kwargs:
            assert k in self._keys, 'Invalid key: %s' % k

        d = self.values()
        d.update(kwargs)
        return self.__class__(**d)
862146
def deep_copy(self):
        
        return ContinuousColumn(self.arr, metadata=self.metadata, missing_id=self._missing_id, weights=self.weights)
227601
public static JSONArray copy(final JSONArray src, final boolean deep) {
        final JSONArray dest = new JSONArray();
        final int len = src.length();
        for (int i = 0; i < len; ++i) {
            final Object value = src.opt(i);
            if (deep) {
                if (value instanceof JSONObject) {
                    dest.put(copy((JSONObject) value));
                } else if (value instanceof JSONArray) {
                    dest.put(copy((JSONArray) value));
                } else {
                    dest.put(value);
                }
            } else {
                dest.put(value);
            }
        }
        return dest;
    }
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;

}
1202352
def _shallow_copy(self, obj=None, obj_type=None, **kwargs):
        
        if obj is None:
            obj = self._selected_obj.copy()
        if obj_type is None:
            obj_type = self._constructor
        if isinstance(obj, obj_type):
            obj = obj.obj
        for attr in self._attributes:
            if attr not in kwargs:
                kwargs[attr] = getattr(self, attr)
        return obj_type(obj, **kwargs)
139339
def copy(self, key=None):
        
        other = self.__class__(
            redis=self.redis, key=key, writeback=self.writeback
        )
        other.extend(self)

        return other
1315808
def copy(self, selection, smart_selection_adaption=True):
        
        assert isinstance(selection, Selection)
        self.__create_core_and_model_object_copies(selection, smart_selection_adaption)
1326794
def copy
    copy = self.clone #Currently, we overwrite everything anyway, but we may add some clonable attributes later.
    #Make a deep copy of all actions.
    copy.instance_eval {@actions = []}
    self.actions.each {|action| copy.add_action(action.copy)}
    #Make a deep copy of all conditions.
    copy.instance_eval {@conditions = []}
    self.conditions.each {|condition| copy.add_condition(condition.copy)}
    copy
  end
1358597
def copy(self, name=None):
        
        return Struct.copy(self, deep=True, name=name)
156939
def deep_merge(source, dest):
    
    for key, value in source.items():
        if key in dest:
            if isinstance(value, dict) and isinstance(dest[key], dict):
                deep_merge(value, dest[key])
                continue
            elif isinstance(value, list) and isinstance(dest[key], list):
                for item in value:
                    if item not in dest[key]:
                        dest[key].append(item)
                continue
        dest[key] = value
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;
	}
1059398
def deepish_copy(org):
    
    out = dict().fromkeys(org)
    for k, v in org.items():
        if isinstance(v, dict):
            out[k] = deepish_copy(v)
        else:
            try:
                out[k] = v.copy()   # dicts, sets
            except AttributeError:
                try:
                    out[k] = v[:]   # lists, tuples, strings, unicode
                except TypeError:
                    out[k] = v      # ints
    return out
359371
def copy(self):
        
        copied = TransformForest()
        copied.base_frame = copy.deepcopy(self.base_frame)
        copied.transforms = copy.deepcopy(self.transforms)

        return copied
1269703
def _DeepCopy(self, obj):
    
    precondition.AssertType(obj, rdfvalue.RDFValue)

    return obj.__class__.FromSerializedString(obj.SerializeToString())
822272
function copy() {
  var result = {}
    , depth = 2
    , seen = [];

  (function worker() {
    each(array(arguments), function each(obj) {
      for (var prop in obj) {
        if (hasOwn.call(obj, prop) && !~index(seen, obj[prop])) {
          if (type(obj[prop]) !== 'object' || !depth) {
            result[prop] = obj[prop];
            seen.push(obj[prop]);
          } else {
            depth--;
            worker(result[prop], obj[prop]);
          }
        }
      }
    });
  }).apply(null, arguments);

  return result;
}
793024
def copy(self, only=None):
        '''
        
        '''
        if only is None:
            return Mesh(self)
        else:
            import copy
            m = Mesh()
            for a in only:
                setattr(m, a, copy.deepcopy(getattr(self, a)))
            return m