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

Function add_extra_methods_hook

test-data/unit/plugins/add_classmethod.py:18–26  ·  view source on GitHub ↗
(ctx: ClassDefContext)

Source from the content-addressed store, hash-verified

16
17
18def add_extra_methods_hook(ctx: ClassDefContext) -> None:
19 add_method(ctx, "foo_classmethod", [], NoneType(), is_classmethod=True)
20 add_method(
21 ctx,
22 "foo_staticmethod",
23 [Argument(Var(""), ctx.api.named_type("builtins.int"), None, ARG_POS)],
24 ctx.api.named_type("builtins.str"),
25 is_staticmethod=True,
26 )
27
28
29def plugin(version: str) -> type[ClassMethodPlugin]:

Callers

nothing calls this directly

Calls 5

add_methodFunction · 0.90
NoneTypeClass · 0.90
ArgumentClass · 0.90
VarClass · 0.90
named_typeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…