MCPcopy
hub / github.com/jazzband/django-constance / default

Method default

constance/codecs.py:23–27  ·  view source on GitHub ↗
(self, o)

Source from the content-addressed store, hash-verified

21 """Django-constance custom json encoder."""
22
23 def default(self, o):
24 for discriminator, (t, _, encoder) in _codecs.items():
25 if isinstance(o, t):
26 return _as(discriminator, encoder(o))
27 raise TypeError(f"Object of type {o.__class__.__name__} is not JSON serializable")
28
29
30def _as(discriminator: str, v: Any) -> dict[str, Any]:

Callers

nothing calls this directly

Calls 1

_asFunction · 0.85

Tested by

no test coverage detected