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

Function write_next_bytes

utils/read_write_model.py:90–103  ·  view source on GitHub ↗

pack and write to a binary file. :param fid: :param data: data to send, if multiple elements are sent at the same time, they should be encapsuled either in a list or a tuple :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}. should be the same length as th

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

Source from the content-addressed store, hash-verified

88
89
90def write_next_bytes(fid, data, format_char_sequence, endian_character="<"):
91 """pack and write to a binary file.
92 :param fid:
93 :param data: data to send, if multiple elements are sent at the same time,
94 they should be encapsuled either in a list or a tuple
95 :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}.
96 should be the same length as the data list or tuple
97 :param endian_character: Any of {@, =, <, >, !}
98 """
99 if isinstance(data, (list, tuple)):
100 bytes = struct.pack(endian_character + format_char_sequence, *data)
101 else:
102 bytes = struct.pack(endian_character + format_char_sequence, data)
103 fid.write(bytes)
104
105
106def read_cameras_text(path):

Callers 3

write_cameras_binaryFunction · 0.85
write_images_binaryFunction · 0.85
write_points3D_binaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected