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="<")
| 318 | |
| 319 | |
| 320 | def write_next_bytes(fid, data, format_char_sequence, endian_character="<"): |
| 321 | """pack and write to a binary file. |
| 322 | :param fid: |
| 323 | :param data: data to send, if multiple elements are sent at the same time, |
| 324 | they should be encapsuled either in a list or a tuple |
| 325 | :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}. |
| 326 | should be the same length as the data list or tuple |
| 327 | :param endian_character: Any of {@, =, <, >, !} |
| 328 | """ |
| 329 | if isinstance(data, (list, tuple)): |
| 330 | bytes = struct.pack(endian_character + format_char_sequence, *data) |
| 331 | else: |
| 332 | bytes = struct.pack(endian_character + format_char_sequence, data) |
| 333 | fid.write(bytes) |
| 334 | |
| 335 | |
| 336 | def write_cameras_binary(cameras, path_to_model_file): |
no test coverage detected