MCPcopy
hub / github.com/mitmproxy/mitmproxy / typename

Function typename

mitmproxy/command.py:33–44  ·  view source on GitHub ↗

Translates a type to an explanatory string.

(t: type)

Source from the content-addressed store, hash-verified

31
32
33def 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
47def _empty_as_none(x: Any) -> Any:

Callers 1

signature_helpMethod · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…