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

Function set_callable_name

mypy/semanal_shared.py:262–275  ·  view source on GitHub ↗
(sig: Type, fdef: FuncDef)

Source from the content-addressed store, hash-verified

260
261
262def set_callable_name(sig: Type, fdef: FuncDef) -> ProperType:
263 sig = get_proper_type(sig)
264 if isinstance(sig, FunctionLike):
265 if fdef.info:
266 if fdef.info.fullname in TPDICT_FB_NAMES:
267 # Avoid exposing the internal _TypedDict name.
268 class_name = "TypedDict"
269 else:
270 class_name = fdef.info.name
271 return sig.with_name(f"{fdef.name} of {class_name}")
272 else:
273 return sig.with_name(fdef.name)
274 else:
275 return sig
276
277
278def calculate_tuple_fallback(typ: TupleType) -> None:

Callers 6

visit_decorator_innerMethod · 0.90
analyze_func_defMethod · 0.90
add_methodMethod · 0.90
_add_bool_dunderMethod · 0.90
_add_method_by_specFunction · 0.90

Calls 3

get_proper_typeFunction · 0.90
isinstanceFunction · 0.85
with_nameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…