(value: Any)
| 41 | |
| 42 | |
| 43 | def _json_loads(value: Any) -> Dict[str, Any]: |
| 44 | if isinstance(value, dict): |
| 45 | return value |
| 46 | if not value: |
| 47 | return {} |
| 48 | if isinstance(value, str): |
| 49 | try: |
| 50 | parsed = json.loads(value) |
| 51 | except json.JSONDecodeError: |
| 52 | return {} |
| 53 | return parsed if isinstance(parsed, dict) else {} |
| 54 | return {} |
| 55 | |
| 56 | |
| 57 | def _slug(value: str, *, max_len: int = 96) -> str: |
no outgoing calls
no test coverage detected