Esempio n. 1
0
 def _read(endianness,offset,bytes):
   (keys,offset) = parser.read(endianness,offset,bytes)
   (values,offset) = parser.read(endianness,offset,bytes)
   dictionary=q_dict()
   dictionary._keys=keys
   dictionary._values=values
   if isinstance(keys,table) and isinstance(values,table):
     return (table(dictionary),offset)
   else:
     return (dictionary,offset)
Esempio n. 2
0
 def _read(endianness, offset, bytes):
     (keys, offset) = parser.read(endianness, offset, bytes)
     (values, offset) = parser.read(endianness, offset, bytes)
     dictionary = q_dict()
     dictionary._keys = keys
     dictionary._values = values
     if isinstance(keys, table) and isinstance(values, table):
         return (table(dictionary), offset)
     else:
         return (dictionary, offset)
Esempio n. 3
0
File: conn.py Progetto: Ricemast/q
    def _receive(self):
        """read the response from the server"""
        header = self.sock.recv(8)
        # Endianness of byte doesn't matter when determining endianness
        endianness = lambda x: x
        if not _parser.read_byte(endianness, 0, header)[0] == 1:
            endianness = '>'.__add__
        (data_size, self.offset) = _parser.read_integer(endianness, 4, header)

        bytes = self._recv_size(data_size - 8)
        # ensure that it reads all the data
        if _parser.read_byte(endianness, 0, bytes)[0] == -128:
            (val, self.offset) = _parser.read_symbol(endianness, 1, bytes)
            raise Exception(val)
        (val, self.offset) = _parser.read(endianness, 0, bytes)
        return val
Esempio n. 4
0
 def _read(endianness,offset,bytes):
   (dictionary,offset) = parser.read(endianness,offset+1,bytes)
   return (table(flip(dictionary)),offset)
Esempio n. 5
0
 def _read(endianness, offset, bytes):
     (dictionary, offset) = parser.read(endianness, offset + 1, bytes)
     return (table(flip(dictionary)), offset)