(value: Any)
| 98 | |
| 99 | |
| 100 | def primitive_to_bytes(value: Any) -> bytes: |
| 101 | if value is None: |
| 102 | return b":none" |
| 103 | if isinstance(value, str): |
| 104 | return type_sign(bytes(f"{value}", "utf-8"), "str") |
| 105 | if isinstance(value, float): |
| 106 | return type_sign(struct.pack("d", value), "float") |
| 107 | if isinstance(value, int): |
| 108 | return type_sign(struct.pack("q", value), "int") |
| 109 | if isinstance(value, tuple): |
| 110 | return iterable_sign(map(primitive_to_bytes, value), "tuple") |
| 111 | return type_sign(bytes(value), "bytes") |
| 112 | |
| 113 | |
| 114 | def common_container_to_bytes(value: Any) -> bytes: |
no test coverage detected
searching dependent graphs…