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

Method clear_instance

traitlets/config/configurable.py:543–551  ·  view source on GitHub ↗

unset _instance for this class and singleton parents.

(cls)

Source from the content-addressed store, hash-verified

541
542 @classmethod
543 def clear_instance(cls) -> None:
544 """unset _instance for this class and singleton parents."""
545 if not cls.initialized():
546 return
547 for subclass in cls._walk_mro():
548 if isinstance(subclass._instance, cls):
549 # only clear instances that are instances
550 # of the calling class
551 subclass._instance = None # type:ignore[unreachable]
552
553 @classmethod
554 def instance(cls: type[CT], *args: t.Any, **kwargs: t.Any) -> CT:

Calls 2

initializedMethod · 0.80
_walk_mroMethod · 0.80