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

Method item_from_string

traitlets/traitlets.py:3811–3820  ·  view source on GitHub ↗

Cast a single item from a string Evaluated when parsing CLI configuration from a string

(self, s: str, index: int)

Source from the content-addressed store, hash-verified

3809 super(Container, self).__init__(klass=self.klass, args=args, **kwargs)
3810
3811 def item_from_string(self, s: str, index: int) -> t.Any: # type:ignore[override]
3812 """Cast a single item from a string
3813
3814 Evaluated when parsing CLI configuration from a string
3815 """
3816 if not self._traits or index >= len(self._traits):
3817 # return s instead of raising index error
3818 # length errors will be raised later on validation
3819 return s
3820 return self._traits[index].from_string(s)
3821
3822 def validate_elements(self, obj: t.Any, value: t.Any) -> t.Any:
3823 if not self._traits:

Callers

nothing calls this directly

Calls 1

from_stringMethod · 0.45

Tested by

no test coverage detected