Load value from a single string
(self, s: str)
| 4062 | # to opt out of instance_init |
| 4063 | |
| 4064 | def from_string(self, s: str) -> dict[K, V] | None: |
| 4065 | """Load value from a single string""" |
| 4066 | if not isinstance(s, str): |
| 4067 | raise TypeError(f"from_string expects a string, got {s!r} of type {type(s)}") |
| 4068 | try: |
| 4069 | return self.from_string_list([s]) # type:ignore[no-any-return] |
| 4070 | except Exception: |
| 4071 | test = _safe_literal_eval(s) |
| 4072 | if isinstance(test, dict): |
| 4073 | return test |
| 4074 | raise |
| 4075 | |
| 4076 | def from_string_list(self, s_list: list[str]) -> t.Any: |
| 4077 | """Return a dict from a list of config strings. |
nothing calls this directly
no test coverage detected