<s> from mixbox import entities <EOL> import cybox . bindings . cybox_common as common_binding <EOL> from cybox . common import String , StructuredText <EOL> class PlatformSpecification ( entities . Entity ) : <EOL> '''<STR_LIT>''' <EOL> _namespace = '<STR_LIT>' <EOL> def __init__ ( self ) : <EOL> super ( PlatformSpecification , self ) . __init__ ( ) <EOL> self . description = None <EOL> self . identifiers = [ ] <EOL> def to_obj ( self , return_obj = None , ns_info = None ) : <EOL> self . _collect_ns_info ( ns_info ) <EOL> platform_specification_obj = common_binding . PlatformSpecificationType ( ) <EOL> if self . description is not None : platform_specification_obj . Description = self . description . to_obj ( ns_info = ns_info ) <EOL> if len ( self . identifiers ) > <NUM_LIT:0> : <EOL> for identifier in self . identifiers : platform_specification_obj . add_Identifier ( identifier . to_obj ( ns_info = ns_info ) ) <EOL> return platform_specification_obj <EOL> def to_dict ( self ) : <EOL> platform_specification_dict = { } <EOL> if self . description is not None : platform_specification_dict [ '<STR_LIT:description>' ] = self . description . to_dict ( ) <EOL> if len ( self . identifiers ) > <NUM_LIT:0> : <EOL> identifier_list = [ x . to_dict ( ) for x in self . identifiers ] <EOL> platform_specification_dict [ '<STR_LIT>' ] = identifier_list <EOL> return platform_specification_dict <EOL> @ staticmethod <EOL> def from_dict ( platform_specification_dict ) : <EOL> if not platform_specification_dict : <EOL> return None <EOL> platform_specification_ = PlatformSpecification ( ) <EOL> platform_specification_ . description = StructuredText . from_dict ( platform_specification_dict . get ( '<STR_LIT:description>' ) ) <EOL> platform_specification_ . identifiers = [ PlatformIdentifier . from_dict ( x ) for x in platform_specification_dict . get ( '<STR_LIT>' , [ ] ) ] <EOL> return platform_specification_ <EOL> @ staticmethod <EOL> def from_obj ( platform_specification_obj ) : <EOL> if not platform_specification_obj : <EOL> return None <EOL> platform_specification_ = PlatformSpecification ( ) <EOL> platform_specification_ . description = StructuredText . from_obj ( platform_specification_obj . Description ) <EOL> platform_specification_ . identifiers = [ PlatformIdentifier . from_obj ( x ) for x in platform_specification_obj . Identifier ] <EOL> return platform_specification_ <EOL> class PlatformIdentifier ( String ) : <EOL> _binding_class = common_binding . PlatformIdentifierType <EOL> _namespace = '<STR_LIT>' <EOL> def __init__ ( self ) : <EOL> super ( PlatformIdentifier , self ) . __init__ ( ) <EOL> self . system = None <EOL> self . system_ref = None <EOL> def to_obj ( self , return_obj = None , ns_info = None ) : <EOL> self . _collect_ns_info ( ns_info ) <EOL> platform_identifier_obj = super ( PlatformIdentifier , self ) . to_obj ( return_obj = return_obj , ns_info = ns_info ) <EOL> if self . system is not None : platform_identifier_obj . system = self . system <EOL> if self . system_ref is not None : platform_identifier_obj . system_ref = self . system_ref <EOL> return platform_identifier_obj <EOL> def to_dict ( self ) : <EOL> platform_identifier_dict = super ( PlatformIdentifier , self ) . to_dict ( ) <EOL> if self . system is not None : platform_identifier_dict [ '<STR_LIT>' ] = self . system <EOL> if self . system_ref is not None : platform_identifier_dict [ '<STR_LIT>' ] = self . system_ref <EOL> return platform_identifier_dict <EOL> @ staticmethod <EOL> def from_dict ( platform_identifier_dict ) : <EOL> if not platform_identifier_dict : <EOL> return None <EOL> platform_identifier_ = PlatformIdentifier ( ) <EOL> platform_identifier_ . system = platform_identifier_dict . get ( '<STR_LIT>' ) <EOL> platform_identifier_ . system_ref = platform_identifier_dict . get ( '<STR_LIT>' ) <EOL> return platform_identifier_ <EOL> @ staticmethod <EOL> def from_obj ( platform_identifier_obj ) : <EOL> if not platform_identifier_obj : <EOL> return None <EOL> platform_identifier_ = PlatformIdentifier ( ) <EOL> platform_identifier_ . system = platform_identifier_obj . system <EOL> platform_identifier_ . system_ref = platform_identifier_obj . system_ref <EOL> return platform_identifier_ </s>
