<s> from toscaparser . elements . statefulentitytype import StatefulEntityType <EOL> class DataType ( StatefulEntityType ) : <EOL> '''<STR_LIT>''' <EOL> def __init__ ( self , datatypename , custom_def = None ) : <EOL> super ( DataType , self ) . __init__ ( datatypename , <EOL> self . DATATYPE_NETWORK_PREFIX , <EOL> custom_def ) <EOL> self . custom_def = custom_def <EOL> @ property <EOL> def parent_type ( self ) : <EOL> '''<STR_LIT>''' <EOL> ptype = self . derived_from ( self . defs ) <EOL> if ptype : <EOL> return DataType ( ptype , self . custom_def ) <EOL> return None <EOL> @ property <EOL> def value_type ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . entity_value ( self . defs , '<STR_LIT:type>' ) <EOL> def get_all_properties_objects ( self ) : <EOL> '''<STR_LIT>''' <EOL> props_def = self . get_properties_def_objects ( ) <EOL> ptype = self . parent_type <EOL> while ptype : <EOL> props_def . extend ( ptype . get_properties_def_objects ( ) ) <EOL> ptype = ptype . parent_type <EOL> return props_def <EOL> def get_all_properties ( self ) : <EOL> '''<STR_LIT>''' <EOL> return { prop . name : prop <EOL> for prop in self . get_all_properties_objects ( ) } <EOL> def get_all_property_value ( self , name ) : <EOL> '''<STR_LIT>''' <EOL> props_def = self . get_all_properties ( ) <EOL> if props_def and name in props_def . key ( ) : <EOL> return props_def [ name ] . value </s>
