(obj)
| 133 | |
| 134 | |
| 135 | def json_encoder(obj): |
| 136 | from .analyzers.python.nodes import ASTNode |
| 137 | |
| 138 | if type(obj) in (set, tuple): |
| 139 | return list(obj) |
| 140 | elif isinstance(obj, Path): |
| 141 | return os.fspath(obj.absolute()) |
| 142 | elif isinstance(obj, ASTNode): |
| 143 | return obj.json |
| 144 | elif type(obj) == bytes: |
| 145 | return obj.decode("utf-8") |
| 146 | elif dataclasses.is_dataclass(obj): |
| 147 | if hasattr(obj, "_asdict"): |
| 148 | return obj._asdict() |
| 149 | else: |
| 150 | return dataclasses.asdict(obj) |
| 151 | |
| 152 | |
| 153 | def lookup_lines( |