Translates a type to an explanatory string.
(t: type)
| 31 | |
| 32 | |
| 33 | def typename(t: type) -> str: |
| 34 | """ |
| 35 | Translates a type to an explanatory string. |
| 36 | """ |
| 37 | if t == inspect._empty: # type: ignore |
| 38 | raise exceptions.CommandError("missing type annotation") |
| 39 | to = mitmproxy.types.CommandTypes.get(t, None) |
| 40 | if not to: |
| 41 | raise exceptions.CommandError( |
| 42 | "unsupported type: %s" % getattr(t, "__name__", t) |
| 43 | ) |
| 44 | return to.display |
| 45 | |
| 46 | |
| 47 | def _empty_as_none(x: Any) -> Any: |
no test coverage detected
searching dependent graphs…