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

Method length_error

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

Source from the content-addressed store, hash-verified

3630 super().__init__(trait=trait, default_value=default_value, **kwargs)
3631
3632 def length_error(self, obj: t.Any, value: t.Any) -> None:
3633 e = (
3634 "The '%s' trait of %s instance must be of length %i <= L <= %i, but a value of %s was specified."
3635 % (self.name, class_of(obj), self._minlen, self._maxlen, value)
3636 )
3637 raise TraitError(e)
3638
3639 def validate_elements(self, obj: t.Any, value: t.Any) -> t.Any:
3640 length = len(value)

Callers 1

validate_elementsMethod · 0.95

Calls 2

class_ofFunction · 0.85
TraitErrorClass · 0.85

Tested by

no test coverage detected