MCPcopy Create free account
hub / github.com/ai4ce/RAP / read_next_bytes

Function read_next_bytes

utils/read_write_model.py:78–87  ·  view source on GitHub ↗

Read and unpack the next bytes from a binary file. :param fid: :param num_bytes: Sum of combination of {2, 4, 8}, e.g. 2, 6, 16, 30, etc. :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}. :param endian_character: Any of {@, =, <, >, !} :return: Tuple of r

(fid, num_bytes, format_char_sequence, endian_character="<")

Source from the content-addressed store, hash-verified

76
77
78def read_next_bytes(fid, num_bytes, format_char_sequence, endian_character="<"):
79 """Read and unpack the next bytes from a binary file.
80 :param fid:
81 :param num_bytes: Sum of combination of {2, 4, 8}, e.g. 2, 6, 16, 30, etc.
82 :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}.
83 :param endian_character: Any of {@, =, <, >, !}
84 :return: Tuple of read and unpacked values.
85 """
86 data = fid.read(num_bytes)
87 return struct.unpack(endian_character + format_char_sequence, data)
88
89
90def write_next_bytes(fid, data, format_char_sequence, endian_character="<"):

Callers 3

read_cameras_binaryFunction · 0.70
read_images_binaryFunction · 0.70
read_points3D_binaryFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected