Find out if idjobject is mentioned an any object anywhere
170903
def getanymentions(idf, anidfobject):
    """"""
    name = anidfobject.obj[1]
    foundobjs = []
    keys = idfobjectkeys(idf)
    idfkeyobjects = [idf.idfobjects[key.upper()] for key in keys]
    for idfobjects in idfkeyobjects:
        for idfobject in idfobjects:
            if name.upper() in [item.upper() 
                                    for item in idfobject.obj 
                                        if isinstance(item, basestring)]:
                foundobjs.append(idfobject)
    return foundobjs
239673
protected boolean isTransient(ClassDescriptor cld, Object obj, Identity oid)
    {
        // if the Identity is transient we assume a non-persistent object
        boolean isNew = oid != null && oid.isTransient();
        /*
        detection of new objects is costly (select of ID in DB to check if object
        already exists) we do:
        a. check if the object has nullified PK field
        b. check if the object is already registered
        c. lookup from cache and if not found, last option select on DB
        */
        if(!isNew)
        {
            final PersistenceBroker pb = getBroker();
            if(cld == null)
            {
                cld = pb.getClassDescriptor(obj.getClass());
            }
            isNew = pb.serviceBrokerHelper().hasNullPKField(cld, obj);
            if(!isNew)
            {
                if(oid == null)
                {
                    oid = pb.serviceIdentity().buildIdentity(cld, obj);
                }
                final ObjectEnvelope mod = objectEnvelopeTable.getByIdentity(oid);
                if(mod != null)
                {
                    // already registered object, use current state
                    isNew = mod.needsInsert();
                }
                else
                {
                    // if object was found cache, assume it's old
                    // else make costly check against the DB
                    isNew = pb.serviceObjectCache().lookup(oid) == null
                            && !pb.serviceBrokerHelper().doesExist(cld, oid, obj);
                }
            }
        }
        return isNew;
    }
213134
static int getRegisteredID (Connection connection, Object object) {
		ObjectSpace[] instances = ObjectSpace.instances;
		for (int i = 0, n = instances.length; i < n; i++) {
			ObjectSpace objectSpace = instances[i];
			// Check if the connection is in this ObjectSpace.
			Connection[] connections = objectSpace.connections;
			for (int j = 0; j < connections.length; j++) {
				if (connections[j] != connection) continue;
				// Find an ID with the object.
				int id = objectSpace.objectToID.get(object, Integer.MAX_VALUE);
				if (id != Integer.MAX_VALUE) return id;
			}
		}
		return Integer.MAX_VALUE;
	}
352987
def get_object_id(obj):
    """"""
    try:
        idx = objIds.index(obj)
        return idx + 1
    except ValueError:
        objIds.append(obj)
        return len(objIds)
892848
def sanity_check_insdcio(handle, id_marker, fake_id_line):
    """"""
    found_id = False
    found_end_marker = False
    for line in handle:
        line = line.strip()
        if not line:
            continue
        if line.startswith(id_marker):
            found_id = True
            break
        if line.startswith('//'):
            found_end_marker = True
            break

    handle.seek(0)
    # We found an ID, file looks good.
    if found_id:
        return handle

    # If there's no ID and no end marker, just give up.
    if not found_end_marker:
        return handle

    # If we found an end marker but no ID, fake one.
    new_handle = StringIO()
    new_handle.write("%s\n" % fake_id_line)
    new_handle.write(handle.read())
    new_handle.seek(0)
    return new_handle
1310895
function isEmptyObject(obj) {
    if (obj === null) {
        return true;
    }
    if (!isObject(obj)) {
        return false;
    }

    for (var key in obj) {
        if (obj.hasOwnProperty(key) && obj[key]) {
            return false;
        }
    }

    return true;
}
1211094
protected void checkIdRefs()
        throws XMLStreamException
    {
        /* 02-Oct-2004, TSa: Now we can also check that all id references
         *    pointed to ids that actually are defined
         */
        if (mIdMap != null) {
            ElementId ref = mIdMap.getFirstUndefined();
            if (ref != null) { // problem!
                reportValidationProblem("Undefined id '"+ref.getId()
                                        +"': referenced from element <"
                                        +ref.getElemName()+">, attribute '"
                                        +ref.getAttrName()+"'",
                                        ref.getLocation());
            }
        }
    }
827680
def by_id(cls, oid):
        """"""
        if oid:
            d = cls.collection.find_one(ObjectId(oid))
            if d:
                return cls(**d)
896724
function(obj) {

            this.guid.id = this.guid.id || 1;
            obj.id = (obj.id === undefined ? 'j_' + this.guid.id++ : obj.id);
            return obj.id;
        }
1169529
private static int  js_indexOf(int methodId, String target, Object[] args) {
        String searchStr = ScriptRuntime.toString(args, 0);
        double position = ScriptRuntime.toInteger(args, 1);

        if (position > target.length() && methodId != Id_startsWith && methodId != Id_endsWith) {
            return -1;
        }

        if (position < 0) position = 0;
        else if (position > target.length()) position = target.length();
        else if (methodId == Id_endsWith && (position != position  || position > target.length())) position = target.length();

        if (Id_endsWith == methodId) {
            if (args.length == 0 || args.length == 1 || (args.length == 2 && args[1] == Undefined.instance)) position = target.length();
            return target.substring(0, (int)position).endsWith(searchStr) ? 0 : -1;
        }
        return methodId == Id_startsWith
                ? target.startsWith(searchStr, (int)position) ? 0 : -1
                : target.indexOf(searchStr, (int)position);
    }
141948
public static boolean isObjectRegistered(String id, Object obj) {
    return DefaultMonitorRegistry.getInstance().isRegistered(newObjectMonitor(id, obj));
  }
1130739
def has_method(obj, method_name):
    '''
    
    '''
    if method_name in dir(obj):
        return True

    log.error('Method \'%s\' not yet supported!', method_name)
    return False
821810
@Restricted(NoExternalUse.class) // called from newJob_button-bar view
    @SuppressWarnings("unused") // called from newJob_button-bar view
    public boolean isAddToCurrentView() {
        synchronized(this) {
            return !jobNames.isEmpty() || // There are already items in this view specified by name
                    (jobFilters.isEmpty() && includePattern == null) // No other way to include items is used
                    ;
        }
    }
1221881
def get_job_id(self, response):
        """"""
        match = re.search('Job <([^>]+)> is submitted', response)
        if match:
            return match.group(1)
        else:
            return None
1001651
def instance_contains(container, item):
    """"""
    return item in (member for _, member in inspect.getmembers(container))
754602
function _hasJob(id) {
    var job = _jobs[id] || _runningJobs[id] || _waitingJobs[id];
    return job ? __extend(job) : null;
  }
150457
def _name_is_available(self, job_name):
        
        return (False
                if [job for job in self.jobs if job.name == job_name]
                else True)