in blog/account-c-invoice-processing/invoice_processing/schema/com_examplecorp_webstore/newordercreated/marshaller.py [0:0]
def __unmarshall_model(cls, data, typeName):
if (not typeName._types and
not cls.__hasattr(typeName, 'get_real_child_model')):
return data
kwargs = {}
if typeName._types is not None:
for attr, attr_type in six.iteritems(typeName._types):
if (data is not None and
typeName._attribute_map[attr] in data and
isinstance(data, (list, dict))):
value = data[typeName._attribute_map[attr]]
kwargs[attr] = cls.unmarshall(value, attr_type)
instance = typeName(**kwargs)
if (isinstance(instance, dict) and
typeName._types is not None and
isinstance(data, dict)):
for key, value in data.items():
if key not in typeName._types:
instance[key] = value
if cls.__hasattr(instance, 'get_real_child_model'):
type_name = instance.get_real_child_model(data)
if type_name:
instance = cls.unmarshall(data, type_name)
return instance