<s> """<STR_LIT>""" <EOL> __all__ = [ "<STR_LIT>" ] <EOL> from traits . api import Dict as Enthought_Dict <EOL> from openmdao . main . datatypes . slot import Slot <EOL> from openmdao . main . interfaces import implements , IVariable <EOL> from openmdao . main . variable import gui_excludes <EOL> class Dict ( Enthought_Dict ) : <EOL> '''<STR_LIT>''' <EOL> implements ( IVariable ) <EOL> def __init__ ( self , key_trait = None , value_trait = None , value = None , <EOL> items = True , iotype = None , desc = None , ** metadata ) : <EOL> if iotype is not None : <EOL> metadata [ '<STR_LIT>' ] = iotype <EOL> if desc is not None : <EOL> metadata [ '<STR_LIT>' ] = desc <EOL> self . key_trait = key_trait <EOL> self . value_trait = value_trait <EOL> super ( Dict , self ) . __init__ ( key_trait , value_trait , value , <EOL> items , ** metadata ) <EOL> def get_attribute ( self , name , value , trait , meta ) : <EOL> """<STR_LIT>""" <EOL> attr = { } <EOL> slot_attr = None <EOL> attr [ '<STR_LIT:name>' ] = name <EOL> attr [ '<STR_LIT:type>' ] = '<STR_LIT>' <EOL> attr [ '<STR_LIT:value>' ] = value <EOL> for field in meta : <EOL> if field not in gui_excludes : <EOL> attr [ field ] = meta [ field ] <EOL> attr [ '<STR_LIT>' ] = type ( self . key_trait . trait_type ) . __name__ <EOL> attr [ '<STR_LIT>' ] = type ( self . value_trait . trait_type ) . __name__ <EOL> inner = trait . inner_traits [ - <NUM_LIT:1> ] <EOL> if inner . is_trait_type ( Slot ) : <EOL> if len ( value ) < <NUM_LIT:1> : <EOL> inner_value = None <EOL> else : <EOL> inner_value = value [ value . keys ( ) [ <NUM_LIT:0> ] ] <EOL> _ , slot_attr = inner . trait_type . get_attribute ( name , inner_value , <EOL> inner , meta ) <EOL> slot_attr [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> contents = { } <EOL> for key , val in value . items ( ) : <EOL> contents [ key ] = None if val is None else val . __class__ . __name__ <EOL> slot_attr [ '<STR_LIT>' ] = contents <EOL> return attr , slot_attr </s>
