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

Method check_valid

tests/test_traitlets.py:1993–1997  ·  view source on GitHub ↗
(self, proposal)

Source from the content-addressed store, hash-verified

1991
1992 @validate("odd", "even")
1993 def check_valid(self, proposal):
1994 if proposal["trait"].name == "odd" and not proposal["value"] % 2:
1995 raise TraitError("odd should be odd")
1996 if proposal["trait"].name == "even" and proposal["value"] % 2:
1997 raise TraitError("even should be even")
1998
1999 u = OddEven()
2000 u.odd = 3 # OK

Callers

nothing calls this directly

Calls 1

TraitErrorClass · 0.90

Tested by

no test coverage detected