Validates if the value read is still valid and the write operation can proceed.
491788
private boolean isValid(TransactionWrite write, AdvancedCache<byte[], byte[]> readCache) {
      if (write.skipRead()) {
         if (isTrace) {
            log.tracef("Operation %s wasn't read.", write);
         }
         return true;
      }
      CacheEntry<byte[], byte[]> entry = readCache.getCacheEntry(write.key);
      if (write.wasNonExisting()) {
         if (isTrace) {
            log.tracef("Key didn't exist for operation %s. Entry is %s", write, entry);
         }
         return entry == null || entry.getValue() == null;
      }
      if (isTrace) {
         log.tracef("Checking version for operation %s. Entry is %s", write, entry);
      }
      return entry != null && write.versionRead == MetadataUtils.extractVersion(entry);
   }
54713
def valid?(value, negated = false)
      dumped_value = dump(value)

      if required? && dumped_value.nil?
        negated || false
      else
        value_dumped?(dumped_value) || (dumped_value.nil? && (allow_nil? || negated))
      end
    end
649109
private boolean isValidAttrValue(String value) {
        final float parseFloat;
        try {
            parseFloat = Float.parseFloat(value);
        } catch (NumberFormatException e) {
            return false;
        }
        return parseFloat >= 1;
    }
1140566
private boolean doRead(int amountToRead) throws IOException{
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
            Tr.debug(tc, "doRead, Current buffer, " + _buffer + ", reading from the TCP Channel, readLine : " + _isReadLine);
        }
        
        try {
            
            if(_tcpChannelCallback != null && !_isReadLine){
                //async read logic
                return immediateRead(amountToRead);
            } else {
                return syncRead(amountToRead);
            }
        } catch (IOException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
                Tr.debug(tc, "doRead, we encountered an exception during the read : " + e);
            }
            
            if(_error != null){
                return false;
            }
            _error = e;
            throw e;
        }
    }
1325958
def validate(self, data, offset):
        """"""
        recorded_checksum = self.field.getval()

        # convert negative offset to positive
        if offset < 0:
            offset += len(data)

        # replace checksum region with zero
        data = b''.join((data[:offset],
                         b"\x00" * self.bytes_required,
                         data[offset + self.bytes_required:]))
        actual_checksum = self.algo(data[self.start:self.end])
        if recorded_checksum != actual_checksum:
            raise SuitcaseChecksumException(
                "recorded checksum %r did not match actual %r.  full data: %r",
                recorded_checksum, actual_checksum, data)
3342
public boolean checkWrite()
    {
        if (!outActive || state != State.ACTIVE) {
            return false;
        }

        // TODO DIFF V4 small change, it is done like this in 4.2.2
        boolean full = !checkHwm();

        if (full) {
            outActive = false;
            return false;
        }

        return true;
    }
553948
def valid(self, value, level=[]):
		

		# Reset validation failures
		self.validation_failures = []

		# If the value is None and it's optional, we're good
		if value is None and self._optional:
			return True

		# If the value isn't a dictionary
		if not isinstance(value, dict):
			self.validation_failures.append(('.'.join(level), str(value)))
			return False

		# Init the return, assume valid
		bRet = True

		# Go through each key and value
		for k,v in iteritems(value):

			# Add the field to the level
			lLevel = level[:]
			lLevel.append(k)

			# If the key isn't valid
			if not self._key.valid(k):
				self.validation_failures.append(('.'.join(lLevel), 'invalid key: %s' % str(k)))
				bRet = False
				continue

			# Check the value
			if not self._node.valid(v, lLevel):
				self.validation_failures.extend(self._node.validation_failures)
				bRet = False
				continue

		# Return whatever the result was
		return bRet
1140427
def _check(self): # TODO: fix?
        """"""
        if self._returncode:
            rarfile.check_returncode(self, '')
        if self._remain != 0:
            raise rarfile.BadRarFile("Failed the read enough data")
975031
def _validate_readonly(self, readonly, field, value):
        
        if readonly:
            if not self._is_normalized:
                self._error(field, errors.READONLY_FIELD)
            # If the document was normalized (and therefore already been
            # checked for readonly fields), we still have to return True
            # if an error was filed.
            has_error = errors.READONLY_FIELD in \
                self.document_error_tree.fetch_errors_from(
                    self.document_path + (field,))
            if self._is_normalized and has_error:
                self._drop_remaining_rules()
1314899
protected void checkValidForRead() throws IllegalStateException {
        checkLocked();

        if (state == State.INVALID) {
            throw new IllegalStateException("Invalid for read: session " + this);
        }
        if (state == State.INVALIDATING) {
            return;
        }
        if (!isResident()) {
            throw new IllegalStateException("Invalid for read: session " + this);
        }
    }
1351487
def safe_write(buf):
    """"""
    assert isinstance(buf, bytes)
    while True:
        try:
            os.write(1, buf)
            break
        except IOError as e:
            if e.errno != errno.EINTR:
                raise
1144202
def is_valid_int(value):
        """"""
        if 0 <= value <= Parameter.MAX:  # This includes ON and OFF
            return True
        if value == Parameter.UNKNOWN_VALUE:
            return True
        if value == Parameter.CURRENT_POSITION:
            return True
        return False
297150
public function valid()
    {
        if ($this->flags & SplFileObject::READ_AHEAD) {
            return $this->current() !== false;
        }

        return !feof($this->stream);
    }
89067
private void handleReadsAndWrites(final SelectionKey sk, final MemcachedNode node) throws IOException {
      if (sk.isValid() && sk.isReadable()) {
          handleReads(node);
      }

      if (sk.isValid() && sk.isWritable()) {
          handleWrites(node);
      }
  }
1313899
def __CheckValid(self, value):
        ""
        val = self.__val
        self.is_valid = True
        try:
            val = set_float(value)
            if self.__min is not None and (val < self.__min):
                self.is_valid = False
                val = self.__min
            if self.__max is not None and (val > self.__max):
                self.is_valid = False
                val = self.__max
        except:
            self.is_valid = False
        self.__bound_val = self.__val = val
        fgcol, bgcol = self.fgcol_valid, self.bgcol_valid
        if not self.is_valid:
            fgcol, bgcol = self.fgcol_invalid, self.bgcol_invalid

        self.SetForegroundColour(fgcol)
        self.SetBackgroundColour(bgcol)
        self.Refresh()
710173
def write(self, value):
        """"""
        assert self.num_write_waits > 0, self
        self.num_write_waits -= 1
        self.values.append(value)
        if self.readable:
            LOG.debug('%s is now readable', self.name)
279155
protected void checkValidForWrite() throws IllegalStateException {
        checkLocked();

        if (state == State.INVALID) {
            throw new IllegalStateException("Not valid for write: session " + this);
        }
        if (state == State.INVALIDATING) {
            return;  // in the process of being invalidated, listeners may try to remove attributes
        }
        if (!isResident()) {
            throw new IllegalStateException("Not valid for write: session " + this);
        }
    }