<s> """<STR_LIT>""" <EOL> import copy <EOL> import json <EOL> from cafe . engine . models . base import AutoMarshallingListModel , AutoMarshallingModel <EOL> class Network ( AutoMarshallingModel ) : <EOL> """<STR_LIT>""" <EOL> NETWORK = '<STR_LIT>' <EOL> def __init__ ( self , id_ = None , name = None , admin_state_up = None , <EOL> status = None , subnets = None , shared = None , tenant_id = None , <EOL> ** kwargs ) : <EOL> super ( Network , self ) . __init__ ( ) <EOL> self . id = id_ <EOL> self . name = name <EOL> self . admin_state_up = admin_state_up <EOL> self . status = status <EOL> self . subnets = subnets <EOL> self . shared = shared <EOL> self . tenant_id = tenant_id <EOL> self . kwargs = kwargs <EOL> @ classmethod <EOL> def _json_to_obj ( cls , serialized_str ) : <EOL> """<STR_LIT>""" <EOL> ret = None <EOL> json_response = json . loads ( serialized_str ) <EOL> json_dict = copy . deepcopy ( json_response ) <EOL> json_dict = cls . _replace_dict_key ( <EOL> json_dict , '<STR_LIT:id>' , '<STR_LIT>' , recursion = True ) <EOL> if cls . NETWORK in json_dict : <EOL> network_dict = json_dict . get ( cls . NETWORK ) <EOL> ret = Network ( ** network_dict ) <EOL> return ret <EOL> class Networks ( AutoMarshallingListModel ) : <EOL> NETWORKS = '<STR_LIT>' <EOL> @ classmethod <EOL> def _json_to_obj ( cls , serialized_str ) : <EOL> """<STR_LIT>""" <EOL> ret = cls ( ) <EOL> json_response = json . loads ( serialized_str ) <EOL> json_dict = copy . deepcopy ( json_response ) <EOL> json_dict = cls . _replace_dict_key ( <EOL> json_dict , '<STR_LIT:id>' , '<STR_LIT>' , recursion = True ) <EOL> if cls . NETWORKS in json_dict : <EOL> networks = json_dict . get ( cls . NETWORKS ) <EOL> for network in networks : <EOL> ret . append ( Network ( ** network ) ) <EOL> return ret </s>
