All Samples(760) | Call(739) | Derive(0) | Import(21)
Unpack the buffer, containing packed C structure data, according to fmt, starting at offset. Requires len(buffer[offset:]) >= calcsize(fmt).
src/p/i/pika-HEAD/pika/spec.py pika(Download)
def decode(self, encoded, offset = 0):
self.version_major = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.version_minor = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
(self.server_properties, offset) = pika.table.decode_table(encoded, offset)
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.mechanisms = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('>I', encoded, offset)[0]
def decode(self, encoded, offset = 0):
(self.client_properties, offset) = pika.table.decode_table(encoded, offset)
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.mechanism = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.response = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.challenge = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.response = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
self.channel_max = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.frame_max = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.heartbeat = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
def decode(self, encoded, offset = 0):
self.channel_max = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.frame_max = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.heartbeat = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.virtual_host = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.capabilities = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.known_hosts = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.host = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
self.class_id = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.method_id = struct.unpack_from('>H', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.out_of_band = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.active = (bit_buffer & (1 << 0)) != 0
return self
def encode(self):
def decode(self, encoded, offset = 0):
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.active = (bit_buffer & (1 << 0)) != 0
return self
def encode(self):
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
self.class_id = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.method_id = struct.unpack_from('>H', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.realm = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.type = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
self.message_count = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.consumer_count = struct.unpack_from('>I', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.nowait = (bit_buffer & (1 << 0)) != 0
(self.arguments, offset) = pika.table.decode_table(encoded, offset)
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.message_count = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.message_count = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.prefetch_size = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.prefetch_count = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.redelivered = (bit_buffer & (1 << 0)) != 0
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.redelivered = (bit_buffer & (1 << 0)) != 0
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
self.message_count = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.cluster_id = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.multiple = (bit_buffer & (1 << 0)) != 0
return self
def decode(self, encoded, offset = 0):
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.requeue = (bit_buffer & (1 << 0)) != 0
return self
def decode(self, encoded, offset = 0):
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.requeue = (bit_buffer & (1 << 0)) != 0
return self
def encode(self):
def decode(self, encoded, offset = 0):
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.requeue = (bit_buffer & (1 << 0)) != 0
return self
def encode(self):
def decode(self, encoded, offset = 0):
self.prefetch_size = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.prefetch_count = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.identifier = encoded[offset : offset + length]
offset = offset + length
self.content_size = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
def decode(self, encoded, offset = 0):
self.staged_size = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.mandatory = (bit_buffer & (1 << 0)) != 0
self.immediate = (bit_buffer & (1 << 1)) != 0
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.identifier = encoded[offset : offset + length]
offset = offset + length
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.redelivered = (bit_buffer & (1 << 0)) != 0
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.multiple = (bit_buffer & (1 << 0)) != 0
return self
def decode(self, encoded, offset = 0):
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.requeue = (bit_buffer & (1 << 0)) != 0
return self
def decode(self, encoded, offset = 0):
self.prefetch_size = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.prefetch_count = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.consume_rate = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.dtx_identifier = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
self.integer_1 = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.integer_2 = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.integer_3 = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.integer_4 = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
self.operation = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.result = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.string_1 = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.string_2 = encoded[offset : offset + length]
offset = offset + length
self.operation = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.result = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
(self.table, offset) = pika.table.decode_table(encoded, offset)
self.integer_op = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.string_op = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
return self
def decode(self, encoded, offset = 0):
self.integer_result = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.string_result = encoded[offset : offset + length]
offset = offset + length
def decode(self, encoded, offset = 0):
self.content_checksum = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
flags = 0
flagword_index = 0
while True:
partial_flags = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
flags = flags | (partial_flags << (flagword_index * 16))
if (partial_flags & 1) == 0: break
flagword_index = flagword_index + 1
if (flags & BasicProperties.FLAG_CONTENT_TYPE):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.content_type = None
if (flags & BasicProperties.FLAG_CONTENT_ENCODING):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.content_encoding = encoded[offset : offset + length]
offset = offset + length
else:
self.headers = None
if (flags & BasicProperties.FLAG_DELIVERY_MODE):
self.delivery_mode = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
else:
self.delivery_mode = None
if (flags & BasicProperties.FLAG_PRIORITY):
self.priority = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
else:
self.priority = None
if (flags & BasicProperties.FLAG_CORRELATION_ID):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.correlation_id = None
if (flags & BasicProperties.FLAG_REPLY_TO):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_to = encoded[offset : offset + length]
offset = offset + length
else:
self.reply_to = None
if (flags & BasicProperties.FLAG_EXPIRATION):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.expiration = None
if (flags & BasicProperties.FLAG_MESSAGE_ID):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.message_id = encoded[offset : offset + length]
offset = offset + length
else:
self.message_id = None
if (flags & BasicProperties.FLAG_TIMESTAMP):
self.timestamp = struct.unpack_from('>Q', encoded, offset)[0]
else:
self.timestamp = None
if (flags & BasicProperties.FLAG_TYPE):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.type = encoded[offset : offset + length]
offset = offset + length
else:
self.type = None
if (flags & BasicProperties.FLAG_USER_ID):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.user_id = None
if (flags & BasicProperties.FLAG_APP_ID):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.app_id = encoded[offset : offset + length]
offset = offset + length
else:
self.app_id = None
if (flags & BasicProperties.FLAG_CLUSTER_ID):
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
flags = 0
flagword_index = 0
while True:
partial_flags = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
flags = flags | (partial_flags << (flagword_index * 16))
if (partial_flags & 1) == 0: break
flagword_index = flagword_index + 1
if (flags & FileProperties.FLAG_CONTENT_TYPE):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.content_type = None
if (flags & FileProperties.FLAG_CONTENT_ENCODING):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.content_encoding = encoded[offset : offset + length]
offset = offset + length
else:
self.headers = None
if (flags & FileProperties.FLAG_PRIORITY):
self.priority = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
else:
self.priority = None
if (flags & FileProperties.FLAG_REPLY_TO):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.reply_to = None
if (flags & FileProperties.FLAG_MESSAGE_ID):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.message_id = encoded[offset : offset + length]
offset = offset + length
else:
self.message_id = None
if (flags & FileProperties.FLAG_FILENAME):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.filename = None
if (flags & FileProperties.FLAG_TIMESTAMP):
self.timestamp = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
else:
self.timestamp = None
if (flags & FileProperties.FLAG_CLUSTER_ID):
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
flags = 0
flagword_index = 0
while True:
partial_flags = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
flags = flags | (partial_flags << (flagword_index * 16))
if (partial_flags & 1) == 0: break
flagword_index = flagword_index + 1
if (flags & StreamProperties.FLAG_CONTENT_TYPE):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.content_type = None
if (flags & StreamProperties.FLAG_CONTENT_ENCODING):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.content_encoding = encoded[offset : offset + length]
offset = offset + length
else:
self.headers = None
if (flags & StreamProperties.FLAG_PRIORITY):
self.priority = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
else:
self.priority = None
if (flags & StreamProperties.FLAG_TIMESTAMP):
self.timestamp = struct.unpack_from('>Q', encoded, offset)[0]
def decode(self, encoded, offset = 0):
flags = 0
flagword_index = 0
while True:
partial_flags = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
flags = flags | (partial_flags << (flagword_index * 16))
else:
self.headers = None
if (flags & TunnelProperties.FLAG_PROXY_NAME):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.proxy_name = encoded[offset : offset + length]
offset = offset + length
else:
self.proxy_name = None
if (flags & TunnelProperties.FLAG_DATA_NAME):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.data_name = None
if (flags & TunnelProperties.FLAG_DURABLE):
self.durable = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
else:
self.durable = None
if (flags & TunnelProperties.FLAG_BROADCAST):
self.broadcast = struct.unpack_from('B', encoded, offset)[0]
src/p/t/ptak-HEAD/trunk/Modules/Chat/pylchat.py ptak(Download)
def unpack(klass, data, stringNum):
cps = ChatPacketStrings()
cps.strings = []
loop = 0
while(loop < stringNum):
size = struct.calcsize("h") + struct.unpack_from("!h", data, offset = 0)[0] + ChatNull.size;
src/p/i/pika-0.5.2/pika/spec.py pika(Download)
def decode(self, encoded, offset = 0):
self.version_major = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.version_minor = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
(self.server_properties, offset) = pika.table.decode_table(encoded, offset)
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.mechanisms = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('>I', encoded, offset)[0]
def decode(self, encoded, offset = 0):
(self.client_properties, offset) = pika.table.decode_table(encoded, offset)
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.mechanism = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.response = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.challenge = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.response = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
self.channel_max = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.frame_max = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.heartbeat = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
def decode(self, encoded, offset = 0):
self.channel_max = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.frame_max = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.heartbeat = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.virtual_host = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.capabilities = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.known_hosts = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.host = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
self.class_id = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.method_id = struct.unpack_from('>H', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.out_of_band = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.active = (bit_buffer & (1 << 0)) != 0
return self
def encode(self):
def decode(self, encoded, offset = 0):
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.active = (bit_buffer & (1 << 0)) != 0
return self
def encode(self):
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
self.class_id = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.method_id = struct.unpack_from('>H', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.realm = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.type = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
self.message_count = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.consumer_count = struct.unpack_from('>I', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.nowait = (bit_buffer & (1 << 0)) != 0
(self.arguments, offset) = pika.table.decode_table(encoded, offset)
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.message_count = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.message_count = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.prefetch_size = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.prefetch_count = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.redelivered = (bit_buffer & (1 << 0)) != 0
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.redelivered = (bit_buffer & (1 << 0)) != 0
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
self.message_count = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.cluster_id = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.multiple = (bit_buffer & (1 << 0)) != 0
return self
def decode(self, encoded, offset = 0):
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.requeue = (bit_buffer & (1 << 0)) != 0
return self
def decode(self, encoded, offset = 0):
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.requeue = (bit_buffer & (1 << 0)) != 0
return self
def encode(self):
def decode(self, encoded, offset = 0):
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.requeue = (bit_buffer & (1 << 0)) != 0
return self
def encode(self):
def decode(self, encoded, offset = 0):
self.prefetch_size = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.prefetch_count = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.identifier = encoded[offset : offset + length]
offset = offset + length
self.content_size = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
def decode(self, encoded, offset = 0):
self.staged_size = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.mandatory = (bit_buffer & (1 << 0)) != 0
self.immediate = (bit_buffer & (1 << 1)) != 0
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.identifier = encoded[offset : offset + length]
offset = offset + length
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.redelivered = (bit_buffer & (1 << 0)) != 0
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.multiple = (bit_buffer & (1 << 0)) != 0
return self
def decode(self, encoded, offset = 0):
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.requeue = (bit_buffer & (1 << 0)) != 0
return self
def decode(self, encoded, offset = 0):
self.prefetch_size = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.prefetch_count = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.consume_rate = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.queue = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
self.ticket = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.routing_key = encoded[offset : offset + length]
offset = offset + length
bit_buffer = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.reply_code = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_text = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.consumer_tag = encoded[offset : offset + length]
offset = offset + length
self.delivery_tag = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.exchange = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.dtx_identifier = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
self.integer_1 = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.integer_2 = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
self.integer_3 = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.integer_4 = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
self.operation = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
self.result = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.string_1 = encoded[offset : offset + length]
offset = offset + length
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.string_2 = encoded[offset : offset + length]
offset = offset + length
self.operation = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.result = encoded[offset : offset + length]
offset = offset + length
return self
def decode(self, encoded, offset = 0):
(self.table, offset) = pika.table.decode_table(encoded, offset)
self.integer_op = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.string_op = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
return self
def decode(self, encoded, offset = 0):
self.integer_result = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
length = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
self.string_result = encoded[offset : offset + length]
offset = offset + length
def decode(self, encoded, offset = 0):
self.content_checksum = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
return self
def encode(self):
pieces = []
def decode(self, encoded, offset = 0):
flags = 0
flagword_index = 0
while True:
partial_flags = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
flags = flags | (partial_flags << (flagword_index * 16))
if (partial_flags & 1) == 0: break
flagword_index = flagword_index + 1
if (flags & BasicProperties.FLAG_CONTENT_TYPE):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.content_type = None
if (flags & BasicProperties.FLAG_CONTENT_ENCODING):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.content_encoding = encoded[offset : offset + length]
offset = offset + length
else:
self.headers = None
if (flags & BasicProperties.FLAG_DELIVERY_MODE):
self.delivery_mode = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
else:
self.delivery_mode = None
if (flags & BasicProperties.FLAG_PRIORITY):
self.priority = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
else:
self.priority = None
if (flags & BasicProperties.FLAG_CORRELATION_ID):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.correlation_id = None
if (flags & BasicProperties.FLAG_REPLY_TO):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.reply_to = encoded[offset : offset + length]
offset = offset + length
else:
self.reply_to = None
if (flags & BasicProperties.FLAG_EXPIRATION):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.expiration = None
if (flags & BasicProperties.FLAG_MESSAGE_ID):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.message_id = encoded[offset : offset + length]
offset = offset + length
else:
self.message_id = None
if (flags & BasicProperties.FLAG_TIMESTAMP):
self.timestamp = struct.unpack_from('>Q', encoded, offset)[0]
else:
self.timestamp = None
if (flags & BasicProperties.FLAG_TYPE):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.type = encoded[offset : offset + length]
offset = offset + length
else:
self.type = None
if (flags & BasicProperties.FLAG_USER_ID):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.user_id = None
if (flags & BasicProperties.FLAG_APP_ID):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.app_id = encoded[offset : offset + length]
offset = offset + length
else:
self.app_id = None
if (flags & BasicProperties.FLAG_CLUSTER_ID):
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
flags = 0
flagword_index = 0
while True:
partial_flags = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
flags = flags | (partial_flags << (flagword_index * 16))
if (partial_flags & 1) == 0: break
flagword_index = flagword_index + 1
if (flags & FileProperties.FLAG_CONTENT_TYPE):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.content_type = None
if (flags & FileProperties.FLAG_CONTENT_ENCODING):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.content_encoding = encoded[offset : offset + length]
offset = offset + length
else:
self.headers = None
if (flags & FileProperties.FLAG_PRIORITY):
self.priority = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
else:
self.priority = None
if (flags & FileProperties.FLAG_REPLY_TO):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.reply_to = None
if (flags & FileProperties.FLAG_MESSAGE_ID):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.message_id = encoded[offset : offset + length]
offset = offset + length
else:
self.message_id = None
if (flags & FileProperties.FLAG_FILENAME):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.filename = None
if (flags & FileProperties.FLAG_TIMESTAMP):
self.timestamp = struct.unpack_from('>Q', encoded, offset)[0]
offset = offset + 8
else:
self.timestamp = None
if (flags & FileProperties.FLAG_CLUSTER_ID):
length = struct.unpack_from('B', encoded, offset)[0]
def decode(self, encoded, offset = 0):
flags = 0
flagword_index = 0
while True:
partial_flags = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
flags = flags | (partial_flags << (flagword_index * 16))
if (partial_flags & 1) == 0: break
flagword_index = flagword_index + 1
if (flags & StreamProperties.FLAG_CONTENT_TYPE):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.content_type = None
if (flags & StreamProperties.FLAG_CONTENT_ENCODING):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.content_encoding = encoded[offset : offset + length]
offset = offset + length
else:
self.headers = None
if (flags & StreamProperties.FLAG_PRIORITY):
self.priority = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
else:
self.priority = None
if (flags & StreamProperties.FLAG_TIMESTAMP):
self.timestamp = struct.unpack_from('>Q', encoded, offset)[0]
def decode(self, encoded, offset = 0):
flags = 0
flagword_index = 0
while True:
partial_flags = struct.unpack_from('>H', encoded, offset)[0]
offset = offset + 2
flags = flags | (partial_flags << (flagword_index * 16))
else:
self.headers = None
if (flags & TunnelProperties.FLAG_PROXY_NAME):
length = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
self.proxy_name = encoded[offset : offset + length]
offset = offset + length
else:
self.proxy_name = None
if (flags & TunnelProperties.FLAG_DATA_NAME):
length = struct.unpack_from('B', encoded, offset)[0]
else:
self.data_name = None
if (flags & TunnelProperties.FLAG_DURABLE):
self.durable = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
else:
self.durable = None
if (flags & TunnelProperties.FLAG_BROADCAST):
self.broadcast = struct.unpack_from('B', encoded, offset)[0]
src/p/t/ptak-HEAD/Modules/Chat/pylchat.py ptak(Download)
def unpack(klass, data, stringNum):
cps = ChatPacketStrings()
cps.strings = []
loop = 0
while(loop < stringNum):
size = struct.calcsize("h") + struct.unpack_from("!h", data, offset = 0)[0] + ChatNull.size;
src/l/i/libheap-HEAD/libheap.py libheap(Download)
if SIZE_SZ == 4:
(self.prev_size,
self.size) = struct.unpack_from("<II", mem, 0x0)
elif SIZE_SZ == 8:
(self.prev_size,
self.size) = struct.unpack_from("<QQ", mem, 0x0)
real_size = (real_size - SIZE_SZ) / SIZE_SZ
if SIZE_SZ == 4:
self.data = struct.unpack_from("<%dI" % real_size, mem, 0x8)
elif SIZE_SZ == 8:
self.data = struct.unpack_from("<%dQ" %real_size, mem, 0x10)
(self.fd, \
self.bk, \
self.fd_nextsize, \
self.bk_nextsize) = struct.unpack_from("<IIII", mem, 0x8)
elif SIZE_SZ == 8:
(self.fd, \
self.bk, \
self.fd_nextsize, \
self.bk_nextsize) = struct.unpack_from("<QQQQ", mem, 0x10)
if SIZE_SZ == 4:
(self.mutex, \
self.flags) = struct.unpack_from("<II", mem, 0x0)
self.fastbinsY = struct.unpack_from("<10I", mem, 0x8)
(self.top, \
self.last_remainder) = struct.unpack_from("<II", mem, 0x30)
self.bins = struct.unpack_from("<254I", mem, 0x38)
self.binmap = struct.unpack_from("<IIII", mem, 0x430)
(self.next, \
self.system_mem, \
self.max_system_mem) = struct.unpack_from("<III", mem, 0x440)
self.max_system_mem) = struct.unpack_from("<III", mem, 0x440)
elif SIZE_SZ == 8:
(self.mutex, \
self.flags) = struct.unpack_from("<II", mem, 0x0)
self.fastbinsY = struct.unpack_from("<10Q", mem, 0x8)
(self.top, \
self.last_remainder) = struct.unpack_from("<QQ", mem, 0x58)
self.bins = struct.unpack_from("<254Q", mem, 0x68)
self.binmap = struct.unpack_from("<IIII", mem, 0x858)
(self.next, \
self.system_mem, \
self.max_system_mem) = struct.unpack_from("<QQQ", mem, 0x868)
src/p/i/pika-HEAD/pika/table.py pika(Download)
def decode_table(encoded, offset):
result = {}
tablesize = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
limit = offset + tablesize
while offset < limit:
keylen = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
key = encoded[offset : offset + keylen]
offset = offset + keylen
kind = encoded[offset]
offset = offset + 1
if kind == 'S':
length = struct.unpack_from('>I', encoded, offset)[0]
value = encoded[offset : offset + length]
offset = offset + length
elif kind == 'I':
value = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
elif kind == 'D':
decimals = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
raw = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
value = decimal.Decimal(raw) * (decimal.Decimal(10) ** -decimals)
elif kind == 'T':
value = datetime.datetime.utcfromtimestamp(struct.unpack_from('>Q', encoded, offset)[0])
src/p/i/pika-0.5.2/pika/table.py pika(Download)
def decode_table(encoded, offset):
result = {}
tablesize = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
limit = offset + tablesize
while offset < limit:
keylen = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
key = encoded[offset : offset + keylen]
offset = offset + keylen
kind = encoded[offset]
offset = offset + 1
if kind == 'S':
length = struct.unpack_from('>I', encoded, offset)[0]
value = encoded[offset : offset + length]
offset = offset + length
elif kind == 'I':
value = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
elif kind == 'D':
decimals = struct.unpack_from('B', encoded, offset)[0]
offset = offset + 1
raw = struct.unpack_from('>I', encoded, offset)[0]
offset = offset + 4
value = decimal.Decimal(raw) * (decimal.Decimal(10) ** -decimals)
elif kind == 'T':
value = datetime.datetime.utcfromtimestamp(struct.unpack_from('>Q', encoded, offset)[0])
src/h/f/hfst-HEAD/trunk/hfst-optimized-lookup/hfst-optimized-lookup-python/shared.py hfst(Download)
def __init__(self, file):
bytes = file.read(56) # 2 unsigned shorts, 4 unsigned ints and 9 uint-bools
self.number_of_input_symbols = struct.unpack_from("<H", bytes, 0)[0]
self.number_of_symbols = struct.unpack_from("<H", bytes, 2)[0]
self.size_of_transition_index_table = struct.unpack_from("<I", bytes, 4)[0]
self.size_of_transition_target_table = struct.unpack_from("<I", bytes, 8)[0]
self.number_of_states = struct.unpack_from("<I", bytes, 12)[0]
self.number_of_transitions = struct.unpack_from("<I", bytes, 16)[0]
self.weighted = struct.unpack_from("<I", bytes, 20)[0] != 0
self.deterministic = struct.unpack_from("<I", bytes, 24)[0] != 0
self.input_deterministic = struct.unpack_from("<I", bytes, 28)[0] != 0
self.minimized = struct.unpack_from("<I", bytes, 32)[0] != 0
self.cyclic = struct.unpack_from("<I", bytes, 36)[0] != 0
self.has_epsilon_epsilon_transitions = struct.unpack_from("<I", bytes, 40)[0] != 0
self.minimized = struct.unpack_from("<I", bytes, 32)[0] != 0
self.cyclic = struct.unpack_from("<I", bytes, 36)[0] != 0
self.has_epsilon_epsilon_transitions = struct.unpack_from("<I", bytes, 40)[0] != 0
self.has_input_epsilon_transitions = struct.unpack_from("<I", bytes, 44)[0] != 0
self.has_input_epsilon_cycles = struct.unpack_from("<I", bytes, 48)[0] != 0
self.has_unweighted_input_epsilon_cycles = struct.unpack_from("<I", bytes, 52)[0] != 0
src/p/e/pendrell-0.3.3/lib/decoders.py pendrell(Download)
from codecs import getincrementaldecoder as _getincrementaldecoder from struct import calcsize, unpack, unpack_from, error as UnpackError import gzip, zlib from twisted.python import log, urlpath, util from pendrell import log
def _decodeHeaderPreamble(buffer):
fmt = ">HBBIBB"
bytes = calcsize(fmt)
preamble = unpack_from(fmt, buffer, 0)
return preamble, bytes
@staticmethod
def _decodeHeaderExtra(buffer):
# Read & discard the extra field, if present
# xlen is stored little-endian
bytes = 0
xlen = unpack_from(">H", buffer, extraLen)
def _decodeHeaderExtra(buffer):
# Read & discard the extra field, if present
# xlen is stored little-endian
bytes = 0
xlen = unpack_from(">H", buffer, extraLen)
bytes += 2
extra = unpack_from("%ds" % xlen, buffer, extraLen)
def _decodeHeaderStringy(buffer):
EOS = "\000"
stringy = str()
length = 0
char = None
while char != EOS:
char = unpack_from("c", buffer, length)
src/h/f/hfst-HEAD/hfst-optimized-lookup/hfst-optimized-lookup-python/shared.py hfst(Download)
def __init__(self, file):
bytes = file.read(56) # 2 unsigned shorts, 4 unsigned ints and 9 uint-bools
self.number_of_input_symbols = struct.unpack_from("<H", bytes, 0)[0]
self.number_of_symbols = struct.unpack_from("<H", bytes, 2)[0]
self.size_of_transition_index_table = struct.unpack_from("<I", bytes, 4)[0]
self.size_of_transition_target_table = struct.unpack_from("<I", bytes, 8)[0]
self.number_of_states = struct.unpack_from("<I", bytes, 12)[0]
self.number_of_transitions = struct.unpack_from("<I", bytes, 16)[0]
self.weighted = struct.unpack_from("<I", bytes, 20)[0] != 0
self.deterministic = struct.unpack_from("<I", bytes, 24)[0] != 0
self.input_deterministic = struct.unpack_from("<I", bytes, 28)[0] != 0
self.minimized = struct.unpack_from("<I", bytes, 32)[0] != 0
self.cyclic = struct.unpack_from("<I", bytes, 36)[0] != 0
self.has_epsilon_epsilon_transitions = struct.unpack_from("<I", bytes, 40)[0] != 0
self.minimized = struct.unpack_from("<I", bytes, 32)[0] != 0
self.cyclic = struct.unpack_from("<I", bytes, 36)[0] != 0
self.has_epsilon_epsilon_transitions = struct.unpack_from("<I", bytes, 40)[0] != 0
self.has_input_epsilon_transitions = struct.unpack_from("<I", bytes, 44)[0] != 0
self.has_input_epsilon_cycles = struct.unpack_from("<I", bytes, 48)[0] != 0
self.has_unweighted_input_epsilon_cycles = struct.unpack_from("<I", bytes, 52)[0] != 0
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next