MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / default

Method default

src/anthropic/_utils/_json.py:62–75  ·  view source on GitHub ↗
(self, o: Any)

Source from the content-addressed store, hash-verified

60class _CustomEncoder(json.JSONEncoder):
61 @override
62 def default(self, o: Any) -> Any:
63 if isinstance(o, (datetime, date)):
64 return o.isoformat()
65
66 if isinstance(o, pydantic.BaseModel):
67 return openapi_model_dump(o)
68
69 if is_mapping(o):
70 return dict(o)
71
72 if is_sent_as_list(o):
73 return list(o)
74
75 return super().default(o)
76
77
78encoder = _CustomEncoder(ensure_ascii=False, separators=(",", ":"), allow_nan=False)

Callers 1

load_default_credentialsFunction · 0.80

Calls 3

openapi_model_dumpFunction · 0.85
is_mappingFunction · 0.85
is_sent_as_listFunction · 0.85

Tested by

no test coverage detected