Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _read_packet_length(content, content_index):
while get_byte(content, content_index) not in [0, 1]:
content_index += 1
content_index += 1
packet_length_string = ""
byte = get_byte(content, content_index)
while byte != 255:
packet_length_string += str(byte)
content_index += 1
byte = get_byte(content, content_index)
return content_index, int(packet_length_string)
def _read_packet_text(content, content_index, packet_length):
while get_byte(content, content_index) == 255:
content_index += 1
packet_text = content[content_index : content_index + packet_length]
return content_index + packet_length, packet_text
def _read_packet_length(content, content_index):
while get_byte(content, content_index) not in [0, 1]:
content_index += 1
content_index += 1
packet_length_string = ""
byte = get_byte(content, content_index)
while byte != 255:
packet_length_string += str(byte)
content_index += 1
byte = get_byte(content, content_index)
return content_index, int(packet_length_string)