Mark a zonefile as present (i.e. we stored it).
    Keep our in-RAM zonefile inventory coherent.
    Return the previous state.
    
    Returns True if the zone file was already present
    Returns False if it was not
557810
def atlasdb_set_zonefile_present( zonefile_hash, present, con=None, path=None ):
    
    global ZONEFILE_INV, ZONEFILE_INV_LOCK

    was_present = None
    with AtlasDBOpen(con=con, path=path) as dbcon:
        with ZONEFILE_INV_LOCK:
            # need to lock here in case someone tries to call atlasdb_cache_zonefile_info
            if present:
                present = 1
            else:
                present = 0

            sql = "UPDATE zonefiles SET present = ? WHERE zonefile_hash = ?;"
            args = (present, zonefile_hash)

            cur = dbcon.cursor()
            res = atlasdb_query_execute( cur, sql, args )
            dbcon.commit()
        
            zfbits = atlasdb_get_zonefile_bits( zonefile_hash, con=dbcon, path=path )
            
            inv_vec = None
            if ZONEFILE_INV is None:
                inv_vec = ""
            else:
                inv_vec = ZONEFILE_INV[:]

            # did we know about this?
            was_present = atlas_inventory_test_zonefile_bits( inv_vec, zfbits )

            # keep our inventory vector coherent.
            ZONEFILE_INV = atlas_inventory_flip_zonefile_bits( inv_vec, zfbits, present )
            log.debug('Set {} ({}) to {} (was_present={})'.format(zonefile_hash, ','.join(str(i) for i in zfbits), present, was_present))

    return was_present
692853
def atlasdb_reset_zonefile_tried_storage( con=None, path=None ):
    

    with AtlasDBOpen(con=con, path=path) as dbcon:

        sql = "UPDATE zonefiles SET tried_storage = ? WHERE present = ?;"
        args = (0, 0)

        cur = dbcon.cursor()
        res = atlasdb_query_execute( cur, sql, args )
        dbcon.commit()

    return True
1163646
def is_cached(self):
        """"""
        # TODO: cache by target+hash, not per file.
        try:
            for item in self.rule.output_files:
                log.info(item)
                self.cachemgr.in_cache(item, self._metahash())
        except cache.CacheMiss:
            log.info('[%s]: Not cached.', self.address)
            return False
        else:
            log.info('[%s]: found in cache.', self.address)
            return True
625358
@GuardedBy("mLock")
  private boolean maybeUpdateFileCacheSize() {
    long now = mClock.now();
    if ((!mCacheStats.isInitialized()) ||
        mCacheSizeLastUpdateTime == UNINITIALIZED ||
        (now - mCacheSizeLastUpdateTime) > FILECACHE_SIZE_UPDATE_PERIOD_MS) {
      return maybeUpdateFileCacheSizeAndIndex();
    }
    return false;
  }
518533
def has_commit(self):
        
        current_revision = self.history.current_revision
        revision_id = self.state.revision_id

        return current_revision.revision_id != revision_id
112387
public synchronized boolean isAlive() {
        if(original!=null && original.isAlive())
            return true;

        for (Entry<String,RangeSet> e : usages.entrySet()) {
            Job j = Jenkins.getInstance().getItemByFullName(e.getKey(),Job.class);
            if(j==null)
                continue;

            Run firstBuild = j.getFirstBuild();
            if(firstBuild==null)
                continue;

            int oldest = firstBuild.getNumber();
            if(!e.getValue().isSmallerThan(oldest))
                return true;
        }
        return false;
    }
980560
def file_is_present(self, file_path):
        
        real_path = self.cont_path(file_path)
        if not os.path.exists(real_path):
            return False
        if not os.path.isfile(real_path):
            raise IOError("%s is not a file" % file_path)
        return True
1212215
private boolean isCurrentBackup(File log)
   {
      for (BackupChain chain : currentBackups)
      {
         if (log.getName().equals(new File(chain.getLogFilePath()).getName()))
         {
            return true;
         }
      }

      return false;
   }
903405
public boolean needPersistence(long fileId) {
    if (isFilePersisting(fileId) || isFilePersisted(fileId)) {
      return false;
    }

    try {
      String ufsFingerprint = ufsFingerprint(fileId);
      if (ufsFingerprint != null) {
        // mark as persisted
        addPersistedFile(fileId, ufsFingerprint);
        return false;
      }
    } catch (Exception e) {
      LOG.warn("Failed to check if file {} exists in under storage system: {}",
               fileId, e.getMessage());
      LOG.debug("Exception: ", e);
    }
    return true;
  }
369487
def _is_current(self, file_path, zip_path):
        
        timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
        if not os.path.isfile(file_path):
            return False
        stat = os.stat(file_path)
        if stat.st_size != size or stat.st_mtime != timestamp:
            return False
        # check that the contents match
        zip_contents = self.loader.get_data(zip_path)
        with open(file_path, 'rb') as f:
            file_contents = f.read()
        return zip_contents == file_contents
464056
def is_cached(file_or_script):
    """"""
    if isinstance(file_or_script, str):
        return unmap_file(file_or_script) in file_cache
    else:
        return is_cached_script(file_or_script)
    return
213748
def cache(self):
        
        self.is_cached = True
        self.persist(StorageLevel.MEMORY_ONLY)
        return self
210377
def is_cached(file_name):
	

	gml_file_path = join(join(expanduser('~'), OCTOGRID_DIRECTORY), file_name)

	return isfile(gml_file_path)
872919
def _get_previous_mz(self, mzs):
        ''''''
        mzs = tuple(mzs)  # must be hashable
        if mzs in self.lru_cache:
            return self.lru_cache[mzs]

        # mz not recognized ... check hash
        mz_hash = "%s-%s-%s" % (hash(mzs), sum(mzs), len(mzs))
        if mz_hash in self.hashes:
            for mz_data in self.hashes[mz_hash]:
                test_mz = self._read_mz(*mz_data)
                if mzs == test_mz:
                    self.lru_cache[test_mz] = mz_data
                    return mz_data
        # hash not recognized
        # must be a new mz array ... write it, add it to lru_cache and hashes
        mz_data = self._encode_and_write(mzs, self.mz_dtype, self.mz_compression)
        self.hashes[mz_hash].append(mz_data)
        self.lru_cache[mzs] = mz_data
        return mz_data
945461
private static boolean ifExistsAndFresh(Configuration conf, FileSystem fs,
                                          URI cache, long confFileStamp,
                                          CacheStatus lcacheStatus,
                                          FileStatus fileStatus)
  throws IOException {
    // check for existence of the cache
    long dfsFileStamp;
    if (fileStatus != null) {
      dfsFileStamp = fileStatus.getModificationTime();
    } else {
      dfsFileStamp = getTimestamp(conf, cache);
    }

    // ensure that the file on hdfs hasn't been modified since the job started
    if (dfsFileStamp != confFileStamp) {
      LOG.fatal("File: " + cache + " has changed on HDFS since job started");
      throw new IOException("File: " + cache +
          " has changed on HDFS since job started");
    }

    if (dfsFileStamp != lcacheStatus.mtime) {
      // needs refreshing
      return false;
    }

    return true;
  }
507372
def was_modified_since_last_sync(self):
        
        info = self.get_sync_info()
        if not info:
            return None
        if self.size != info["s"]:
            return True
        if self.mtime > info["m"]:
            return True
        return False
358824
def property_present(name, property, value):
    '''
    

    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    ## sanitize input
    value = _parse_value(value)

    zones = __salt__['zoneadm.list'](installed=True, configured=True)
    if name in zones:
        ## zone exists
        zonecfg = __salt__['zonecfg.info'](name, show_all=True)
        if property not in zonecfg or zonecfg[property] != _parse_value(value):
            if __opts__['test']:
                ret['result'] = True
            else:
                # update property
                zonecfg_res = __salt__['zonecfg.set_property'](name, property, value)
                ret['result'] = zonecfg_res['status']
                if 'messages' in zonecfg_res:
                    ret['comment'] = zonecfg_res['message']
            if ret['result']:
                ret['changes'][property] = _parse_value(value)
                if ret['comment'] == '':
                    ret['comment'] = 'The property {0} is was updated to {1}.'.format(property, value)
            elif ret['comment'] == '':
                if ret['comment'] == '':
                    ret['comment'] = 'The property {0} is was not updated to {1}!'.format(property, value)
        else:
            ret['result'] = True
            ret['comment'] = 'The property {0} is already set to {1}.'.format(property, value)
    else:
        ## zone does not exist
        ret['result'] = False
        ret['comment'] = 'The zone {0} is not in the configured, installed, or booted state.'.format(name)

    return ret