(value: Any)
| 17 | |
| 18 | |
| 19 | def _normalize_list(value: Any) -> List[str]: |
| 20 | if value is None: |
| 21 | return [] |
| 22 | if isinstance(value, str): |
| 23 | text = value.strip() |
| 24 | if not text: |
| 25 | return [] |
| 26 | if text.startswith("["): |
| 27 | try: |
| 28 | parsed = json.loads(text) |
| 29 | except json.JSONDecodeError: |
| 30 | parsed = None |
| 31 | if isinstance(parsed, list): |
| 32 | return [str(item).strip() for item in parsed if str(item).strip()] |
| 33 | return [text] |
| 34 | if isinstance(value, dict): |
| 35 | return [str(item).strip() for item in value.values() if str(item).strip()] |
| 36 | if isinstance(value, Iterable): |
| 37 | return [str(item).strip() for item in value if str(item).strip()] |
| 38 | text = str(value).strip() |
| 39 | return [text] if text else [] |
| 40 | |
| 41 | |
| 42 | def _slug(value: str, max_len: int = 80) -> str: |
no outgoing calls
no test coverage detected