A base class for objects that are configurable.
Create a configurable given a config config.
config : Config
parent : Configurable instance, optional
class MyConfigurable(Configurable): def __init__(self, config=None): super(MyConfigurable, self).__init__(config=config) # Then any other code you need to finish initialization.
This ensures that instances will be configured properly.
Get the config class config section
Get the help string for this class in ReST format.
If inst is given, it’s current trait values will be used in place of class defaults.
Get the help string for a single trait.
If inst is given, it’s current trait values will be used in place of the class default.
Get the help string for a single trait and print it.
return section names as a list
Fire the traits events when the config is updated.
A configurable that only allows one instance.
This class is for classes that should only have one instance of itself or any subclass. To create and retrieve such a class use the SingletonConfigurable.instance() method.
unset _instance for this class and singleton parents.
Has an instance been created?
Returns a global instance of this class.
This method create a new instance if none have previously been created and returns a previously created instance is one already exists.
The arguments and keyword arguments passed to this method are passed on to the __init__() method of the class upon instantiation.
Create a singleton class using instance, and retrieve it:
>>> from IPython.config.configurable import SingletonConfigurable >>> class Foo(SingletonConfigurable): pass >>> foo = Foo.instance() >>> foo == Foo.instance() True
Create a subclass that is retrived using the base class instance:
>>> class Bar(SingletonConfigurable): pass >>> class Bam(Bar): pass >>> bam = Bam.instance() >>> bam == Bar.instance() True
A parent class for Configurables that log.
Subclasses have a log trait, and the default behavior is to get the logger from the currently running Application via Application.instance().log.