<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> import sys <EOL> from types import FunctionType , MethodType <EOL> NoneType = type ( None ) <EOL> from . import trait_handlers <EOL> from . ctraits import cTrait <EOL> from . trait_errors import TraitError <EOL> from . trait_base import ( SequenceTypes , Self , Undefined , Missing , TypeTypes , <EOL> add_article ) <EOL> from . trait_handlers import ( TraitHandler , TraitInstance , TraitFunction , <EOL> TraitCoerceType , TraitCastType , TraitEnum , TraitCompound , TraitMap , <EOL> TraitString , ThisClass , TraitType , _arg_count , _read_only , _write_only , <EOL> _undefined_get , _undefined_set ) <EOL> KindMap = { <EOL> <NUM_LIT:0> : '<STR_LIT:value>' , <EOL> <NUM_LIT:1> : '<STR_LIT:value>' , <EOL> <NUM_LIT:2> : '<STR_LIT>' , <EOL> <NUM_LIT:3> : '<STR_LIT:list>' , <EOL> <NUM_LIT:4> : '<STR_LIT>' , <EOL> <NUM_LIT:5> : '<STR_LIT:list>' , <EOL> <NUM_LIT:6> : '<STR_LIT>' , <EOL> <NUM_LIT:7> : '<STR_LIT>' , <EOL> <NUM_LIT:8> : '<STR_LIT>' <EOL> } <EOL> PasswordEditor = None <EOL> MultilineTextEditor = None <EOL> SourceCodeEditor = None <EOL> HTMLTextEditor = None <EOL> PythonShellEditor = None <EOL> DateEditor = None <EOL> TimeEditor = None <EOL> def password_editor ( auto_set = True , enter_set = False ) : <EOL> """<STR_LIT>""" <EOL> global PasswordEditor <EOL> if PasswordEditor is None : <EOL> from traitsui . api import TextEditor <EOL> PasswordEditor = TextEditor ( password = True , <EOL> auto_set = auto_set , <EOL> enter_set = enter_set ) <EOL> return PasswordEditor <EOL> def multi_line_text_editor ( auto_set = True , enter_set = False ) : <EOL> """<STR_LIT>""" <EOL> global MultilineTextEditor <EOL> if MultilineTextEditor is None : <EOL> from traitsui . api import TextEditor <EOL> MultilineTextEditor = TextEditor ( multi_line = True , <EOL> auto_set = auto_set , <EOL> enter_set = enter_set ) <EOL> return MultilineTextEditor <EOL> def code_editor ( ) : <EOL> """<STR_LIT>""" <EOL> global SourceCodeEditor <EOL> if SourceCodeEditor is None : <EOL> from traitsui . api import CodeEditor <EOL> SourceCodeEditor = CodeEditor ( ) <EOL> return SourceCodeEditor <EOL> def html_editor ( ) : <EOL> """<STR_LIT>""" <EOL> global HTMLTextEditor <EOL> if HTMLTextEditor is None : <EOL> from traitsui . api import HTMLEditor <EOL> HTMLTextEditor = HTMLEditor ( ) <EOL> return HTMLTextEditor <EOL> def shell_editor ( ) : <EOL> """<STR_LIT>""" <EOL> global PythonShellEditor <EOL> if PythonShellEditor is None : <EOL> from traitsui . api import ShellEditor <EOL> PythonShellEditor = ShellEditor ( ) <EOL> return PythonShellEditor <EOL> def time_editor ( ) : <EOL> """<STR_LIT>""" <EOL> global TimeEditor <EOL> if TimeEditor is None : <EOL> from traitsui . api import TimeEditor <EOL> TimeEditor = TimeEditor ( ) <EOL> return TimeEditor <EOL> def date_editor ( ) : <EOL> """<STR_LIT>""" <EOL> global DateEditor <EOL> if DateEditor is None : <EOL> from traitsui . api import DateEditor <EOL> DateEditor = DateEditor ( ) <EOL> return DateEditor <EOL> class CTrait ( cTrait ) : <EOL> """<STR_LIT>""" <EOL> def __call__ ( self , * args , ** metadata ) : <EOL> handler = self . handler <EOL> if isinstance ( handler , TraitType ) : <EOL> dict = ( self . __dict__ or { } ) . copy ( ) <EOL> dict . update ( metadata ) <EOL> return handler ( * args , ** dict ) <EOL> metadata . setdefault ( '<STR_LIT>' , self ) <EOL> return Trait ( * ( args + ( self , ) ) , ** metadata ) <EOL> def __get_default ( self ) : <EOL> kind , value = self . default_value ( ) <EOL> if kind in ( <NUM_LIT:2> , <NUM_LIT:7> , <NUM_LIT:8> ) : <EOL> return Undefined <EOL> if kind in ( <NUM_LIT:4> , <NUM_LIT:6> ) : <EOL> return value . copy ( ) <EOL> if kind in ( <NUM_LIT:3> , <NUM_LIT:5> ) : <EOL> return value [ : ] <EOL> return value <EOL> default = property ( __get_default ) <EOL> def __get_default_kind ( self ) : <EOL> return KindMap [ self . default_value ( ) [ <NUM_LIT:0> ] ] <EOL> default_kind = property ( __get_default_kind ) <EOL> def __get_trait_type ( self ) : <EOL> handler = self . handler <EOL> if handler is not None : <EOL> return handler <EOL> else : <EOL> from . trait_types import Any <EOL> return Any <EOL> trait_type = property ( __get_trait_type ) <EOL> def __get_inner_traits ( self ) : <EOL> handler = self . handler <EOL> if handler is not None : <EOL> return handler . inner_traits ( ) <EOL> return ( ) <EOL> inner_traits = property ( __get_inner_traits ) <EOL> def is_trait_type ( self , trait_type ) : <EOL> """<STR_LIT>""" <EOL> return isinstance ( self . trait_type , trait_type ) <EOL> def get_editor ( self ) : <EOL> """<STR_LIT>""" <EOL> from traitsui . api import EditorFactory <EOL> editor = self . editor <EOL> if editor is None : <EOL> handler = self . handler <EOL> if handler is not None : <EOL> editor = handler . get_editor ( self ) <EOL> if editor is None : <EOL> from traitsui . api import TextEditor <EOL> editor = TextEditor <EOL> if not isinstance ( editor , EditorFactory ) : <EOL> args = ( ) <EOL> traits = { } <EOL> if type ( editor ) in SequenceTypes : <EOL> for item in editor [ : ] : <EOL> if type ( item ) in SequenceTypes : <EOL> args = tuple ( item ) <EOL> elif isinstance ( item , dict ) : <EOL> traits = item <EOL> if traits . get ( '<STR_LIT>' , <NUM_LIT:0> ) is None : <EOL> traits = traits . copy ( ) <EOL> traits [ '<STR_LIT>' ] = self <EOL> else : <EOL> editor = item <EOL> editor = editor ( * args , ** traits ) <EOL> self . editor = editor <EOL> return editor <EOL> def get_help ( self , full = True ) : <EOL> """<STR_LIT>""" <EOL> if full : <EOL> help = self . help <EOL> if help is not None : <EOL> return help <EOL> handler = self . handler <EOL> if handler is not None : <EOL> info = '<STR_LIT>' % handler . info ( ) <EOL> else : <EOL> info = '<STR_LIT>' <EOL> desc = self . desc <EOL> if self . desc is None : <EOL> return info . capitalize ( ) <EOL> return '<STR_LIT>' % ( desc , info ) <EOL> def full_info ( self , object , name , value ) : <EOL> """<STR_LIT>""" <EOL> handler = self . handler <EOL> if handler is not None : <EOL> return handler . full_info ( object , name , value ) <EOL> return '<STR_LIT>' <EOL> def info ( self ) : <EOL> """<STR_LIT>""" <EOL> handler = self . handler <EOL> if handler is not None : <EOL> return handler . info ( ) <EOL> return '<STR_LIT>' <EOL> def __reduce_ex__ ( self , protocol ) : <EOL> return ( __newobj__ , ( self . __class__ , <NUM_LIT:0> ) , self . __getstate__ ( ) ) <EOL> def _register ( self , object , name ) : <EOL> """<STR_LIT>""" <EOL> def handler ( ) : <EOL> object . trait_property_changed ( name , None ) <EOL> tv = self . _trait_value <EOL> handlers = tv . _handlers <EOL> if handlers is None : <EOL> tv . _handlers = handlers = { } <EOL> handlers [ ( id ( object ) , name ) ] = handler <EOL> tv . on_trait_change ( handler , '<STR_LIT:value>' ) <EOL> def _unregister ( self , object , name ) : <EOL> """<STR_LIT>""" <EOL> tv = self . _trait_value <EOL> handlers = tv . _handlers <EOL> key = ( id ( object ) , name ) <EOL> handler = handlers . get ( key ) <EOL> if handler is not None : <EOL> del handlers [ key ] <EOL> tv . on_trait_change ( handler , '<STR_LIT:value>' , remove = True ) <EOL> from . import ctraits <EOL> ctraits . _ctrait ( CTrait ) <EOL> ConstantTypes = ( NoneType , int , long , float , complex , str , unicode ) <EOL> PythonTypes = ( str , unicode , int , long , float , complex , list , tuple , <EOL> dict , FunctionType , MethodType , type , NoneType ) <EOL> if sys . version_info [ <NUM_LIT:0> ] < <NUM_LIT:3> : <EOL> from types import InstanceType , ClassType <EOL> PythonTypes = PythonTypes [ : - <NUM_LIT:2> ] + ( InstanceType , ClassType ) + PythonTypes [ <NUM_LIT:2> : ] <EOL> CallableTypes = ( FunctionType , MethodType ) <EOL> TraitTypes = ( TraitHandler , CTrait ) <EOL> DefaultValues = { <EOL> str : '<STR_LIT>' , <EOL> unicode : u'<STR_LIT>' , <EOL> int : <NUM_LIT:0> , <EOL> long : <NUM_LIT:0> L , <EOL> float : <NUM_LIT:0.0> , <EOL> complex : <NUM_LIT> , <EOL> list : [ ] , <EOL> tuple : ( ) , <EOL> dict : { } , <EOL> bool : False <EOL> } <EOL> DefaultValueSpecial = [ Missing , Self ] <EOL> DefaultValueTypes = [ list , dict ] <EOL> def __newobj__ ( cls , * args ) : <EOL> """<STR_LIT>""" <EOL> return cls . __new__ ( cls , * args ) <EOL> def _default_value_type ( default_value ) : <EOL> try : <EOL> return DefaultValueSpecial . index ( default_value ) + <NUM_LIT:1> <EOL> except : <EOL> try : <EOL> return DefaultValueTypes . index ( type ( default_value ) ) + <NUM_LIT:3> <EOL> except : <EOL> return <NUM_LIT:0> <EOL> class TraitFactory ( object ) : <EOL> def __init__ ( self , maker_function = None ) : <EOL> if maker_function is not None : <EOL> self . maker_function = maker_function <EOL> self . __doc__ = maker_function . __doc__ <EOL> def __call__ ( self , * args , ** metadata ) : <EOL> return self . maker_function ( * args , ** metadata ) <EOL> class TraitImportError ( TraitFactory ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , message ) : <EOL> self . message = message <EOL> def __call__ ( self , * args , ** metadata ) : <EOL> raise TraitError ( self . message ) <EOL> _trait_factory_instances = { } <EOL> def trait_factory ( trait ) : <EOL> global _trait_factory_instances <EOL> tid = id ( trait ) <EOL> if tid not in _trait_factory_instances : <EOL> _trait_factory_instances [ tid ] = trait ( ) <EOL> return _trait_factory_instances [ tid ] <EOL> def trait_cast ( something ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( something , CTrait ) : <EOL> return something <EOL> if isinstance ( something , TraitFactory ) : <EOL> return trait_factory ( something ) <EOL> if isinstance ( something , type ) and issubclass ( something , TraitType ) : <EOL> return something ( ) . as_ctrait ( ) <EOL> if isinstance ( something , TraitType ) : <EOL> return something . as_ctrait ( ) <EOL> return None <EOL> def try_trait_cast ( something ) : <EOL> """<STR_LIT>""" <EOL> return trait_cast ( something ) or something <EOL> def trait_from ( something ) : <EOL> """<STR_LIT>""" <EOL> from . trait_types import Any <EOL> if isinstance ( something , CTrait ) : <EOL> return something <EOL> if something is None : <EOL> something = Any <EOL> if isinstance ( something , TraitFactory ) : <EOL> return trait_factory ( something ) <EOL> if isinstance ( something , type ) and issubclass ( something , TraitType ) : <EOL> return something ( ) . as_ctrait ( ) <EOL> if isinstance ( something , TraitType ) : <EOL> return something . as_ctrait ( ) <EOL> return Trait ( something ) <EOL> trait_handlers . trait_from = trait_from <EOL> class _InstanceArgs ( object ) : <EOL> def __init__ ( self , factory , args , kw ) : <EOL> self . args = ( factory , ) + args <EOL> self . kw = kw <EOL> class Default ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , func = None , args = ( ) , kw = None ) : <EOL> self . default_value = ( func , args , kw ) <EOL> def Trait ( * value_type , ** metadata ) : <EOL> """<STR_LIT>""" <EOL> return _TraitMaker ( * value_type , ** metadata ) . as_ctrait ( ) <EOL> trait_handlers . Trait = Trait <EOL> class _TraitMaker ( object ) : <EOL> type_map = { <EOL> '<STR_LIT>' : <NUM_LIT:2> , <EOL> '<STR_LIT>' : <NUM_LIT:7> <EOL> } <EOL> def __init__ ( self , * value_type , ** metadata ) : <EOL> metadata . setdefault ( '<STR_LIT:type>' , '<STR_LIT>' ) <EOL> self . define ( * value_type , ** metadata ) <EOL> def define ( self , * value_type , ** metadata ) : <EOL> default_value_type = - <NUM_LIT:1> <EOL> default_value = handler = clone = None <EOL> if len ( value_type ) > <NUM_LIT:0> : <EOL> default_value = value_type [ <NUM_LIT:0> ] <EOL> value_type = value_type [ <NUM_LIT:1> : ] <EOL> if ( ( len ( value_type ) == <NUM_LIT:0> ) and <EOL> ( type ( default_value ) in SequenceTypes ) ) : <EOL> default_value , value_type = default_value [ <NUM_LIT:0> ] , default_value <EOL> if len ( value_type ) == <NUM_LIT:0> : <EOL> default_value = try_trait_cast ( default_value ) <EOL> if default_value in PythonTypes : <EOL> handler = TraitCoerceType ( default_value ) <EOL> default_value = DefaultValues . get ( default_value ) <EOL> elif isinstance ( default_value , CTrait ) : <EOL> clone = default_value <EOL> default_value_type , default_value = clone . default_value ( ) <EOL> metadata [ '<STR_LIT:type>' ] = clone . type <EOL> elif isinstance ( default_value , TraitHandler ) : <EOL> handler = default_value <EOL> default_value = None <EOL> elif default_value is ThisClass : <EOL> handler = ThisClass ( ) <EOL> default_value = None <EOL> else : <EOL> typeValue = type ( default_value ) <EOL> if isinstance ( default_value , basestring ) : <EOL> string_options = self . extract ( metadata , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> if len ( string_options ) == <NUM_LIT:0> : <EOL> handler = TraitCastType ( typeValue ) <EOL> else : <EOL> handler = TraitString ( ** string_options ) <EOL> elif typeValue in TypeTypes : <EOL> handler = TraitCastType ( typeValue ) <EOL> else : <EOL> metadata . setdefault ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> handler = TraitInstance ( default_value ) <EOL> if default_value is handler . aClass : <EOL> default_value = DefaultValues . get ( default_value ) <EOL> else : <EOL> enum = [ ] <EOL> other = [ ] <EOL> map = { } <EOL> self . do_list ( value_type , enum , map , other ) <EOL> if ( ( ( len ( enum ) == <NUM_LIT:1> ) and ( enum [ <NUM_LIT:0> ] is None ) ) and <EOL> ( ( len ( other ) == <NUM_LIT:1> ) and <EOL> isinstance ( other [ <NUM_LIT:0> ] , TraitInstance ) ) ) : <EOL> enum = [ ] <EOL> other [ <NUM_LIT:0> ] . allow_none ( ) <EOL> metadata . setdefault ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> if len ( enum ) > <NUM_LIT:0> : <EOL> if ( ( ( len ( map ) + len ( other ) ) == <NUM_LIT:0> ) and <EOL> ( default_value not in enum ) ) : <EOL> enum . insert ( <NUM_LIT:0> , default_value ) <EOL> other . append ( TraitEnum ( enum ) ) <EOL> if len ( map ) > <NUM_LIT:0> : <EOL> other . append ( TraitMap ( map ) ) <EOL> if len ( other ) == <NUM_LIT:0> : <EOL> handler = TraitHandler ( ) <EOL> elif len ( other ) == <NUM_LIT:1> : <EOL> handler = other [ <NUM_LIT:0> ] <EOL> if isinstance ( handler , CTrait ) : <EOL> clone , handler = handler , None <EOL> metadata [ '<STR_LIT:type>' ] = clone . type <EOL> elif isinstance ( handler , TraitInstance ) : <EOL> metadata . setdefault ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> if default_value is None : <EOL> handler . allow_none ( ) <EOL> elif isinstance ( default_value , _InstanceArgs ) : <EOL> default_value_type = <NUM_LIT:7> <EOL> default_value = ( handler . create_default_value , <EOL> default_value . args , default_value . kw ) <EOL> elif ( len ( enum ) == <NUM_LIT:0> ) and ( len ( map ) == <NUM_LIT:0> ) : <EOL> aClass = handler . aClass <EOL> typeValue = type ( default_value ) <EOL> if typeValue is dict : <EOL> default_value_type = <NUM_LIT:7> <EOL> default_value = ( aClass , ( ) , default_value ) <EOL> elif not isinstance ( default_value , aClass ) : <EOL> if typeValue is not tuple : <EOL> default_value = ( default_value , ) <EOL> default_value_type = <NUM_LIT:7> <EOL> default_value = ( aClass , default_value , None ) <EOL> else : <EOL> for i , item in enumerate ( other ) : <EOL> if isinstance ( item , CTrait ) : <EOL> if item . type != '<STR_LIT>' : <EOL> raise TraitError , ( "<STR_LIT>" <EOL> "<STR_LIT>" % <EOL> add_article ( item . type ) ) <EOL> handler = item . handler <EOL> if handler is None : <EOL> break <EOL> other [ i ] = handler <EOL> else : <EOL> handler = TraitCompound ( other ) <EOL> self . handler = handler <EOL> self . clone = clone <EOL> if default_value_type < <NUM_LIT:0> : <EOL> if isinstance ( default_value , Default ) : <EOL> default_value_type = <NUM_LIT:7> <EOL> default_value = default_value . default_value <EOL> else : <EOL> if ( handler is None ) and ( clone is not None ) : <EOL> handler = clone . handler <EOL> if handler is not None : <EOL> default_value_type = handler . default_value_type <EOL> if default_value_type < <NUM_LIT:0> : <EOL> try : <EOL> default_value = handler . validate ( None , '<STR_LIT>' , <EOL> default_value ) <EOL> except : <EOL> pass <EOL> if default_value_type < <NUM_LIT:0> : <EOL> default_value_type = _default_value_type ( default_value ) <EOL> self . default_value_type = default_value_type <EOL> self . default_value = default_value <EOL> self . metadata = metadata . copy ( ) <EOL> def do_list ( self , list , enum , map , other ) : <EOL> for item in list : <EOL> if item in PythonTypes : <EOL> other . append ( TraitCoerceType ( item ) ) <EOL> else : <EOL> item = try_trait_cast ( item ) <EOL> typeItem = type ( item ) <EOL> if typeItem in ConstantTypes : <EOL> enum . append ( item ) <EOL> elif typeItem in SequenceTypes : <EOL> self . do_list ( item , enum , map , other ) <EOL> elif typeItem is dict : <EOL> map . update ( item ) <EOL> elif typeItem in CallableTypes : <EOL> other . append ( TraitFunction ( item ) ) <EOL> elif item is ThisClass : <EOL> other . append ( ThisClass ( ) ) <EOL> elif isinstance ( item , TraitTypes ) : <EOL> other . append ( item ) <EOL> else : <EOL> other . append ( TraitInstance ( item ) ) <EOL> def as_ctrait ( self ) : <EOL> metadata = self . metadata <EOL> trait = CTrait ( self . type_map . get ( metadata . get ( '<STR_LIT:type>' ) , <NUM_LIT:0> ) ) <EOL> clone = self . clone <EOL> if clone is not None : <EOL> trait . clone ( clone ) <EOL> if clone . __dict__ is not None : <EOL> trait . __dict__ = clone . __dict__ . copy ( ) <EOL> trait . default_value ( self . default_value_type , self . default_value ) <EOL> handler = self . handler <EOL> if handler is not None : <EOL> trait . handler = handler <EOL> validate = getattr ( handler , '<STR_LIT>' , None ) <EOL> if validate is None : <EOL> validate = handler . validate <EOL> trait . set_validate ( validate ) <EOL> post_setattr = getattr ( handler , '<STR_LIT>' , None ) <EOL> if post_setattr is not None : <EOL> trait . post_setattr = post_setattr <EOL> trait . is_mapped ( handler . is_mapped ) <EOL> rich_compare = metadata . get ( '<STR_LIT>' ) <EOL> if rich_compare is not None : <EOL> trait . rich_comparison ( rich_compare is True ) <EOL> comparison_mode = metadata . get ( '<STR_LIT>' ) <EOL> if comparison_mode is not None : <EOL> trait . comparison_mode ( comparison_mode ) <EOL> trait . value_allowed ( metadata . get ( '<STR_LIT>' , False ) is True ) <EOL> if len ( metadata ) > <NUM_LIT:0> : <EOL> if trait . __dict__ is None : <EOL> trait . __dict__ = metadata <EOL> else : <EOL> trait . __dict__ . update ( metadata ) <EOL> return trait <EOL> def extract ( self , from_dict , * keys ) : <EOL> to_dict = { } <EOL> for key in keys : <EOL> if key in from_dict : <EOL> to_dict [ key ] = from_dict [ key ] <EOL> del from_dict [ key ] <EOL> return to_dict <EOL> def Property ( fget = None , fset = None , fvalidate = None , force = False , <EOL> handler = None , trait = None , ** metadata ) : <EOL> """<STR_LIT>""" <EOL> metadata [ '<STR_LIT:type>' ] = '<STR_LIT>' <EOL> if ( not force ) and ( fset is None ) : <EOL> sum = ( ( fget is not None ) + <EOL> ( fvalidate is not None ) + <EOL> ( trait is not None ) ) <EOL> if sum <= <NUM_LIT:1> : <EOL> if sum == <NUM_LIT:0> : <EOL> return ForwardProperty ( metadata ) <EOL> handler = None <EOL> if fget is not None : <EOL> trait = fget <EOL> if trait is not None : <EOL> trait = trait_cast ( trait ) <EOL> if trait is not None : <EOL> fvalidate = handler = trait . handler <EOL> if fvalidate is not None : <EOL> fvalidate = handler . validate <EOL> if ( fvalidate is not None ) or ( trait is not None ) : <EOL> if '<STR_LIT>' not in metadata : <EOL> if ( trait is not None ) and ( trait . editor is not None ) : <EOL> metadata [ '<STR_LIT>' ] = trait . editor <EOL> return ForwardProperty ( metadata , fvalidate , handler ) <EOL> if fget is None : <EOL> metadata [ '<STR_LIT>' ] = True <EOL> if fset is None : <EOL> fget = _undefined_get <EOL> fset = _undefined_set <EOL> else : <EOL> fget = _write_only <EOL> elif fset is None : <EOL> fset = _read_only <EOL> metadata [ '<STR_LIT>' ] = True <EOL> if trait is not None : <EOL> trait = trait_cast ( trait ) <EOL> handler = trait . handler <EOL> if ( fvalidate is None ) and ( handler is not None ) : <EOL> fvalidate = handler . validate <EOL> if ( '<STR_LIT>' not in metadata ) and ( trait . editor is not None ) : <EOL> metadata [ '<STR_LIT>' ] = trait . editor <EOL> metadata . setdefault ( '<STR_LIT>' , getattr ( fget , '<STR_LIT>' , None ) ) <EOL> if ( ( metadata . get ( '<STR_LIT>' ) is not None ) and <EOL> getattr ( fget , '<STR_LIT>' , False ) ) : <EOL> metadata . setdefault ( '<STR_LIT>' , True ) <EOL> n = <NUM_LIT:0> <EOL> trait = CTrait ( <NUM_LIT:4> ) <EOL> trait . __dict__ = metadata . copy ( ) <EOL> if fvalidate is not None : <EOL> n = _arg_count ( fvalidate ) <EOL> trait . property ( fget , _arg_count ( fget ) , <EOL> fset , _arg_count ( fset ) , <EOL> fvalidate , n ) <EOL> trait . handler = handler <EOL> return trait <EOL> Property = TraitFactory ( Property ) <EOL> class ForwardProperty ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , metadata , validate = None , handler = None ) : <EOL> self . metadata = metadata . copy ( ) <EOL> self . validate = validate <EOL> self . handler = handler <EOL> SpecialNames = { <EOL> } <EOL> generic_trait = CTrait ( <NUM_LIT:8> ) <EOL> def Color ( * args , ** metadata ) : <EOL> """<STR_LIT>""" <EOL> from traitsui . toolkit_traits import ColorTrait <EOL> return ColorTrait ( * args , ** metadata ) <EOL> Color = TraitFactory ( Color ) <EOL> def RGBColor ( * args , ** metadata ) : <EOL> """<STR_LIT>""" <EOL> from traitsui . toolkit_traits import RGBColorTrait <EOL> return RGBColorTrait ( * args , ** metadata ) <EOL> RGBColor = TraitFactory ( RGBColor ) <EOL> def Font ( * args , ** metadata ) : <EOL> """<STR_LIT>""" <EOL> from traitsui . toolkit_traits import FontTrait <EOL> return FontTrait ( * args , ** metadata ) <EOL> Font = TraitFactory ( Font ) </s>
