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

Function mypy_unicode_typing

tests/test_typing.py:177–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

175
176@pytest.mark.mypy_testing
177def mypy_unicode_typing() -> None:
178 class T(HasTraits):
179 export_format = Unicode(
180 allow_none=False,
181 help="""The export format to be used, either one of the built-in formats
182 or a dotted object name that represents the import path for an
183 ``Exporter`` class""",
184 ).tag(config=True)
185
186 t = T()
187 reveal_type(
188 Unicode( # R: traitlets.traitlets.Unicode[builtins.str, builtins.str | builtins.bytes]
189 "foo"
190 )
191 )
192 reveal_type(
193 Unicode( # R: traitlets.traitlets.Unicode[builtins.str, builtins.str | builtins.bytes]
194 ""
195 ).tag(sync=True)
196 )
197 reveal_type(
198 Unicode( # R: traitlets.traitlets.Unicode[builtins.str | None, builtins.str | builtins.bytes | None]
199 None, allow_none=True
200 )
201 )
202 reveal_type(
203 Unicode( # R: traitlets.traitlets.Unicode[builtins.str | None, builtins.str | builtins.bytes | None]
204 None, allow_none=True
205 ).tag(sync=True)
206 )
207 reveal_type(
208 T.export_format # R: traitlets.traitlets.Unicode[builtins.str, builtins.str | builtins.bytes]
209 )
210 reveal_type(t.export_format) # R: builtins.str
211
212
213@pytest.mark.mypy_testing

Callers

nothing calls this directly

Calls 4

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