(self)
Read a block of data from tape.
Read a block of data from tape.
Read a block of data from tape .
def _read_block(self):
        """Read a block of data from tape."""
        count = 0
        data = b''
        while True:
            if count == 256:
                break
            byte = self.bitstream.read_byte()
            if byte is None:
                raise PulseError()
            data += int2byte(byte)
            count += 1
        bytes0, bytes1 = self.bitstream.read_byte(), self.bitstream.read_byte()
        crc_given = bytes0 * 0x100 + bytes1
        crc_calc = crc(data)
        # if crc for either polarity matches, return that
        if crc_given == crc_calc:
            return data
        raise CRCError('CRC check failed, required: %04x realised: %04x' % (crc_given, crc_calc))
def _read_block ( self ) : count = 0 data = b'' while True : if count == 256 : break byte = self . bitstream . read_byte ( ) if byte is None : raise PulseError ( ) data += int2byte ( byte ) count += 1 bytes0 , bytes1 = self . bitstream . read_byte ( ) , self . bitstream . read_byte ( ) crc_given = bytes0 * 0x100 + bytes1 crc_calc = crc ( data ) # if crc for either polarity matches, return that if crc_given == crc_calc : return data raise CRCError ( 'CRC check failed, required: %04x realised: %04x' % ( crc_given , crc_calc ) )