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

Method validate

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

Source from the content-addressed store, hash-verified

2455 # to opt out of instance_init
2456
2457 def validate(self, obj: t.Any, value: t.Any) -> t.Any:
2458 with obj.cross_validation_lock:
2459 for trait_type in self.trait_types:
2460 try:
2461 v = trait_type._validate(obj, value)
2462 # In the case of an element trait, the name is None
2463 if self.name is not None:
2464 setattr(obj, "_" + self.name + "_metadata", trait_type.metadata)
2465 return v
2466 except TraitError:
2467 continue
2468 self.error(obj, value)
2469
2470 def __or__(self, other: t.Any) -> Union:
2471 if isinstance(other, Union):

Callers

nothing calls this directly

Calls 2

_validateMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected