async def serialize(sr: SR): return dict( name=sr.get_name(), description=sr.get_description(), size=sr.get_physical_size(), used=sr.get_physical_utilisation(), free=str( int(sr.get_physical_size()) - int(sr.get_physical_utilisation())), uuid=sr.get_uuid(), content_type=sr.get_content_type(), type=sr.get_type(), )
def serialize(sr: SR): vdis = sr.get_VDIs() __vdi_list = [] vdi_list = __vdi_list.append if vdis is not None: for vdi in vdis: vdi_list(_vdi_serialize(vdi)) else: __vdi_list = None return dict( name=sr.get_name(), description=sr.get_description(), size=sr.get_physical_size(), uuid=sr.get_uuid(), content_type=sr.get_content_type(), type=sr.get_type(), vdis=__vdi_list, )