(self, key)
Return a bytes representation or raise a KeyError.
Return a bytes representation or raise a KeyError.
Return a bytes representation or raise a KeyError .
def get_bytes(self, key):
        """Return a bytes representation or raise a KeyError."""
        try:
            if self._locked:
                f = open(os.path.join(self._path, str(key)), 'rb+')
            else:
                f = open(os.path.join(self._path, str(key)), 'rb')
        except OSError as e:
            if e.errno == errno.ENOENT:
                raise KeyError('No message with key: %s' % key)
            else:
                raise
        with f:
            if self._locked:
                _lock_file(f)
            try:
                return f.read().replace(linesep, b'\n')
            finally:
                if self._locked:
                    _unlock_file(f)
def get_bytes ( self , key ) : try : if self . _locked : f = open ( os . path . join ( self . _path , str ( key ) ) , 'rb+' ) else : f = open ( os . path . join ( self . _path , str ( key ) ) , 'rb' ) except OSError as e : if e . errno == errno . ENOENT : raise KeyError ( 'No message with key: %s' % key ) else : raise with f : if self . _locked : _lock_file ( f ) try : return f . read ( ) . replace ( linesep , b'\n' ) finally : if self . _locked : _unlock_file ( f )