MCPcopy Create free account
hub / github.com/ipython/traitlets / mypy_decorator_typing

Function mypy_decorator_typing

tests/test_typing.py:45–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43
44@pytest.mark.mypy_testing
45def mypy_decorator_typing() -> None:
46 class T(HasTraits):
47 foo = Unicode("").tag(config=True)
48
49 @default("foo")
50 def _default_foo(self) -> str:
51 return "hi"
52
53 @observe("foo")
54 def _foo_observer(self, change: t.Any) -> bool:
55 return True
56
57 @validate("foo")
58 def _foo_validate(self, commit: t.Any) -> bool:
59 return True
60
61 t = T()
62 reveal_type(t.foo) # R: builtins.str
63 reveal_type(t._foo_observer) # R: Any
64 reveal_type(t._foo_validate) # R: Any
65
66
67@pytest.mark.mypy_testing

Callers

nothing calls this directly

Calls 2

TClass · 0.85
reveal_typeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…