Inheritance diagram for IPython.core.formatters:
Display formatters.
Authors:
Bases: IPython.config.configurable.Configurable
A base formatter class that is configurable.
This formatter should usually be used as the base class of all formatters. It is a traited Configurable class and includes an extensible API for users to determine how their objects are formatted. The following logic is used to find a function to format an given object.
Users should use these dictionaries to register functions that will be used to compute the format data for their objects (if those objects don’t have the special print methods). The easiest way of using these dictionaries is through the for_type() and for_type_by_name() methods.
If no function/callable is found to compute the format data, None is returned and this format type is not used.
Create a configurable given a config config.
Parameters : | config : Config
|
---|
Notes
Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():
class MyConfigurable(Configurable):
def __init__(self, config=None):
super(MyConfigurable, self).__init__(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.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
An instance of a Python dict.
A boolean (True, False) trait.
Add a format function for a given type.
Parameters : | typ : class
func : callable
|
---|
Add a format function for a type specified by the full dotted module and name of the type, rather than the type of the object.
Parameters : | type_module : str
type_name : str
func : callable
|
---|
A trait for unicode strings.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
A string holding a valid object name in this version of Python.
This does not check that the name exists in any scope.
An instance of a Python dict.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
An instance of a Python dict.
Fire the traits events when the config is updated.
Bases: IPython.config.configurable.Configurable
Create a configurable given a config config.
Parameters : | config : Config
|
---|
Notes
Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():
class MyConfigurable(Configurable):
def __init__(self, config=None):
super(MyConfigurable, self).__init__(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.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Return a format data dict for an object.
By default all format types will be computed.
The following MIME types are currently implemented:
Parameters : | obj : object
include : list or tuple, optional
exclude : list or tuple, optional
|
---|---|
Returns : | format_dict : dict
|
Return the format types (MIME types) of the active formatters.
An instance of a Python dict.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
A boolean (True, False) trait.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
Fire the traits events when the config is updated.
Bases: object
Abstract base class for Formatters.
A formatter is a callable class that is responsible for computing the raw format data for a particular format type (MIME type). For example, an HTML formatter would have a format type of text/html and would return the HTML representation of the object when called.
x.__init__(...) initializes x; see help(type(x)) for signature
Bases: IPython.core.formatters.BaseFormatter
An HTML formatter.
To define the callables that compute the HTML representation of your objects, define a _repr_html_() method or use the for_type() or for_type_by_name() methods to register functions that handle this.
The return value of this formatter should be a valid HTML snippet that could be injected into an existing DOM. It should not include the `<html> or `<body> tags.
Create a configurable given a config config.
Parameters : | config : Config
|
---|
Notes
Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():
class MyConfigurable(Configurable):
def __init__(self, config=None):
super(MyConfigurable, self).__init__(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.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
An instance of a Python dict.
A boolean (True, False) trait.
Add a format function for a given type.
Parameters : | typ : class
func : callable
|
---|
Add a format function for a type specified by the full dotted module and name of the type, rather than the type of the object.
Parameters : | type_module : str
type_name : str
func : callable
|
---|
A trait for unicode strings.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
A string holding a valid object name in this version of Python.
This does not check that the name exists in any scope.
An instance of a Python dict.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
An instance of a Python dict.
Fire the traits events when the config is updated.
Bases: IPython.core.formatters.BaseFormatter
A JPEG formatter.
To define the callables that compute the JPEG representation of your objects, define a _repr_jpeg_() method or use the for_type() or for_type_by_name() methods to register functions that handle this.
The return value of this formatter should be raw JPEG data, not base64 encoded.
Create a configurable given a config config.
Parameters : | config : Config
|
---|
Notes
Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():
class MyConfigurable(Configurable):
def __init__(self, config=None):
super(MyConfigurable, self).__init__(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.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
An instance of a Python dict.
A boolean (True, False) trait.
Add a format function for a given type.
Parameters : | typ : class
func : callable
|
---|
Add a format function for a type specified by the full dotted module and name of the type, rather than the type of the object.
Parameters : | type_module : str
type_name : str
func : callable
|
---|
A trait for unicode strings.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
A string holding a valid object name in this version of Python.
This does not check that the name exists in any scope.
An instance of a Python dict.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
An instance of a Python dict.
Fire the traits events when the config is updated.
Bases: IPython.core.formatters.BaseFormatter
A JSON string formatter.
To define the callables that compute the JSON string representation of your objects, define a _repr_json_() method or use the for_type() or for_type_by_name() methods to register functions that handle this.
The return value of this formatter should be a valid JSON string.
Create a configurable given a config config.
Parameters : | config : Config
|
---|
Notes
Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():
class MyConfigurable(Configurable):
def __init__(self, config=None):
super(MyConfigurable, self).__init__(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.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
An instance of a Python dict.
A boolean (True, False) trait.
Add a format function for a given type.
Parameters : | typ : class
func : callable
|
---|
Add a format function for a type specified by the full dotted module and name of the type, rather than the type of the object.
Parameters : | type_module : str
type_name : str
func : callable
|
---|
A trait for unicode strings.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
A string holding a valid object name in this version of Python.
This does not check that the name exists in any scope.
An instance of a Python dict.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
An instance of a Python dict.
Fire the traits events when the config is updated.
Bases: IPython.core.formatters.BaseFormatter
A Javascript formatter.
To define the callables that compute the Javascript representation of your objects, define a _repr_javascript_() method or use the for_type() or for_type_by_name() methods to register functions that handle this.
The return value of this formatter should be valid Javascript code and should not be enclosed in `<script>` tags.
Create a configurable given a config config.
Parameters : | config : Config
|
---|
Notes
Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():
class MyConfigurable(Configurable):
def __init__(self, config=None):
super(MyConfigurable, self).__init__(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.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
An instance of a Python dict.
A boolean (True, False) trait.
Add a format function for a given type.
Parameters : | typ : class
func : callable
|
---|
Add a format function for a type specified by the full dotted module and name of the type, rather than the type of the object.
Parameters : | type_module : str
type_name : str
func : callable
|
---|
A trait for unicode strings.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
A string holding a valid object name in this version of Python.
This does not check that the name exists in any scope.
An instance of a Python dict.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
An instance of a Python dict.
Fire the traits events when the config is updated.
Bases: IPython.core.formatters.BaseFormatter
A LaTeX formatter.
To define the callables that compute the LaTeX representation of your objects, define a _repr_latex_() method or use the for_type() or for_type_by_name() methods to register functions that handle this.
The return value of this formatter should be a valid LaTeX equation, enclosed in either `$` or `$$`.
Create a configurable given a config config.
Parameters : | config : Config
|
---|
Notes
Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():
class MyConfigurable(Configurable):
def __init__(self, config=None):
super(MyConfigurable, self).__init__(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.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
An instance of a Python dict.
A boolean (True, False) trait.
Add a format function for a given type.
Parameters : | typ : class
func : callable
|
---|
Add a format function for a type specified by the full dotted module and name of the type, rather than the type of the object.
Parameters : | type_module : str
type_name : str
func : callable
|
---|
A trait for unicode strings.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
A string holding a valid object name in this version of Python.
This does not check that the name exists in any scope.
An instance of a Python dict.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
An instance of a Python dict.
Fire the traits events when the config is updated.
Bases: IPython.core.formatters.BaseFormatter
A PNG formatter.
To define the callables that compute the PNG representation of your objects, define a _repr_png_() method or use the for_type() or for_type_by_name() methods to register functions that handle this.
The return value of this formatter should be raw PNG data, not base64 encoded.
Create a configurable given a config config.
Parameters : | config : Config
|
---|
Notes
Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():
class MyConfigurable(Configurable):
def __init__(self, config=None):
super(MyConfigurable, self).__init__(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.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
An instance of a Python dict.
A boolean (True, False) trait.
Add a format function for a given type.
Parameters : | typ : class
func : callable
|
---|
Add a format function for a type specified by the full dotted module and name of the type, rather than the type of the object.
Parameters : | type_module : str
type_name : str
func : callable
|
---|
A trait for unicode strings.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
A string holding a valid object name in this version of Python.
This does not check that the name exists in any scope.
An instance of a Python dict.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
An instance of a Python dict.
Fire the traits events when the config is updated.
Bases: IPython.core.formatters.BaseFormatter
The default pretty-printer.
This uses IPython.external.pretty to compute the format data of the object. If the object cannot be pretty printed, repr() is used. See the documentation of IPython.external.pretty for details on how to write pretty printers. Here is a simple example:
def dtype_pprinter(obj, p, cycle):
if cycle:
return p.text('dtype(...)')
if hasattr(obj, 'fields'):
if obj.fields is None:
p.text(repr(obj))
else:
p.begin_group(7, 'dtype([')
for i, field in enumerate(obj.descr):
if i > 0:
p.text(',')
p.breakable()
p.pretty(field)
p.end_group(7, '])')
Create a configurable given a config config.
Parameters : | config : Config
|
---|
Notes
Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():
class MyConfigurable(Configurable):
def __init__(self, config=None):
super(MyConfigurable, self).__init__(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.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
An instance of a Python dict.
A boolean (True, False) trait.
A trait for unicode strings.
A casting version of the unicode trait.
Add a format function for a given type.
Parameters : | typ : class
func : callable
|
---|
Add a format function for a type specified by the full dotted module and name of the type, rather than the type of the object.
Parameters : | type_module : str
type_name : str
func : callable
|
---|
A trait for unicode strings.
An integer trait.
Longs that are unnecessary (<= sys.maxint) are cast to ints.
A trait for unicode strings.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
A boolean (True, False) trait.
A string holding a valid object name in this version of Python.
This does not check that the name exists in any scope.
An instance of a Python dict.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
An instance of a Python dict.
Fire the traits events when the config is updated.
A boolean (True, False) trait.
Bases: IPython.core.formatters.BaseFormatter
An SVG formatter.
To define the callables that compute the SVG representation of your objects, define a _repr_svg_() method or use the for_type() or for_type_by_name() methods to register functions that handle this.
The return value of this formatter should be valid SVG enclosed in `<svg>` tags, that could be injected into an existing DOM. It should not include the `<html> or `<body> tags.
Create a configurable given a config config.
Parameters : | config : Config
|
---|
Notes
Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():
class MyConfigurable(Configurable):
def __init__(self, config=None):
super(MyConfigurable, self).__init__(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.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
An instance of a Python dict.
A boolean (True, False) trait.
Add a format function for a given type.
Parameters : | typ : class
func : callable
|
---|
Add a format function for a type specified by the full dotted module and name of the type, rather than the type of the object.
Parameters : | type_module : str
type_name : str
func : callable
|
---|
A trait for unicode strings.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
A string holding a valid object name in this version of Python.
This does not check that the name exists in any scope.
An instance of a Python dict.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
An instance of a Python dict.
Fire the traits events when the config is updated.
Return a format data dict for an object.
By default all format types will be computed.
The following MIME types are currently implemented:
Parameters : | obj : object
|
---|---|
Returns : | format_dict : dict
include : list or tuple, optional
exclude : list or tuple, optional
|