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

Function mypy_set_typing

tests/test_typing.py:250–282  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

248
249@pytest.mark.mypy_testing
250def mypy_set_typing() -> None:
251 class T(HasTraits):
252 remove_cell_tags = Set(
253 Unicode(),
254 default_value=[],
255 help=(
256 "Tags indicating which cells are to be removed,"
257 "matches tags in ``cell.metadata.tags``."
258 ),
259 ).tag(config=True)
260
261 safe_output_keys = Set(
262 config=True,
263 default_value={
264 "metadata", # Not a mimetype per-se, but expected and safe.
265 "text/plain",
266 "text/latex",
267 "application/json",
268 "image/png",
269 "image/jpeg",
270 },
271 help="Cell output mimetypes to render without modification",
272 )
273
274 t = T()
275 reveal_type(Set("foo")) # R: traitlets.traitlets.Set
276 reveal_type(Set("").tag(sync=True)) # R: traitlets.traitlets.Set
277 reveal_type(Set(None, allow_none=True)) # R: traitlets.traitlets.Set
278 reveal_type(Set(None, allow_none=True).tag(sync=True)) # R: traitlets.traitlets.Set
279 reveal_type(T.remove_cell_tags) # R: traitlets.traitlets.Set
280 reveal_type(t.remove_cell_tags) # R: builtins.set[Any]
281 reveal_type(T.safe_output_keys) # R: traitlets.traitlets.Set
282 reveal_type(t.safe_output_keys) # R: builtins.set[Any]
283
284
285@pytest.mark.mypy_testing

Callers

nothing calls this directly

Calls 4

SetClass · 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…