MCPcopy Create free account
hub / github.com/astral-sh/ruff / default

Method default

python/ruff-ecosystem/ruff_ecosystem/main.py:157–168  ·  view source on GitHub ↗
(self, o: object)

Source from the content-addressed store, hash-verified

155
156class JSONEncoder(json.JSONEncoder):
157 def default(self, o: object):
158 if isinstance(o, Serializable):
159 return o.jsonable()
160 if dataclasses.is_dataclass(o):
161 return dataclasses.asdict(o)
162 if isinstance(o, set):
163 return tuple(o)
164 if isinstance(o, Path):
165 return str(o)
166 if isinstance(o, Exception):
167 return str(o)
168 return super().default(o)

Callers 1

startPlaygroundFunction · 0.45

Calls 3

isinstanceFunction · 0.85
strFunction · 0.50
jsonableMethod · 0.45

Tested by

no test coverage detected