(etdump_flatbuffer: bytes, size_prefixed: bool = True)
| 61 | |
| 62 | |
| 63 | def _convert_from_flatcc(etdump_flatbuffer: bytes, size_prefixed: bool = True) -> bytes: |
| 64 | with tempfile.TemporaryDirectory() as d: |
| 65 | _write_schema(d, ETDUMP_FLATCC_SCHEMA_NAME) |
| 66 | _write_schema(d, SCALAR_TYPE_SCHEMA_NAME) |
| 67 | |
| 68 | schema_path = os.path.join(d, "{}.fbs".format(ETDUMP_FLATCC_SCHEMA_NAME)) |
| 69 | bin_path = os.path.join(d, "schema.bin") |
| 70 | with open(bin_path, "wb") as bin_file: |
| 71 | bin_file.write(etdump_flatbuffer) |
| 72 | additional_args = [] |
| 73 | if size_prefixed: |
| 74 | additional_args = ["--size-prefixed"] |
| 75 | _flatc_decompile(d, schema_path, bin_path, additional_args) |
| 76 | output_path = os.path.join(d, "schema.json") |
| 77 | with open(output_path, "rb") as output_file: |
| 78 | return output_file.read() |
| 79 | |
| 80 | |
| 81 | def serialize_to_etdump_flatcc( |
no test coverage detected