Look at the data and determine if we can process it or not. If there are enough bytes of data
to look for an eyecatcher, we can give a definitive answer - otherwise the best we can do is
say no or maybe.
169388
public int discriminate(VirtualConnection vc, Object discrimData) {
        if (tc.isEntryEnabled())
            SibTr.entry(this, tc, "discriminate", new Object[]
            {
             vc, discrimData
            });

        int answer;
        // begin D218910
        WsByteBuffer[] dataArray = (WsByteBuffer[]) discrimData;

        // begin D234423
        if (dataArray == null) {
            if (tc.isDebugEnabled())
                SibTr.debug(this, tc, "timeout prior to discrimination.");
            answer = MAYBE;
        } else {
            WsByteBuffer data = null;
            int originalPosition = 0;
            int originalLimit = 0;
            switch (dataArray.length) {
                case 0:
                    if (tc.isDebugEnabled())
                        SibTr.debug(this, tc, "discriminate", "MAYBE");
                    if (tc.isEntryEnabled())
                        SibTr.exit(this, tc, "discriminate");
                    return MAYBE;
                case 1:
                    originalPosition = dataArray[0].position();
                    originalLimit = dataArray[0].limit();
                    data = dataArray[0].flip();
                    break;
                default:
                    int totalAmount = 0;
                    for (int i = 0; i < dataArray.length; ++i) {
                        totalAmount += dataArray[i].position();
                    }
                    data = CommsServerServiceFacade.getBufferPoolManager().allocate(totalAmount);
                    for (int i = 0; i < dataArray.length; ++i) {
                        originalPosition = dataArray[i].position();
                        originalLimit = dataArray[i].limit();
                        dataArray[i].flip();
                        data.put(dataArray[i]);
                        dataArray[i].position(originalPosition);
                        dataArray[i].limit(originalLimit);
                    }
                    data.flip();
                    break;
            }
            // end D218910

            if (tc.isDebugEnabled()) {
                byte[] debugData = null;
                int start = 0;

                if (data.hasArray()) {
                    debugData = data.array();
                    start = data.arrayOffset() + data.position();;
                } else {
                    debugData = new byte[32];
                    int pos = data.position();
                    data.get(debugData);
                    data.position(pos);
                    start = 0;
                }

                SibTr.bytes(this, tc, debugData, start, 32, "Discrimination Data");
            }

            if (data.remaining() < EYECATCHER.length) {
                // Not enought data to tell for sure - but maybe enough to eliminate ourself
                answer = MAYBE;
                for (int i = 0; (data.remaining() > 0) && (answer == MAYBE); ++i) {
                    if (data.get() != EYECATCHER[i])
                        answer = NO;
                }
            } else {
                // Enough data to be able to decide if this is ours or not.
                answer = YES;
                for (int i = 0; (i < EYECATCHER.length) && (answer == YES); ++i) {
                    if (data.get() != EYECATCHER[i])
                        answer = NO;
                }
            }

            data.position(originalPosition); // D218910
            data.limit(originalLimit); // D218910
        }
        // end D234423

        if (tc.isDebugEnabled()) {
            switch (answer) {
                case (YES):
                    SibTr.debug(this, tc, "discriminate", "YES");
                    break;
                case (NO):
                    SibTr.debug(this, tc, "discriminate", "NO");
                    break;
                case (MAYBE):
                    SibTr.debug(this, tc, "discriminate", "MAYBE");
                    break;
            }
        }
        if (tc.isEntryEnabled())
            SibTr.exit(this, tc, "discriminate");
        return answer;
    }
212180
private boolean readMore(int wanted) throws IOException {
    if (endIndex == index) {
      index = 0;
      endIndex = 0;
    }
    int canFit = buffer.length - endIndex;
    if (canFit < wanted) {
      // would the wanted bytes fit if we compacted the buffer
      // and still leave some slack
      if (index + canFit > wanted + MINIMUM_READ) {
        compact();
      } else {
        doubleBuffer();
      }
      canFit = buffer.length - endIndex;
    }
    int read = wrapped.read(buffer, endIndex, canFit);
    if (read < 0) {
      return false;
    }
    endIndex += read;
    return true;
  }
461658
async def can_read(self):
        ""
        if not (self._reader and self._writer):
            await self.connect()
        return self._parser.can_read()
919461
private static boolean mightInheritFromException(ClassDescriptor d) {
        while (d != null) {
            try {
                if ("java.lang.Exception".equals(d.getDottedClassName())) {
                    return true;
                }
                XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, d);
                d = classNameAndInfo.getSuperclassDescriptor();
            } catch (CheckedAnalysisException e) {
                return true; // don't know
            }
        }
        return false;
    }
602889
private void checkRateLimit(String quotaKey, Tracked trackedOp) {
        String quotaValue = null;
        try {
            if(!metadataStore.getQuotaEnforcingEnabledUnlocked()) {
                return;
            }
            quotaValue = quotaStore.cacheGet(quotaKey);
            // Store may not have any quotas
            if(quotaValue == null) {
                return;
            }
            // But, if it does
            float currentRate = getThroughput(trackedOp);
            float allowedRate = Float.parseFloat(quotaValue);
            // TODO the histogram should be reasonably accurate to do all
            // these things.. (ghost qps and all)

            // Report the current quota usage level
            quotaStats.reportQuotaUsed(trackedOp, Utils.safeGetPercentage(currentRate, allowedRate));

            // check if we have exceeded rate.
            if(currentRate > allowedRate) {
                quotaStats.reportRateLimitedOp(trackedOp);
                throw new QuotaExceededException("Exceeded rate limit for " + quotaKey
                                                 + ". Maximum allowed : " + allowedRate
                                                 + " Current: " + currentRate);
            }
        } catch(NumberFormatException nfe) {
            // move on, if we cannot parse quota value properly
            logger.debug("Invalid formatting of quota value for key " + quotaKey + " : "
                         + quotaValue);
        }
    }
126323
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "readObject");

        in.defaultReadObject();

        // Read in eye catcher.
        byte[] eyeCatcher = new byte[EYECATCHER.length];

        // Insure that all of the bytes have been read.
        int bytesRead = 0;
        for (int offset = 0; offset < EYECATCHER.length; offset += bytesRead) {
            bytesRead = in.read(eyeCatcher, offset, EYECATCHER.length - offset);
            if (bytesRead == -1) {
                throw new IOException("end of input stream while reading eye catcher");
            }
        }

        // Validate that the eyecatcher matches
        for (int i = 0; i < EYECATCHER.length; i++) {
            if (EYECATCHER[i] != eyeCatcher[i]) {
                String eyeCatcherString = new String(eyeCatcher);
                throw new IOException("Invalid eye catcher '" + eyeCatcherString + "' in TimerHandle input stream");
            }
        }

        // Read in the rest of the header.
        @SuppressWarnings("unused")
        short incoming_platform = in.readShort();
        short incoming_vid = in.readShort();

        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "version = " + incoming_vid);

        // Verify the version is supported by this version of code.
        if (incoming_vid != Constants.TIMER_TASK_V1 &&
            incoming_vid != Constants.TIMER_TASK_V2) {
            throw new InvalidObjectException("EJB TimerTaskHandler data stream is not of the correct version, this client should be updated.");
        }

        // Read in the instance data.

        byte[] j2eeNameBytes = (byte[]) in.readObject();
        j2eeName = EJSContainer.j2eeNameFactory.create(j2eeNameBytes);
        userInfoBytes = (byte[]) in.readObject();

        switch (incoming_vid) {

            case Constants.TIMER_TASK_V1:
                expiration = in.readLong();
                interval = in.readLong();
                break;

            case Constants.TIMER_TASK_V2:
                parsedSchedule = (ParsedScheduleExpression) in.readObject();
                methodId = in.readInt();
                automaticMethodName = (String) in.readObject();
                automaticClassName = (String) in.readObject();
                break;

            default:
                // cannot occur since unsupported version detected above
                break;
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "readObject: " + this);
    }
974407
def _check(self):
        """"""
        # Run the super method
        super(Spectrum, self)._check()

        err_str = None
        has_data = self._KEYS.DATA in self
        has_wave = self._KEYS.WAVELENGTHS in self
        has_flux = self._KEYS.FLUXES in self
        has_filename = self._KEYS.FILENAME in self

        if not has_data:
            if (not has_wave or not has_flux) and not has_filename:
                err_str = (
                    "If `{}` not given".format(self._KEYS.DATA) +
                    "; `{}` or `{}` needed".format(
                        self._KEYS.WAVELENGTHS, self._KEYS.FLUXES))

        if err_str is not None:
            raise ValueError(err_str)

        return
1007460
def has_data(self, datatype, mode, disp):
        

        # Imports
        from ..error import RepoError

        # Just try to get the data. Simply pass up all exceptions except for
        #  those if the group or data doesn't exist. DO re-raise a non-bound
        #  repo. Initialize value to DATA PRESENT (True) for case where data
        #  is present and the 'try' succeeds.
        retval = True
        try:
            self.get_data(datatype, mode, disp)
        except RepoError as RErr:
            if RErr.tc in (RErr.DATA, RErr.GROUP):
                retval = False
            ## end if
        ## end try

        # Should be good to return
        return retval
1166312
def watchable(value):
    """"""
    check = issubclass if inspect.isclass(value) else isinstance
    return check(value, Watchable)
1371755
def has_valid_soma(data_wrapper):
    '''
    '''
    try:
        make_soma(data_wrapper.soma_points())
        return CheckResult(True)
    except SomaError:
        return CheckResult(False)
1318240
def iscomet(self):
        

        # treat this object as comet if there is a prefix/number
        if self.comet is not None:
            return self.comet
        elif self.asteroid is not None:
            return not self.asteroid
        else:
            return (self.parse_comet()[0] is not None or
                    self.parse_comet()[1] is not None)
1064349
public boolean check(ByteBuffer data)
    {
        assert (data != null);
        int size = data.limit();
        //  This function is on critical path. It deliberately doesn't use
        //  recursion to get a bit better performance.
        Trie current = this;
        int start = 0;
        while (true) {
            //  We've found a corresponding subscription!
            if (current.refcnt > 0) {
                return true;
            }

            //  We've checked all the data and haven't found matching subscription.
            if (size == 0) {
                return false;
            }

            //  If there's no corresponding slot for the first character
            //  of the prefix, the message does not match.
            byte c = data.get(start);
            if (c < current.min || c >= current.min + current.count) {
                return false;
            }

            //  Move to the next character.
            if (current.count == 1) {
                current = current.next[0];
            }
            else {
                current = current.next[c - current.min];
                if (current == null) {
                    return false;
                }
            }
            start++;
            size--;
        }
    }
1098801
boolean processBytesFromPeer(ByteBuf data) throws GeneralSecurityException {
    checkState(unwrapper != null, "protector already created");
    try (BufUnwrapper unwrapper = this.unwrapper) {
      int bytesRead = 0;
      boolean done = false;
      for (ByteBuffer nioBuffer : unwrapper.readableNioBuffers(data)) {
        if (!nioBuffer.hasRemaining()) {
          // This buffer has been fully read, continue to the next buffer.
          continue;
        }

        int prevPos = nioBuffer.position();
        done = internalHandshaker.processBytesFromPeer(nioBuffer);
        bytesRead += nioBuffer.position() - prevPos;
        if (done) {
          break;
        }
      }

      data.readerIndex(data.readerIndex() + bytesRead);
      return done;
    }
  }
593859
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {

        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "readObject");

        in.defaultReadObject();

        // Read in eye catcher.
        byte[] eyeCatcher = new byte[EYECATCHER.length];

        // Insure that all of the bytes have been read.
        int bytesRead = 0;
        for (int offset = 0; offset < EYECATCHER.length; offset += bytesRead) {
            bytesRead = in.read(eyeCatcher, offset, EYECATCHER.length - offset);
            if (bytesRead == -1) {
                throw new IOException("end of input stream while reading eye catcher");
            }
        }

        // Validate that the eyecatcher matches
        for (int i = 0; i < EYECATCHER.length; i++) {
            if (EYECATCHER[i] != eyeCatcher[i]) {
                String eyeCatcherString = new String(eyeCatcher);
                throw new IOException("Invalid eye catcher '" + eyeCatcherString + "' in TimerHandle input stream");
            }
        }

        // Read in the rest of the header.
        short incoming_platform = in.readShort();
        short incoming_vid = in.readShort();

        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "readObject: platform = " + incoming_platform + ", version = " + incoming_vid);

        // Verify the version is supported by this version of code.
        if (incoming_vid != VERSION_ID) {
            throw new InvalidObjectException("EJB TimerHandle data stream is not of the correct version, this client should be updated.");
        }

        // Read in the instance data.
        isTimer = in.readBoolean();
        taskId = in.readLong();

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "readObject: " + this);
    }
332038
function shouldProcess (filePath, done) {
        done(!!multimatch(filePath, transform.pattern, transform.opts).length)
      }
812641
def should_stop(self, result):
        """"""

        if result.get(DONE):
            return True

        for criteria, stop_value in self.stopping_criterion.items():
            if criteria not in result:
                raise TuneError(
                    "Stopping criteria {} not provided in result {}.".format(
                        criteria, result))
            if result[criteria] >= stop_value:
                return True

        return False
375541
private boolean hasSomeDataInternal(boolean image) throws IOException {
    QuorumCall<AsyncLogger, Boolean> call = image ? loggers.isImageFormatted() :
        loggers.isJournalFormatted();

    try {
      call.waitFor(loggers.size(), 0, 0, hasDataTimeoutMs, "hasSomeData");
    } catch (InterruptedException e) {
      throw new IOException("Interrupted while determining if JNs have data");
    } catch (TimeoutException e) {
      throw new IOException("Timed out waiting for response from loggers");
    }
    
    if (call.countExceptions() > 0) {
      call.throwQuorumException(
          "Unable to check if JNs are ready for formatting");
    }
    
    // If any of the loggers returned with a non-empty manifest, then
    // we should prompt for format.
    for (Boolean hasData : call.getResults().values()) {
      if (hasData) {
        return true;
      }
    }

    // Otherwise, none were formatted, we can safely format.
    return false;
  }