parameters: (self, klasses=None, args=None, kw=None, **kwargs)
docstring: Construct an Instance trait.
          This trait allows values that are instances of a particular
          class or its subclasses.  Our implementation is quite different
          from that of enthough.traits as we don't allow instances to be used
          for klass and we handle the ``args`` and ``kw`` arguments differently.
          Parameters
          ----------
          klasses : list of classes or class_names (str)
              The class that forms the basis for the trait.  Class names
              can also be specified as strings, like 'foo.bar.Bar'.
          args : tuple
              Positional arguments for generating the default value.
          kw : dict
              Keyword arguments for generating the default value.
          allow_none : bool [ default False ]
              Indicates whether None is allowed as a value.
          Notes
          -----
          If both ``args`` and ``kw`` are None, then the default value is None.
          If ``args`` is a tuple and ``kw`` is a dict, then the default is
          created as ``klass(*args, **kw)``.  If exactly one of ``args`` or ``kw`` is
          None, the None is replaced by ``()`` or ``{}``, respectively.
docstring_summary: Construct an Instance trait.
          This trait allows values that are instances of a particular
          class or its subclasses.  Our implementation is quite different
          from that of enthough.traits as we don't allow instances to be used
          for klass and we handle the ``args`` and ``kw`` arguments differently.
          Parameters
          ----------
          klasses : list of classes or class_names (str)
              The class that forms the basis for the trait.  Class names
              can also be specified as strings, like 'foo.bar.Bar'.
          args : tuple
              Positional arguments for generating the default value.
          kw : dict
              Keyword arguments for generating the default value.
          allow_none : bool [ default False ]
              Indicates whether None is allowed as a value.
          Notes
          -----
          If both ``args`` and ``kw`` are None, then the default value is None.
          If ``args`` is a tuple and ``kw`` is a dict, then the default is
          created as ``klass(*args, **kw)``.  If exactly one of ``args`` or ``kw`` is
          None, the None is replaced by ``()`` or ``{}``, respectively.
docstring_tokens: Construct an Instance trait . This trait allows values that are instances of a particular class or its subclasses . Our implementation is quite different from that of enthough . traits as we don t allow instances to be used for klass and we handle the args and kw arguments differently . Parameters ---------- klasses : list of classes or class_names ( str ) The class that forms the basis for the trait . Class names can also be specified as strings like foo . bar . Bar . args : tuple Positional arguments for generating the default value . kw : dict Keyword arguments for generating the default value . allow_none : bool [ default False ] Indicates whether None is allowed as a value . Notes ----- If both args and kw are None then the default value is None . If args is a tuple and kw is a dict then the default is created as klass ( * args ** kw ) . If exactly one of args or kw is None the None is replaced by () or {} respectively .
function: def __init__(self, klasses=None, args=None, kw=None, **kwargs):
          """Construct an Instance trait.
          This trait allows values that are instances of a particular
          class or its subclasses.  Our implementation is quite different
          from that of enthough.traits as we don't allow instances to be used
          for klass and we handle the ``args`` and ``kw`` arguments differently.
          Parameters
          ----------
          klasses : list of classes or class_names (str)
              The class that forms the basis for the trait.  Class names
              can also be specified as strings, like 'foo.bar.Bar'.
          args : tuple
              Positional arguments for generating the default value.
          kw : dict
              Keyword arguments for generating the default value.
          allow_none : bool [ default False ]
              Indicates whether None is allowed as a value.
          Notes
          -----
          If both ``args`` and ``kw`` are None, then the default value is None.
          If ``args`` is a tuple and ``kw`` is a dict, then the default is
          created as ``klass(*args, **kw)``.  If exactly one of ``args`` or ``kw`` is
          None, the None is replaced by ``()`` or ``{}``, respectively.
          """
          # If class
          if klasses is None:
              self.klasses = klasses
          # Verify all elements are either classes or strings.
          elif all(inspect.isclass(k) or isinstance(k, str) for k in klasses):
              self.klasses = klasses
          else:
              raise TraitError('The klasses attribute must be a list of class names or classes'
                                  ' not: %r' % klass)
  
          if (kw is not None) and not isinstance(kw, dict):
              raise TraitError("The 'kw' argument must be a dict or None.")
          if (args is not None) and not isinstance(args, tuple):
              raise TraitError("The 'args' argument must be a tuple or None.")
  
          self.default_args = args
          self.default_kwargs = kw
  
          super(InstanceFromClasses, self).__init__(**kwargs)
function_tokens: def __init__ ( self , klasses = None , args = None , kw = None , * * kwargs ) : # If class if klasses is None : self . klasses = klasses # Verify all elements are either classes or strings. elif all ( inspect . isclass ( k ) or isinstance ( k , str ) for k in klasses ) : self . klasses = klasses else : raise TraitError ( 'The klasses attribute must be a list of class names or classes' ' not: %r' % klass ) if ( kw is not None ) and not isinstance ( kw , dict ) : raise TraitError ( "The 'kw' argument must be a dict or None." ) if ( args is not None ) and not isinstance ( args , tuple ) : raise TraitError ( "The 'args' argument must be a tuple or None." ) self . default_args = args self . default_kwargs = kw super ( InstanceFromClasses , self ) . __init__ ( * * kwargs )