Assert that obj does not change (w.r.t. ==) under repeated picklings
15939
def assert_pickle_idempotent(obj):
    '''
    '''
    from six.moves.cPickle import dumps, loads
    obj1 = loads(dumps(obj))
    obj2 = loads(dumps(obj1))
    obj3 = loads(dumps(obj2))
    assert_equivalent(obj, obj1)
    assert_equivalent(obj, obj2)
    assert_equivalent(obj, obj3)
    assert type(obj) is type(obj3)
743457
public static void assertUnlocked(Object object, String name) {
        if (RUNTIME_ASSERTIONS) {
            if (Thread.holdsLock(object)) {
                throw new RuntimeAssertion("Recursive lock of %s", name);
            }
        }
    }
6171
def assertStructIsInline(self, obj):
        

        N.enforce_number(obj, N.UOffsetTFlags)
        if obj != self.Offset():
            msg = ("flatbuffers: Tried to write a Struct at an Offset that "
                   "is different from the current Offset of the Builder.")
            raise StructIsNotInlineError(msg)
1053163
def dump_pickle(name, obj):
    ''''''
    with open(name,"wb") as f:
        pickle.dump(obj,f,2);
    pass;
238600
function(){
			var rect, obj, i;
            for (i=0, l=changed_objs.length; i<l; i++){
            	obj = changed_objs[i];
            	rect = obj._mbr || obj;
            	if (obj.staleRect == null)
            			obj.staleRect = {}
        		obj.staleRect._x = rect._x;
				obj.staleRect._y = rect._y;
				obj.staleRect._w = rect._w;
				obj.staleRect._h = rect._h;

				obj._changed = false
            }
            changed_objs.length = 0;
            dirty_rects.length = 0

		}
681679
def save_inst(self, obj):
        """"""
        cls = obj.__class__

        # Try the dispatch table (pickle module doesn't do it)
        f = self.dispatch.get(cls)
        if f:
            f(self, obj)  # Call unbound method with explicit self
            return

        memo = self.memo
        write = self.write
        save = self.save

        if hasattr(obj, '__getinitargs__'):
            args = obj.__getinitargs__()
            len(args)  # XXX Assert it's a sequence
            pickle._keep_alive(args, memo)
        else:
            args = ()

        write(pickle.MARK)

        if self.bin:
            save(cls)
            for arg in args:
                save(arg)
            write(pickle.OBJ)
        else:
            for arg in args:
                save(arg)
            write(pickle.INST + cls.__module__ + '\n' + cls.__name__ + '\n')

        self.memoize(obj)

        try:
            getstate = obj.__getstate__
        except AttributeError:
            stuff = obj.__dict__
        else:
            stuff = getstate()
            pickle._keep_alive(stuff, memo)
        save(stuff)
        write(pickle.BUILD)
1036592
public boolean sameAs(Object obj){
		if(obj==null){
			return false;
		}
		if(obj instanceof String || obj instanceof IdVersionString){
			if(this.toString().equals(obj.toString())){
				return true;
			}
		}
		return false;
	}
367882
def _check_for_duplicates(xs, attr, check_fn=None):
    
    dups = []
    for key, vals in itertools.groupby(x[attr] for x in xs):
        if len(list(vals)) > 1:
            dups.append(key)
    if len(dups) > 0:
        psamples = []
        for x in xs:
            if x[attr] in dups:
                psamples.append(x)
        # option to skip problem based on custom input function.
        if check_fn and check_fn(psamples):
            return
        descrs = [x["description"] for x in psamples]
        raise ValueError("Duplicate '%s' found in input sample configuration.\n"
                         "Required to be unique for a project: %s\n"
                         "Problem found in these samples: %s" % (attr, dups, descrs))
164611
def equals(self, rest_object):
        

        if self._is_dirty:
            return False

        if rest_object is None:
            return False

        if not isinstance(rest_object, NURESTObject):
            raise TypeError('The object is not a NURESTObject %s' % rest_object)

        if self.rest_name != rest_object.rest_name:
            return False

        if self.id and rest_object.id:
            return self.id == rest_object.id

        if self.local_id and rest_object.local_id:
            return self.local_id == rest_object.local_id

        return False
22800
def validate(self, obj, **kwargs):
        """"""
        obj = stringify(obj)
        if obj is None:
            return False
        return self.DATE_RE.match(obj) is not None
1227835
function throwUnexpected (attr, obj) {
  var e = Unexpected(attr, obj);
  Error.captureStackTrace(e, throwUnexpected);
  throw e;
}
1154244
public boolean notEquals(XObject obj2) throws javax.xml.transform.TransformerException
  {
    return compare(obj2, S_NEQ);
  }
368032
def save(obj, path):
    
    with open(path, 'wb') as f:
        try:
            pickle.dump(obj, f, protocol=pickle.HIGHEST_PROTOCOL)
        except Exception as e:
            print('Pickling failed for object {0}, path {1}'.format(obj, path))
            print('Error message: {0}'.format(e))
1163674
def _is_pickle_valid(self):
        
        if not os.path.exists(self._pickle_file):
            return False
        else:
            file_mtime = os.path.getmtime(self.logfile)
            pickle_mtime = os.path.getmtime(self._pickle_file)
            if file_mtime > pickle_mtime:
                return False
        return True
1211789
def dump(cls, obj, file, protocol=0):
        
        cls.save_option_state = True
        pickle.dump(obj, file, protocol=protocol)
        cls.save_option_state = False
188823
public static void AssertNotNull(String objName, Object obj) throws ParamException {
        if (obj == null) {
            throw new ParamException(objName + " is null, please check!");
        }
    }
1307754
def safe_setattr(obj, name, value):
    """"""
    try:
        setattr(obj, name, value)
        return True
    except AttributeError:
        return False