Determines whether the values in the cache entry header are valid.

    Args:
      cache_entry_header (firefox_cache1_entry_header): cache entry header.

    Returns:
      bool: True if the cache entry header is valid.
552092
def _ValidateCacheEntryHeader(self, cache_entry_header):
    
    return (
        cache_entry_header.request_size > 0 and
        cache_entry_header.request_size < self._MAXIMUM_URL_LENGTH and
        cache_entry_header.major_format_version == 1 and
        cache_entry_header.last_fetched_time > 0 and
        cache_entry_header.fetch_count > 0)
132193
def is_valid(self, t: URIRef) -> bool:
        
        if not self.has_type(t):
            raise TypeError("Unrecognized FHIR type: {}".format(t))
        return True
1083535
async function isValidOrigin(origin, sourceOrigin) {
    // This will fetch the caches from https://cdn.ampproject.org/caches.json the first time it's
    // called. Subsequent calls will receive a cached version.
    const officialCacheList = await caches.list();
    // Calculate the cache specific origin
    const cacheSubdomain = `https://${await createCacheSubdomain(sourceOrigin)}.`;
    // Check all caches listed on ampproject.org
    for (const cache of officialCacheList) {
      const cachedOrigin = cacheSubdomain + cache.cacheDomain;
      if (origin === cachedOrigin) {
        return true;
      }
    }
    return false;
  }
988977
def _is_valid_value(self):
        

        comp_str = self._encoded_value

        value_pattern = []
        value_pattern.append("^((")
        value_pattern.append("~[")
        value_pattern.append(CPEComponent1_1._STRING)
        value_pattern.append("]+")
        value_pattern.append(")|(")
        value_pattern.append("[")
        value_pattern.append(CPEComponent1_1._STRING)
        value_pattern.append("]+(![")
        value_pattern.append(CPEComponent1_1._STRING)
        value_pattern.append("]+)*")
        value_pattern.append("))$")

        value_rxc = re.compile("".join(value_pattern))
        return value_rxc.match(comp_str) is not None
1140672
def valid?
      return false if @first_page.nil?
      return false if @last_page.nil?
      return false if @odd_pages.nil?
      return false if @even_pages.nil?
      return true
    end
237799
def check_header_validity(header):
    
    name, value = header

    if isinstance(value, bytes):
        pat = _CLEAN_HEADER_REGEX_BYTE
    else:
        pat = _CLEAN_HEADER_REGEX_STR
    try:
        if not pat.match(value):
            raise InvalidHeader("Invalid return character or leading space in header: %s" % name)
    except TypeError:
        raise InvalidHeader("Value for header {%s: %s} must be of type str or "
                            "bytes, not %s" % (name, value, type(value)))
90857
def _is_valid_scan(self):
        
        if self._scan is not None:
            return self._scan
        if self._ordering:
            return False
        if self._facets:
            return False
            #TODO check for child or nested query
        return True
1241110
private boolean checkCache() {
        if (this.cacheValid) {
            long now = System.nanoTime();
            if ((now - this.cacheExpiryTime) > 0) {
                this.cacheValid = false;
            }
        }
        return this.cacheValid;
    }
976375
def check_cache(self, e_tag, match):
        """"""
        if e_tag != match:
            return False
        self.send_response(304)
        self.send_header("ETag", e_tag)
        self.send_header("Cache-Control",
                         "max-age={0}".format(self.server.max_age))
        self.end_headers()
        thread_local.size = 0
        return True
981264
def _is_target_valid(self, cfg, target):  # pylint:disable=no-self-use
        

        if self.base_state is not None:
            try:
                if self.base_state.solver.is_true((self.base_state.memory.permissions(target) & 4) == 4):
                    return True
            except SimMemoryError:
                pass
            return False

        if cfg._addr_in_exec_memory_regions(target):
            # the jump target is executable
            return True
        if self.project.is_hooked(target):
            # the jump target is hooked
            return True
        return False
1333476
function has_valid( $key, $expiration = null ) {
            $cache_entry = $this->_options->get_option( $key, false );

            $is_valid = ( is_object( $cache_entry ) &&
                          isset( $cache_entry->timestamp ) &&
                          is_numeric( $cache_entry->timestamp ) &&
                          $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
            );

            if ( $is_valid &&
                 is_numeric( $expiration ) &&
                 isset( $cache_entry->created ) &&
                 is_numeric( $cache_entry->created ) &&
                 $cache_entry->created + $expiration < WP_FS__SCRIPT_START_TIME
            ) {
                /**
                 * Even if the cache is still valid, since we are checking for validity
                 * with an explicit expiration period, if the period has past, return
                 * `false` as if the cache is invalid.
                 *
                 * @since 1.2.2.7
                 */
                $is_valid = false;
            }

            return $is_valid;
        }
1303208
def is_valid(self, max_age=None):
        '''  '''

        if max_age is None:
            max_age = self.cache_max_age

        if os.path.isfile(self.cache_path_cache):
            mod_time = os.path.getmtime(self.cache_path_cache)
            current_time = time()
            if (mod_time + max_age) > current_time:
                return True

        return False
518247
protected function isValidCache($value): bool
    {
        $result = false;

        if ($value === false) {
            $this->warnings[] = 'Value not found in cache';

            return $result;
        }

        if (!is_array($value)) {
            $this->errors[] = "Cached value is not an array";

            return $result;
        }

        foreach ($this->requiredKeys as $key => $notEmpty) {
            // Key exists
            if (!array_key_exists($key, $value)) {
                $this->errors[] = "Cached value is missing '$key'";

                return $result;
            }
            // Value is not empty
            if ($notEmpty && empty($value[$key])) {
                $this->errors[] = "Cached value is empty for key '$key'";

                return $result;
            }
        }

        return true;
    }
225145
def is_fasta_valid(fasta_file):
    
    try:
        f = pysam.FastaFile(fasta_file)
    except IOError:
        raise
    else:
        f.close()
    return True
746996
@Beta
    public boolean containsEntryPoint(SectionHeader header) {
        long ep = data.getOptionalHeader().get(
                StandardFieldEntryKey.ADDR_OF_ENTRY_POINT);
        long vStart = header.getAlignedVirtualAddress();
        long vSize = header.getAlignedVirtualSize();
        if (vSize == 0) {
            vSize = header.getAlignedSizeOfRaw();
        }
        long vEnd = vSize + vStart;
        return ep >= vStart && ep < vEnd;
    }
565217
def _ValidateCacheFileMetadataHeader(self, cache_file_metadata_header):
    
    # TODO: add support for format version 2 and 3
    return (
        cache_file_metadata_header.key_size > 0 and
        cache_file_metadata_header.key_size < self._MAXIMUM_URL_LENGTH and
        cache_file_metadata_header.format_version == 1 and
        cache_file_metadata_header.last_fetched_time > 0 and
        cache_file_metadata_header.fetch_count > 0)
1325560
private function mayServeStaleWhileRevalidate(Response $entry): bool
    {
        $timeout = $entry->headers->getCacheControlDirective('stale-while-revalidate');

        if (null === $timeout) {
            $timeout = $this->options['stale_while_revalidate'];
        }

        return abs($entry->getTtl()) < $timeout;
    }