our implementation of get_object allows for cloning when updating an
        object, not cloning when the button 'save but not clone' is pushed
        and at no other time will clone be called
515724
def get_object(self, request, object_id, from_field=None):
        
        # from_field breaks in 1.7.8
        obj = super(VersionedAdmin, self).get_object(request,
                                                     object_id)
        # Only clone if update view as get_object() is also called for change,
        # delete, and history views
        if request.method == 'POST' and \
                obj and \
                obj.is_latest and \
                'will_not_clone' not in request.path and \
                'delete' not in request.path and \
                'restore' not in request.path:
            obj = obj.clone()

        return obj
471390
def initialize_copy( original_obj )
      @base_point = original_obj.base_point.dup
      @u_vector = original_obj.u_vector.dup
      @v_vector = original_obj.v_vector.dup
    end
39171
def clone(self):
        

        p = type(self)(self.id)
        p.hooks = list(self.hooks)
        p.instance = self.instance
        return p
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;

}
1134906
def save_object(self, obj):
        
        self.session.add(obj)
        self.session.flush()
        return obj
1069369
function clone(object, extend) {

  var cloned = {};

  for (var key in object) {
    cloned[key] = object[key];
  }

  for (var key in extend) {
    cloned[key] = extend[key];
  }

  return cloned;
}
359431
def clone(self, callable=None, **overrides):
        
        old = {k: v for k, v in self.get_param_values()
               if k not in ['callable', 'name']}
        params = dict(old, **overrides)
        callable = self.callable if callable is None else callable
        return self.__class__(callable, **params)
732934
public static void copy(Object object, Field field, Object clone, Field cloneField, boolean ignoreNonExisting)
	{
		invokeSetter(clone, cloneField, invokeGetter(object, field), ignoreNonExisting);
	}
1246555
def update(self, obj, set_fields = None, unset_fields = None, update_obj = True):
        
        if set_fields:
            if isinstance(set_fields,(list,tuple)):
                set_attributes = {}
                for key in set_fields:
                    try:
                        set_attributes[key] = get_value(obj,key)
                    except KeyError:
                        pass
            else:
                set_attributes = set_fields
        else:
            set_attributes = {}
        if unset_fields:
            unset_attributes = unset_fields
        else:
            unset_attributes = []

        self.call_hook('before_update',obj,set_attributes,unset_attributes)

        if update_obj:
            for key,value in set_attributes.items():
                set_value(obj,key,value)
            for key in unset_attributes:
                delete_value(obj,key)

        return self.save(obj,call_hook = False)
1278233
function clone(conf) {
  if (typeof conf !== 'object') return conf;
  var obj = {};
  for (var key in conf) {
    obj[key] = clone(conf[key]);
  }
  return obj;
}
389842
function getPatchedObject (obj, patcher, clone = true) {
  if (!patcher) {
    return obj
  }
  let newObj, newPatcher
  if (clone) {
    newObj = getDeepCopiedObject(obj)
    newPatcher = getDeepCopiedObject(patcher)
  } else {
    newObj = obj
    newPatcher = patcher
  }
  // patch
  const keys = Object.keys(newPatcher)
  for (let i = 0; i < keys.length; i++) {
    const key = keys[i]
    if ((key in newObj) && isRealObject(newObj[key]) && isRealObject(newPatcher[key])) {
      // recursive patch for if value type is newObject
      try {
        newObj[key] = getPatchedObject(newObj[key], newPatcher[key], false)
      } catch (error) {
      // do nothing, just skip
      }
    } else {
      // simple replacement if value type is not newObject
      newObj[key] = newPatcher[key]
    }
  }
  return newObj
}
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)
1281680
function _cloneObject(object) {
    if (object == null || typeof object != 'object' || typeof object.nodeType != 'undefined') {
        return object;
    }
    var temp = {};
    for (var key in object) {
        if (typeof jQuery != 'undefined' && object[key] instanceof jQuery) {
            temp[key] = object[key];
        } else {
            temp[key] = _cloneObject(object[key]);
        }
    }
    return temp;
}
1282506
def save_object(self, obj, expected_value=None):
        
        doc = self.marshal_object(obj)
        if obj.id:
            url = "/%s/%s" % (self.db_name, obj.id)
        else:
            url = "/%s" % (self.db_name)
        resp = self._make_request("PUT", url, body=doc.toxml())
        new_obj = self.get_object_from_doc(obj.__class__, None, parse(resp))
        obj.id = new_obj.id
        for prop in obj.properties():
            try:
                propname = prop.name
            except AttributeError:
                propname = None
            if propname:
                value = getattr(new_obj, prop.name)
                if value:
                    setattr(obj, prop.name, value)
        return obj
850728
function( obj1, obj2 ) {
            var newObj = {};
            if ( obj1 ) {
                this.inheritAttrs( newObj, this.cloneObj( obj1 ) );
            }
            if ( obj2 ) {
                this.inheritAttrs( newObj, obj2 );
            }
            return newObj;
        }
373191
function clone(obj) {
  if (Array.isArray(obj)) {
    return obj.map((val) => clone(val))
  }
  if (isPlainObj(obj)) {
    return Object.keys(obj).reduce((copy, key) => {
      copy[key] = clone(obj[key])
      return copy
    }, {})
  }
  return obj
}
438147
def clone(self, **data):
        '''
'''
        meta = self._meta
        session = self.session
        pkname = meta.pkname()
        pkvalue = data.pop(pkname, None)
        fields = self.todict(exclude_cache=True)
        fields.update(data)
        fields.pop('__dbdata__', None)
        obj = self._meta.make_object((pkvalue, None, fields))
        obj.session = session
        return obj