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])
| 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() |
no outgoing calls