<s> """<STR_LIT>""" <EOL> import json <EOL> import xml . etree . ElementTree as ET <EOL> from cafe . engine . models . base import AutoMarshallingModel <EOL> class Quota ( AutoMarshallingModel ) : <EOL> def __init__ ( self , cores , floating_ips , id , <EOL> injected_file_content_bytes , injected_file_path_bytes , <EOL> injected_files , instances , key_pairs , <EOL> metadata_items , ram , security_group_rules , <EOL> security_groups ) : <EOL> super ( Quota , self ) . __init__ ( ) <EOL> self . cores = cores <EOL> self . floating_ips = floating_ips <EOL> self . id = id <EOL> self . injected_file_content_bytes = injected_file_content_bytes <EOL> self . injected_file_path_bytes = injected_file_path_bytes <EOL> self . injected_files = injected_files <EOL> self . instances = instances <EOL> self . key_pairs = key_pairs <EOL> self . metadata_items = metadata_items <EOL> self . ram = ram <EOL> self . security_group_rules = security_group_rules <EOL> self . security_groups = security_groups <EOL> @ classmethod <EOL> def _dict_to_obj ( self , quota_dict ) : <EOL> return Quota ( quota_dict . get ( '<STR_LIT>' ) , <EOL> quota_dict . get ( '<STR_LIT>' ) , <EOL> quota_dict . get ( '<STR_LIT:id>' ) , <EOL> quota_dict . get ( '<STR_LIT>' ) , <EOL> quota_dict . get ( '<STR_LIT>' ) , <EOL> quota_dict . get ( '<STR_LIT>' ) , <EOL> quota_dict . get ( '<STR_LIT>' ) , <EOL> quota_dict . get ( '<STR_LIT>' ) , <EOL> quota_dict . get ( '<STR_LIT>' ) , <EOL> quota_dict . get ( '<STR_LIT>' ) , <EOL> quota_dict . get ( '<STR_LIT>' ) , <EOL> quota_dict . get ( '<STR_LIT>' ) ) <EOL> @ classmethod <EOL> def _json_to_obj ( cls , serialized_str ) : <EOL> """<STR_LIT>""" <EOL> quota_dict = json . loads ( serialized_str ) <EOL> quota = cls . _dict_to_obj ( quota_dict . get ( '<STR_LIT>' ) ) <EOL> return quota <EOL> @ classmethod <EOL> def _xml_ele_to_obj ( cls , element ) : <EOL> quota_dict = dict ( ( x . tag , x . text ) for x in element . _children ) <EOL> quota_dict . update ( element . attrib ) <EOL> quota = cls . _dict_to_obj ( quota_dict ) <EOL> return quota <EOL> @ classmethod <EOL> def _xml_to_obj ( cls , serialized_str ) : <EOL> """<STR_LIT>""" <EOL> element = ET . fromstring ( serialized_str ) <EOL> quota = cls . _xml_ele_to_obj ( element ) <EOL> return quota </s>
