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

Method validate

traitlets/traitlets.py:2391–2399  ·  view source on GitHub ↗
(self, obj: t.Any, value: t.Any)

Source from the content-addressed store, hash-verified

2389 super().__init__(None, **kwargs)
2390
2391 def validate(self, obj: t.Any, value: t.Any) -> HasTraits | None:
2392 # What if value is a superclass of obj.__class__? This is
2393 # complicated if it was the superclass that defined the This
2394 # trait.
2395 assert self.this_class is not None
2396 if isinstance(value, self.this_class) or (value is None):
2397 return value
2398 else:
2399 self.error(obj, value)
2400
2401
2402class Union(TraitType[t.Any, t.Any]):

Callers

nothing calls this directly

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected