(data: Any)
| 75 | |
| 76 | |
| 77 | def _coerce_bytes(data: Any) -> bytes: |
| 78 | if isinstance(data, bytes): |
| 79 | return data |
| 80 | if isinstance(data, bytearray): |
| 81 | return bytes(data) |
| 82 | if isinstance(data, memoryview): |
| 83 | return data.tobytes() |
| 84 | tobytes = getattr(data, "tobytes", None) |
| 85 | if callable(tobytes): |
| 86 | return tobytes() |
| 87 | return bytes(data) |
| 88 | |
| 89 | |
| 90 | def _pack_buffer(self: Any, builder: Any) -> int: |
no outgoing calls
no test coverage detected