(obj: Any)
| 71 | |
| 72 | |
| 73 | def to_jsonable(obj: Any) -> Any: |
| 74 | if hasattr(obj, "__dict__"): |
| 75 | return obj.__dict__ |
| 76 | elif hasattr(obj, "__slots__"): |
| 77 | ret = {} # type: Any |
| 78 | for slot in obj.__slots__: |
| 79 | val = getattr(obj, slot, None) |
| 80 | if slot in HASH_INTS and isinstance(val, int): |
| 81 | ret[slot] = ser_uint256(val).hex() |
| 82 | elif slot in HASH_INT_VECTORS and isinstance(val[0], int): |
| 83 | ret[slot] = [ser_uint256(a).hex() for a in val] |
| 84 | else: |
| 85 | ret[slot] = to_jsonable(val) |
| 86 | return ret |
| 87 | elif isinstance(obj, list): |
| 88 | return [to_jsonable(a) for a in obj] |
| 89 | elif isinstance(obj, bytes): |
| 90 | return obj.hex() |
| 91 | else: |
| 92 | return obj |
| 93 | |
| 94 | |
| 95 | def process_file(path: str, messages: List[Any], recv: bool, progress_bar: Optional[ProgressBar]) -> None: |
no test coverage detected