MCPcopy
hub / github.com/arc53/DocsGPT / parse

Method parse

application/storage/db/source_config.py:177–197  ·  view source on GitHub ↗

Lenient read: return all-defaults for ``{}``/``None``. Falls back to classic defaults when ``raw`` is empty or cannot be validated, so legacy/bad rows never break the read path (D7). Partial dicts are merged onto the defaults. Args: raw: The stored ``sou

(cls, raw: Optional[dict])

Source from the content-addressed store, hash-verified

175
176 @classmethod
177 def parse(cls, raw: Optional[dict]) -> "SourceConfig":
178 """Lenient read: return all-defaults for ``{}``/``None``.
179
180 Falls back to classic defaults when ``raw`` is empty or cannot be
181 validated, so legacy/bad rows never break the read path (D7).
182 Partial dicts are merged onto the defaults.
183
184 Args:
185 raw: The stored ``sources.config`` value (or ``None``).
186
187 Returns:
188 A fully populated ``SourceConfig``.
189 """
190 if not raw:
191 return cls()
192 if not isinstance(raw, dict):
193 return cls()
194 try:
195 return cls.model_validate(raw)
196 except Exception:
197 return cls()

Callers 15

store.tsFile · 0.80
AppFunction · 0.80
loadDismissedFunction · 0.80
ToolApprovalToastFunction · 0.80
TeamNotificationToastFunction · 0.80
renderDiagramFunction · 0.80
MessageInputFunction · 0.80
terminalFromSseFunction · 0.80
resolveDisplayNameFunction · 0.80
TreeBrowserFunction · 0.80
decodeJwtPayloadFunction · 0.80

Calls

no outgoing calls