def make_api_version(version_data):
 from readthedocs.builds.models import Version
 for key in ['resource_uri', 'absolute_url', 'downloads']:
  if (key in version_data):
   del version_data[key]
 project_data = version_data['project']
 project = make_api_project(project_data)
 version_data['project'] = project
 ver = Version(**version_data)
 ver.save = _new_save
 return ver

def make_api_version ( version_data ) : from readthedocs . builds . models import Version for key in [ 'resource_uri' , 'absolute_url' , 'downloads' ] : if ( key in version_data ) : del version_data [ key ] project_data = version_data [ 'project' ] project = make_api_project ( project_data ) version_data [ 'project' ] = project ver = Version ( ** version_data ) ver . save = _new_save return ver
make mock version instance from api return .