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

Method __init__

traitlets/traitlets.py:917–923  ·  view source on GitHub ↗
(self, cb: t.Any)

Source from the content-addressed store, hash-verified

915 """
916
917 def __init__(self, cb: t.Any) -> None:
918 self.cb = cb
919 # Bound methods have an additional 'self' argument.
920 offset = -1 if isinstance(self.cb, types.MethodType) else 0
921 self.nargs = len(getargspec(cb)[0]) + offset
922 if self.nargs > 4:
923 raise TraitError("a trait changed callback must have 0-4 arguments.")
924
925 def __eq__(self, other: object) -> bool:
926 # The wrapper is equal to the wrapped element

Callers

nothing calls this directly

Calls 2

getargspecFunction · 0.90
TraitErrorClass · 0.85

Tested by

no test coverage detected