Trace the current reader state
321571
private void traceReaderInfo( JsonReader reader ) {
        if ( null != reader && getLogger().isLoggable( Level.INFO ) ) {
            getLogger().log( Level.INFO, "Error at line " + reader.getLineNumber() + " and column " + reader
                    .getColumnNumber() + " of input <" + reader.getInput() + ">" );
        }
    }
1349860
def _peek(self, n):  # type: (int) -> str
        
        # we always want to restore after exiting this scope
        with self._state(restore=True):
            buf = ""
            for _ in range(n):
                if self._current not in " \t\n\r#,]}":
                    buf += self._current
                    self.inc()
                    continue

                break
            return buf
160290
public void read()
  {
    StateInPipe stateOld;
    StateInPipe stateNew;
    
    do {
      stateOld = _stateInRef.get();
      stateNew = stateOld.toActive();
    } while (! _stateInRef.compareAndSet(stateOld, stateNew));
    
    while (stateNew.isActive()) {
      readPipe();
      
      wakeOut();
      
      do {
        stateOld = _stateInRef.get();
        stateNew = stateOld.toIdle();
      } while (! _stateInRef.compareAndSet(stateOld, stateNew));
    }
    
    if (_stateInRef.get().isClosed()) {
      StateOutPipe outStateOld = _stateOutRef.getAndSet(StateOutPipe.CLOSE);
      
      if (! outStateOld.isClosed()) {
        _outFlow.cancel();
      }
    }
  }
459400
def _start_reader(self):
        
        while True:
            message = yield From(self.pipe.read_message())
            self._process(message)
691046
public function onRead()
    {
        if ($this->state === self::STATE_PREHANDSHAKE) {
            if ($this->getInputLength() < 8) {
                return;
            }
            $this->key = $this->readUnlimited();
            $this->handshake();
        }
        if ($this->state === self::STATE_HANDSHAKED) {
            while (($buflen = $this->getInputLength()) >= 2) {
                $hdr = $this->look(10);
                $frametype = ord(mb_orig_substr($hdr, 0, 1));
                if (($frametype & 0x80) === 0x80) {
                    $len = 0;
                    $i = 0;
                    do {
                        if ($buflen < $i + 1) {
                            // not enough data yet
                            return;
                        }
                        $b = ord(mb_orig_substr($hdr, ++$i, 1));
                        $n = $b & 0x7F;
                        $len *= 0x80;
                        $len += $n;
                    } while ($b > 0x80);

                    if ($this->pool->maxAllowedPacket <= $len) {
                        // Too big packet
                        $this->finish();
                        return;
                    }

                    if ($buflen < $len + $i + 1) {
                        // not enough data yet
                        return;
                    }
                    $this->drain($i + 1);
                    $this->onFrame($this->read($len), 'BINARY');
                } else {
                    if (($p = $this->search("\xFF")) !== false) {
                        if ($this->pool->maxAllowedPacket <= $p - 1) {
                            // Too big packet
                            $this->finish();
                            return;
                        }
                        $this->drain(1);
                        $data = $this->read($p);
                        $this->drain(1);
                        $this->onFrame($data, 'STRING');
                    } else {
                        if ($this->pool->maxAllowedPacket < $buflen - 1) {
                            // Too big packet
                            $this->finish();
                            return;
                        }
                        // not enough data yet
                        return;
                    }
                }
            }
        }
    }
865761
def getReadAlignments(self, reference, start=None, end=None):
        
        return self._getReadAlignments(reference, start, end, self, None)
53576
def getReaderNames(self):
        """"""

        # get inserted readers
        hresult, pcscreaders = SCardListReaders(self.hcontext, [])
        if 0 != hresult and SCARD_E_NO_READERS_AVAILABLE != hresult:
            raise ListReadersException(hresult)

        readers = []

        # if no readers asked, use all inserted readers
        if None == self.readersAsked:
            readers = pcscreaders

        # otherwise use only the asked readers that are inserted
        else:
            for reader in self.readersAsked:
                if not isinstance(reader, type("")):
                    reader = str(reader)
                if reader in pcscreaders:
                    readers = readers + [reader]

        return readers
57396
def StateOfCharge(self):
        
        return (self.bus.read_byte_data(self.address, 0x02) + self.bus.read_byte_data(self.address, 0x03) * 256)
764330
public function onRead()
    {
        start:
        if ($this->type === 'udp') {
            $this->onUdpPacket($this->read($this->getInputLength()));
            return;
        }
        if ($this->state === self::STATE_ROOT) {
            if (false === ($hdr = $this->readExact(2))) {
                return; // not enough data
            }
            $this->pctSize = Binary::bytes2int($hdr);
            $this->setWatermark($this->pctSize);
            $this->state = self::STATE_PACKET;
        }
        if ($this->state === self::STATE_PACKET) {
            if (false === ($pct = $this->readExact($this->pctSize))) {
                return; // not enough data
            }
            $this->state = self::STATE_ROOT;
            $this->setWatermark(2);
            $this->onUdpPacket($pct);
        }
        goto start;
    }
718461
public function onRead()
    {
        if ($this->state === self::STATE_PREHANDSHAKE) {
            if (!$this->handshake()) {
                return;
            }
        }
        if ($this->state === self::STATE_HANDSHAKED) {
            while (($buflen = $this->getInputLength()) >= 2) {
                $first = ord($this->look(1)); // first byte integer (fin, opcode)
                $firstBits = Binary::getbitmap($first);
                $opcode = (int)bindec(substr($firstBits, 4, 4));
                if ($opcode === 0x8) { // CLOSE
                    $this->finish();
                    return;
                }
                $opcodeName = isset(static::$opcodes[$opcode]) ? static::$opcodes[$opcode] : false;
                if (!$opcodeName) {
                    Daemon::log(get_class($this) . ': Undefined opcode ' . $opcode);
                    $this->finish();
                    return;
                }
                if ($this->firstFrameOpcodeName === null) {
                    $this->firstFrameOpcodeName = $opcodeName;
                }
                $second = ord($this->look(1, 1)); // second byte integer (masked, payload length)
                $fin = (bool)($first >> 7);
                $isMasked = (bool)($second >> 7);
                $dataLength = $second & 0x7f;
                $p = 2;
                if ($dataLength === 0x7e) { // 2 bytes-length
                    if ($buflen < $p + 2) {
                        return; // not enough data yet
                    }
                    $dataLength = Binary::bytes2int($this->look(2, $p), false);
                    $p += 2;
                } elseif ($dataLength === 0x7f) { // 8 bytes-length
                    if ($buflen < $p + 8) {
                        return; // not enough data yet
                    }
                    $dataLength = Binary::bytes2int($this->look(8, $p));
                    $p += 8;
                }
                if ($this->pool->maxAllowedPacket <= $dataLength) {
                    // Too big packet
                    Daemon::log(get_class($this) . ': MaxAllowedPacket limit exceeded. Packet size ' . $dataLength . ' bytes when limit ' . $this->pool->maxAllowedPacket . ' bytes');
                    $this->finish();
                    return;
                }
                // Extend buffer size to accommodate all data
                $this->setWatermark(null, $dataLength + 100);
                if ($isMasked) {
                    if ($buflen < $p + 4) {
                        return; // not enough data yet
                    }
                    $mask = $this->look(4, $p);
                    $p += 4;
                }
                if ($buflen < $p + $dataLength) {
                    return; // not enough data yet
                }
                $this->drain($p);
                $data = $this->read($dataLength);
                if ($isMasked) {
                    $data = $this->mask($data, $mask);
                }
                //Daemon::log(Debug::dump(array('ext' => $this->extensions, 'rsv1' => $firstBits[1], 'data' => Debug::exportBytes($data))));
                /*if ($firstBits[1] && in_array('deflate-frame', $this->extensions)) { // deflate frame
                    $data = gzuncompress($data, $this->pool->maxAllowedPacket);
                }*/
                if (!$fin) {
                    $this->framebuf .= $data;
                } else {
                    $this->onFrame($this->framebuf . $data, $this->firstFrameOpcodeName);
                    $this->firstFrameOpcodeName = null;
                    $this->framebuf = '';
                }
            }
        }
    }
685949
private State checkl(State state) throws DatatypeException, IOException {
        if (state.context.length() == 0) {
            state = appendToContext(state);
        }
        state.current = state.reader.read();
        state = appendToContext(state);
        state = skipSpaces(state);
        _checkl('l', true, state);
        return state;
    }
390260
function initRead (reader, file) {
    // Already loading something
    if (reader.readyState === FileReader.LOADING) {
        throw new FileError(FileError.INVALID_STATE_ERR);
    }

    reader._result = null;
    reader._error = null;
    reader._progress = 0;
    reader._readyState = FileReader.LOADING;

    if (typeof file.localURL === 'string') {
        reader._localURL = file.localURL;
    } else {
        reader._localURL = '';
        return true;
    }

    if (reader.onloadstart) {
        reader.onloadstart(new ProgressEvent('loadstart', {target: reader}));
    }
}
1262976
def _debug_current_process(sig, current_frame):
    
    # Import modules only if necessary, readline is for shell history support.
    import code, traceback, readline, threading  # @UnresolvedImport @UnusedImport

    d={'_frame':current_frame}         # Allow access to frame object.
    d.update(current_frame.f_globals)  # Unless shadowed by global
    d.update(current_frame.f_locals)

    i = code.InteractiveConsole(d)
    message  = "Signal received : entering python shell.\n"

    threads = dict((thread.ident, thread) for thread in threading.enumerate())
    current_thread = threading.current_thread()
    for thread_id, frame in sys._current_frames().items():
        if current_thread.ident != thread_id:
            message += "\nTraceback of thread {}:\n".format(threads[thread_id])
            message += ''.join(traceback.format_stack(frame))
    message += "\nTraceback of current thread {}:\n".format(current_thread)
    message += ''.join(traceback.format_stack(current_frame))
    i.interact(message)
331600
def cached_read(self, kind):
        """"""
        if not kind in self.cache:
            self.pull_stats(kind)
        if self.epochnow() - self.cache[kind]['lastcall'] > self.cache_timeout:
            self.pull_stats(kind)
        return self.cache[kind]['lastvalue']
1332774
def current_state_str(self):
        """"""
        if self.sample_ok:
            msg = ''
            temperature = self._get_value_opc_attr('temperature')
            if temperature is not None:
                msg += 'Temp: %s ºC, ' % temperature
            humidity = self._get_value_opc_attr('humidity')
            if humidity is not None:
                msg += 'Humid: %s %%, ' % humidity
            pressure = self._get_value_opc_attr('pressure')
            if pressure is not None:
                msg += 'Press: %s mb, ' % pressure
            light_level = self._get_value_opc_attr('light_level')
            if light_level is not None:
                msg += 'Light: %s lux, ' % light_level
            return msg[:-2]
        else:
            return "Bad sample"
662080
def get_so_far(self):
        
        position = self.packet.tell()
        self.rewind()
        return self.packet.read(position)
989398
def current(self):
        
        if self.obj is not None:
            return {name: mstate(self.obj, self.cls)
                for name, mstate in self.statemanager.states.items()
                if mstate(self.obj, self.cls)}