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

Method element_error

traitlets/traitlets.py:4003–4010  ·  view source on GitHub ↗
(
        self, obj: t.Any, element: t.Any, validator: t.Any, side: str = "Values"
    )

Source from the content-addressed store, hash-verified

4001 super().__init__(klass=dict, args=args, **kwargs)
4002
4003 def element_error(
4004 self, obj: t.Any, element: t.Any, validator: t.Any, side: str = "Values"
4005 ) -> None:
4006 e = (
4007 side
4008 + f" of the '{self.name}' trait of {class_of(obj)} instance must be {validator.info()}, but a value of {repr_type(element)} was specified."
4009 )
4010 raise TraitError(e)
4011
4012 def validate(self, obj: t.Any, value: t.Any) -> dict[K, V] | None:
4013 value = super().validate(obj, value)

Callers 1

validate_elementsMethod · 0.95

Calls 4

class_ofFunction · 0.85
repr_typeFunction · 0.85
TraitErrorClass · 0.85
infoMethod · 0.45

Tested by

no test coverage detected