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

Method subclass_init

traitlets/traitlets.py:472–481  ·  view source on GitHub ↗
(self, cls: type[HasTraits])

Source from the content-addressed store, hash-verified

470 self.name = name
471
472 def subclass_init(self, cls: type[HasTraits]) -> None:
473 # Instead of HasDescriptors.setup_instance calling
474 # every instance_init, we opt in by default.
475 # This gives descriptors a change to opt out for
476 # performance reasons.
477 # Because most traits do not need instance_init,
478 # and it will otherwise be called for every HasTrait instance
479 # being created, this otherwise gives a significant performance
480 # pentalty. Most TypeTraits in traitlets opt out.
481 cls._instance_inits.append(self.instance_init)
482
483 def instance_init(self, obj: t.Any) -> None:
484 """Part of the initialization which may depend on the underlying

Callers

nothing calls this directly

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected