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

Function _validate_link

traitlets/traitlets.py:261–272  ·  view source on GitHub ↗

Validate arguments for traitlet link functions

(*tuples: t.Any)

Source from the content-addressed store, hash-verified

259
260
261def _validate_link(*tuples: t.Any) -> None:
262 """Validate arguments for traitlet link functions"""
263 for tup in tuples:
264 if not len(tup) == 2:
265 raise TypeError(
266 "Each linked traitlet must be specified as (HasTraits, 'trait_name'), not %r" % t
267 )
268 obj, trait_name = tup
269 if not isinstance(obj, HasTraits):
270 raise TypeError("Each object must be HasTraits, not %r" % type(obj))
271 if trait_name not in obj.traits():
272 raise TypeError(f"{obj!r} has no trait {trait_name!r}")
273
274
275class link:

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls 1

traitsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…