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

Method validate

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

Source from the content-addressed store, hash-verified

2836 info_text = "a complex number"
2837
2838 def validate(self, obj: t.Any, value: t.Any) -> complex | None:
2839 if isinstance(value, complex):
2840 return value
2841 if isinstance(value, (float, int)):
2842 return complex(value)
2843 self.error(obj, value)
2844
2845 def from_string(self, s: str) -> complex | None:
2846 if self.allow_none and s == "None":

Callers

nothing calls this directly

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected