(self, key)
return headers + data
Return a string representation or raise a KeyError.
Return a string representation or raise a KeyError.
Return a string representation or raise a KeyError .
def get_bytes(self, key):
        """Return a string representation or raise a KeyError."""
        start, stop = self._lookup(key)
        self._file.seek(start)
        self._file.readline()   # Skip b'1,' line specifying labels.
        original_headers = io.BytesIO()
        while True:
            line = self._file.readline()
            if line == b'*** EOOH ***' + linesep or not line:
                break
            original_headers.write(line.replace(linesep, b'\n'))
        while True:
            line = self._file.readline()
            if line == linesep or not line:
                break
        headers = original_headers.getvalue()
        n = stop - self._file.tell()
        assert n >= 0
        data = self._file.read(n)
        data = data.replace(linesep, b'\n')
        return headers + data
def get_bytes ( self , key ) : start , stop = self . _lookup ( key ) self . _file . seek ( start ) self . _file . readline ( ) # Skip b'1,' line specifying labels. original_headers = io . BytesIO ( ) while True : line = self . _file . readline ( ) if line == b'*** EOOH ***' + linesep or not line : break original_headers . write ( line . replace ( linesep , b'\n' ) ) while True : line = self . _file . readline ( ) if line == linesep or not line : break headers = original_headers . getvalue ( ) n = stop - self . _file . tell ( ) assert n >= 0 data = self . _file . read ( n ) data = data . replace ( linesep , b'\n' ) return headers + data