MCPcopy
hub / github.com/python/mypy / short_type

Function short_type

mypy/util.py:114–122  ·  view source on GitHub ↗

Return the last component of the type name of an object. If obj is None, return 'nil'. For example, if obj is 1, return 'int'.

(obj: object)

Source from the content-addressed store, hash-verified

112
113
114def short_type(obj: object) -> str:
115 """Return the last component of the type name of an object.
116
117 If obj is None, return 'nil'. For example, if obj is 1, return 'int'.
118 """
119 if obj is None:
120 return "nil"
121 t = str(type(obj))
122 return t.split(".")[-1].rstrip("'>")
123
124
125def find_python_encoding(text: bytes) -> tuple[str, int]:

Callers 5

dumpMethod · 0.90
visit_name_exprMethod · 0.90
__str__Method · 0.90
dump_typesMethod · 0.90
run_caseMethod · 0.90

Calls 4

strClass · 0.85
typeClass · 0.85
rstripMethod · 0.80
splitMethod · 0.80

Tested by 2

dump_typesMethod · 0.72
run_caseMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…