MCPcopy Index your code
hub / github.com/python/mypy / pretty_class_or_static_decorator

Function pretty_class_or_static_decorator

mypy/messages.py:3031–3039  ·  view source on GitHub ↗

Return @classmethod or @staticmethod, if any, for the given callable type.

(tp: CallableType)

Source from the content-addressed store, hash-verified

3029
3030
3031def pretty_class_or_static_decorator(tp: CallableType) -> str | None:
3032 """Return @classmethod or @staticmethod, if any, for the given callable type."""
3033 definition = get_func_def(tp)
3034 if definition is not None and isinstance(definition, SYMBOL_FUNCBASE_TYPES):
3035 if definition.is_class:
3036 return "@classmethod"
3037 if definition.is_static:
3038 return "@staticmethod"
3039 return None
3040
3041
3042def pretty_callable(tp: CallableType, options: Options, skip_self: bool = False) -> str:

Callers 2

pretty_overloadMethod · 0.85

Calls 2

get_func_defFunction · 0.90
isinstanceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…