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

Function mypy_list_typing

tests/test_typing.py:96–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94
95@pytest.mark.mypy_testing
96def mypy_list_typing() -> None:
97 class T(HasTraits):
98 latex_command = List(
99 ["xelatex", "{filename}", "-quiet"], help="Shell command used to compile latex."
100 ).tag(config=True)
101
102 t = T()
103 reveal_type(List(["foo"])) # R: traitlets.traitlets.List[builtins.str]
104 reveal_type(List([""]).tag(sync=True)) # R: traitlets.traitlets.List[builtins.str]
105 reveal_type(List(None, allow_none=True)) # R: traitlets.traitlets.List[Never]
106 reveal_type(
107 List(None, allow_none=True).tag(sync=True) # R: traitlets.traitlets.List[Never]
108 )
109 reveal_type(T.latex_command) # R: traitlets.traitlets.List[builtins.str]
110 reveal_type(t.latex_command) # R: builtins.list[builtins.str]
111
112
113@pytest.mark.mypy_testing

Callers

nothing calls this directly

Calls 4

ListClass · 0.90
TClass · 0.85
reveal_typeFunction · 0.85
tagMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…