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

Method from_string

traitlets/traitlets.py:3119–3128  ·  view source on GitHub ↗
(self, s: str)

Source from the content-addressed store, hash-verified

3117 self.error(obj, value)
3118
3119 def from_string(self, s: str) -> G:
3120 if self.allow_none and s == "None":
3121 return None # type:ignore[return-value]
3122 s = s.lower()
3123 if s in {"true", "1"}:
3124 return True # type:ignore[return-value]
3125 elif s in {"false", "0"}:
3126 return False # type:ignore[return-value]
3127 else:
3128 raise ValueError("%r is not 1, 0, true, or false")
3129
3130 def subclass_init(self, cls: type[t.Any]) -> None:
3131 pass # fully opt out of instance_init

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected