def from_binary(data): dimensions = None array = False encoding = ord(data.read(1)) int_type = encoding & 0b00111111 vtype = datatype_to_varianttype(int_type) if uabin.test_bit(encoding, 7): value = uabin.unpack_uatype_array(vtype, data) array = True else: value = uabin.unpack_uatype(vtype, data) if uabin.test_bit(encoding, 6): dimensions = uabin.unpack_uatype_array(VariantType.Int32, data) value = reshape(value, dimensions) return Variant(value, vtype, dimensions, is_array=array)
def from_binary(data): dimensions = None encoding = ord(data.read(1)) int_type = encoding & 0b00111111 vtype = DataType_to_VariantType(int_type) if vtype == VariantType.Null: return Variant(None, vtype, encoding) if uabin.test_bit(encoding, 7): value = uabin.unpack_uatype_array(vtype, data) else: value = uabin.unpack_uatype(vtype, data) if uabin.test_bit(encoding, 6): dimensions = uabin.unpack_uatype_array(VariantType.Int32, data) value = reshape(value, dimensions) return Variant(value, vtype, dimensions)