def setup_stubs(request_data, app_id, application_root, trusted, blobstore_path, datastore_consistency, datastore_path, datastore_require_indexes, datastore_auto_id_policy, images_host_prefix, logs_path, mail_smtp_host, mail_smtp_port, mail_smtp_user, mail_smtp_password, mail_enable_sendmail, mail_show_mail_body, matcher_prospective_search_path, search_index_path, taskqueue_auto_run_tasks, taskqueue_default_http_server, uaserver_path, user_login_url, user_logout_url, xmpp_path):
 apiproxy_stub_map.apiproxy.RegisterStub('app_identity_service', app_identity_stub.AppIdentityServiceStub())
 blob_storage = datastore_blob_storage.DatastoreBlobStorage(app_id)
 apiproxy_stub_map.apiproxy.RegisterStub('blobstore', blobstore_stub.BlobstoreServiceStub(blob_storage, request_data=request_data))
 apiproxy_stub_map.apiproxy.RegisterStub('capability_service', capability_stub.CapabilityServiceStub())
 apiproxy_stub_map.apiproxy.RegisterStub('channel', channel_service_stub.ChannelServiceStub(request_data=request_data))
 datastore = datastore_distributed.DatastoreDistributed(app_id, datastore_path, require_indexes=datastore_require_indexes, trusted=trusted)
 apiproxy_stub_map.apiproxy.ReplaceStub('datastore_v3', datastore)
 apiproxy_stub_map.apiproxy.RegisterStub('file', file_service_stub.FileServiceStub(blob_storage))
 serve_address = os.environ['NGINX_HOST']
 serve_port = int(os.environ['NGINX_PORT'])
 try:
  from google.appengine.api.images import images_stub
 except ImportError:
  logging.warning('Could not initialize images API; you are likely missing the Python "PIL" module.')
  from google.appengine.api.images import images_not_implemented_stub
  apiproxy_stub_map.apiproxy.RegisterStub('images', images_not_implemented_stub.ImagesNotImplementedServiceStub(host_prefix=images_host_prefix))
 else:
  host_prefix = 'http://{0}:{1}'.format(serve_address, serve_port)
  apiproxy_stub_map.apiproxy.RegisterStub('images', images_stub.ImagesServiceStub(host_prefix=host_prefix))
 apiproxy_stub_map.apiproxy.RegisterStub('logservice', logservice_stub.LogServiceStub(persist=True))
 apiproxy_stub_map.apiproxy.RegisterStub('mail', mail_stub.MailServiceStub(mail_smtp_host, mail_smtp_port, mail_smtp_user, mail_smtp_password, enable_sendmail=mail_enable_sendmail, show_mail_body=mail_show_mail_body))
 apiproxy_stub_map.apiproxy.RegisterStub('memcache', memcache_distributed.MemcacheService())
 apiproxy_stub_map.apiproxy.RegisterStub('search', appscale_search_stub.SearchServiceStub(app_id=app_id))
 apiproxy_stub_map.apiproxy.RegisterStub('modules', modules_stub.ModulesServiceStub(request_data))
 apiproxy_stub_map.apiproxy.RegisterStub('servers', servers_stub.ServersServiceStub(request_data))
 apiproxy_stub_map.apiproxy.RegisterStub('system', system_stub.SystemServiceStub(request_data=request_data))
 apiproxy_stub_map.apiproxy.RegisterStub('taskqueue', taskqueue_distributed.TaskQueueServiceStub(app_id, serve_address, serve_port))
 urlmatchers_to_fetch_functions = []
 urlmatchers_to_fetch_functions.extend(gcs_dispatcher.URLMATCHERS_TO_FETCH_FUNCTIONS)
 apiproxy_stub_map.apiproxy.RegisterStub('urlfetch', urlfetch_stub.URLFetchServiceStub(urlmatchers_to_fetch_functions=urlmatchers_to_fetch_functions))
 apiproxy_stub_map.apiproxy.RegisterStub('user', user_service_stub.UserServiceStub(login_url=user_login_url, logout_url=user_logout_url, request_data=request_data))
 apiproxy_stub_map.apiproxy.RegisterStub('xmpp', xmpp_service_real.XmppService(domain=xmpp_path, uaserver=uaserver_path))
 apiproxy_stub_map.apiproxy.RegisterStub('matcher', prospective_search_stub.ProspectiveSearchStub(matcher_prospective_search_path, apiproxy_stub_map.apiproxy.GetStub('taskqueue')))
 apiproxy_stub_map.apiproxy.RegisterStub('remote_socket', _remote_socket_stub.RemoteSocketServiceStub())

def setup_stubs ( request_data , app_id , application_root , trusted , blobstore_path , datastore_consistency , datastore_path , datastore_require_indexes , datastore_auto_id_policy , images_host_prefix , logs_path , mail_smtp_host , mail_smtp_port , mail_smtp_user , mail_smtp_password , mail_enable_sendmail , mail_show_mail_body , matcher_prospective_search_path , search_index_path , taskqueue_auto_run_tasks , taskqueue_default_http_server , uaserver_path , user_login_url , user_logout_url , xmpp_path ) : apiproxy_stub_map . apiproxy . RegisterStub ( 'app_identity_service' , app_identity_stub . AppIdentityServiceStub ( ) ) blob_storage = datastore_blob_storage . DatastoreBlobStorage ( app_id ) apiproxy_stub_map . apiproxy . RegisterStub ( 'blobstore' , blobstore_stub . BlobstoreServiceStub ( blob_storage , request_data = request_data ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'capability_service' , capability_stub . CapabilityServiceStub ( ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'channel' , channel_service_stub . ChannelServiceStub ( request_data = request_data ) ) datastore = datastore_distributed . DatastoreDistributed ( app_id , datastore_path , require_indexes = datastore_require_indexes , trusted = trusted ) apiproxy_stub_map . apiproxy . ReplaceStub ( 'datastore_v3' , datastore ) apiproxy_stub_map . apiproxy . RegisterStub ( 'file' , file_service_stub . FileServiceStub ( blob_storage ) ) serve_address = os . environ [ 'NGINX_HOST' ] serve_port = int ( os . environ [ 'NGINX_PORT' ] ) try : from google . appengine . api . images import images_stub except ImportError : logging . warning ( 'Could not initialize images API; you are likely missing the Python "PIL" module.' ) from google . appengine . api . images import images_not_implemented_stub apiproxy_stub_map . apiproxy . RegisterStub ( 'images' , images_not_implemented_stub . ImagesNotImplementedServiceStub ( host_prefix = images_host_prefix ) ) else : host_prefix = 'http://{0}:{1}' . format ( serve_address , serve_port ) apiproxy_stub_map . apiproxy . RegisterStub ( 'images' , images_stub . ImagesServiceStub ( host_prefix = host_prefix ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'logservice' , logservice_stub . LogServiceStub ( persist = True ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'mail' , mail_stub . MailServiceStub ( mail_smtp_host , mail_smtp_port , mail_smtp_user , mail_smtp_password , enable_sendmail = mail_enable_sendmail , show_mail_body = mail_show_mail_body ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'memcache' , memcache_distributed . MemcacheService ( ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'search' , appscale_search_stub . SearchServiceStub ( app_id = app_id ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'modules' , modules_stub . ModulesServiceStub ( request_data ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'servers' , servers_stub . ServersServiceStub ( request_data ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'system' , system_stub . SystemServiceStub ( request_data = request_data ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'taskqueue' , taskqueue_distributed . TaskQueueServiceStub ( app_id , serve_address , serve_port ) ) urlmatchers_to_fetch_functions = [ ] urlmatchers_to_fetch_functions . extend ( gcs_dispatcher . URLMATCHERS_TO_FETCH_FUNCTIONS ) apiproxy_stub_map . apiproxy . RegisterStub ( 'urlfetch' , urlfetch_stub . URLFetchServiceStub ( urlmatchers_to_fetch_functions = urlmatchers_to_fetch_functions ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'user' , user_service_stub . UserServiceStub ( login_url = user_login_url , logout_url = user_logout_url , request_data = request_data ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'xmpp' , xmpp_service_real . XmppService ( domain = xmpp_path , uaserver = uaserver_path ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'matcher' , prospective_search_stub . ProspectiveSearchStub ( matcher_prospective_search_path , apiproxy_stub_map . apiproxy . GetStub ( 'taskqueue' ) ) ) apiproxy_stub_map . apiproxy . RegisterStub ( 'remote_socket' , _remote_socket_stub . RemoteSocketServiceStub ( ) )
setup the api stubs .