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

Function compatible_observer

traitlets/traitlets.py:1143–1162  ·  view source on GitHub ↗
(
        self: t.Any, change_or_name: str, old: t.Any = Undefined, new: t.Any = Undefined
    )

Source from the content-addressed store, hash-verified

1141 """
1142
1143 def compatible_observer(
1144 self: t.Any, change_or_name: str, old: t.Any = Undefined, new: t.Any = Undefined
1145 ) -> t.Any:
1146 if isinstance(change_or_name, dict): # type:ignore[unreachable]
1147 change = Bunch(change_or_name) # type:ignore[unreachable]
1148 else:
1149 clsname = self.__class__.__name__
1150 warn(
1151 f"A parent of {clsname}._{change_or_name}_changed has adopted the new (traitlets 4.1) @observe(change) API",
1152 DeprecationWarning,
1153 stacklevel=2,
1154 )
1155 change = Bunch(
1156 type="change",
1157 old=old,
1158 new=new,
1159 name=change_or_name,
1160 owner=self,
1161 )
1162 return func(self, change)
1163
1164 return compatible_observer # type:ignore[return-value]
1165

Callers

nothing calls this directly

Calls 2

BunchClass · 0.85
warnFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…