Resolve raw and parsed options for an integration operation.
(
integration: Any,
state: dict[str, Any],
key: str,
raw_options: str | None,
*,
parse_options: ParseOptions,
)
| 12 | |
| 13 | |
| 14 | def resolve_integration_options( |
| 15 | integration: Any, |
| 16 | state: dict[str, Any], |
| 17 | key: str, |
| 18 | raw_options: str | None, |
| 19 | *, |
| 20 | parse_options: ParseOptions, |
| 21 | ) -> tuple[str | None, dict[str, Any] | None]: |
| 22 | """Resolve raw and parsed options for an integration operation.""" |
| 23 | if raw_options is not None: |
| 24 | return raw_options, parse_options(integration, raw_options) |
| 25 | |
| 26 | setting = integration_setting(state, key) |
| 27 | stored_raw = setting.get("raw_options") |
| 28 | if not isinstance(stored_raw, str): |
| 29 | stored_raw = None |
| 30 | |
| 31 | stored_parsed = setting.get("parsed_options") |
| 32 | if isinstance(stored_parsed, dict): |
| 33 | return stored_raw, stored_parsed or None |
| 34 | |
| 35 | if stored_raw: |
| 36 | return stored_raw, parse_options(integration, stored_raw) |
| 37 | |
| 38 | return None, None |
| 39 | |
| 40 | |
| 41 | def with_integration_setting( |
nothing calls this directly
no test coverage detected