Defines the TraitFactory class and related objects.
A TraitFactory is a class which allows deferred, but cached, creation of
CTrait instances. The TraitFactory API provides the as_ctrait
method
so that the trait conversion functions can generate CTrait instances in a
standard way.
Classes
-
class
traits.trait_factory.
TraitFactory
(maker_function=None)[source]
A factory class that allows deferred creation of traits
Traits created by TraitFactory instances are cached, and the cached
trait is returned by all subsequent calls to the same TraitFactory
instance.
-
as_ctrait
()[source]
Get the CTrait instance from the factory.
-
class
traits.trait_factory.
TraitImportError
(message)[source]
TraitFactory subclass that always fails when creating a CTrait
This class is designed for uses such as deferring import problems until
encountering code that actually tries to use the unimportable trait.
Functions
-
traits.trait_factory.
trait_factory
(trait)[source]
Returns a trait created from a TraitFactory instance