| 265 | assert isinstance(lowered_module_arg.target, str) |
| 266 | |
| 267 | def serialize_bytes(b: bytes) -> str: |
| 268 | # We want to serialize the bytes to string because JSON cannot |
| 269 | # serialize bytes. |
| 270 | # Since the given bytes may be serialized with any encoding, so we |
| 271 | # want to first encode with base64, and then decode it with |
| 272 | # ascii. During deserialization we can just directly decode with b64 |
| 273 | # to get the original encoded bytes. |
| 274 | return base64.b64encode(b).decode("ascii") |
| 275 | |
| 276 | lowered_module = getattr( |
| 277 | lowered_module_arg.graph.owning_module, lowered_module_arg.target |