(s, structure_name)
| 34 | |
| 35 | |
| 36 | def ensure_dict(s, structure_name): |
| 37 | if not isinstance(s, dict): |
| 38 | try: |
| 39 | s = json_loads(to_unicode(s)) |
| 40 | except (ValueError, TypeError) as exc: |
| 41 | raise DecodeError(f"Invalid {structure_name}") from exc |
| 42 | |
| 43 | if not isinstance(s, dict): |
| 44 | raise DecodeError(f"Invalid {structure_name}") |
| 45 | |
| 46 | return s |
no test coverage detected
searching dependent graphs…