MCPcopy Create free account
hub / github.com/nat/openplayground / default

Method default

server/lib/entities.py:110–122  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

108 super().__init__(*args, **kwargs)
109
110 def default(self, obj):
111 if isinstance(obj, Provider):
112 models = [{
113 "name": model.name, "capabilities": model.capabilities,
114 "enabled": model.enabled, "provider": model.provider,
115 "status": model.status, "parameters": model.parameters
116 } for model in obj.models]
117
118 if not self.serialize_models_as_list:
119 models = dict(zip([model["name"] for model in models], models))
120
121 return {self.to_camel_case(k): v for k, v in obj.__dict__.items() if k not in {'models', 'event_emitter'}} | {'models': models}
122 return super().default(obj)
123
124 @staticmethod
125 def to_camel_case(snake_str):

Callers

nothing calls this directly

Calls 2

to_camel_caseMethod · 0.95
defaultMethod · 0.45

Tested by

no test coverage detected