#NEWLINE# def __api_descriptor( self , services , hostname = None ) : #NEWLINE# #INDENT# "Builds a description of an API.\n\n    Args:\n      services: List of protorpc.remote.Service instances implementing an\n        api/version.\n      hostname: string, Hostname of the API, to override the value set on the\n        current service. Defaults to None.\n\n    Returns:\n      A dictionary that can be deserialized into JSON and stored as an API\n      description document.\n\n    Raises:\n      ApiConfigurationError: If there's something wrong with the API\n        configuration, such as a multiclass API decorated with different API\n        descriptors (see the docstring for api()), or a repeated method\n        signature.\n    " #NEWLINE# merged_api_info = self . __get_merged_api_info ( services ) #NEWLINE# descriptor = self . get_descriptor_defaults ( merged_api_info , hostname = hostname ) #NEWLINE# description = merged_api_info . description #NEWLINE# if ( ( not description ) and ( len ( services ) == 1 ) ) : #NEWLINE# #INDENT# description = services [ 0 ] . __doc__ #NEWLINE# #UNINDENT# if description : #NEWLINE# #INDENT# descriptor [ 'description' ] = description #NEWLINE# #UNINDENT# auth_descriptor = self . __auth_descriptor ( merged_api_info ) #NEWLINE# if auth_descriptor : #NEWLINE# #INDENT# descriptor [ 'auth' ] = auth_descriptor #NEWLINE# #UNINDENT# method_map = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# method_collision_tracker = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for service in services : #NEWLINE# #INDENT# remote_methods = service . all_remote_methods ( ) #NEWLINE# for ( protorpc_meth_name , protorpc_meth_info ) in remote_methods . iteritems ( ) : #NEWLINE# #INDENT# method_info = getattr ( protorpc_meth_info , 'method_info' , None ) #NEWLINE# if ( method_info is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# method_id = method_info . method_id ( service . api_info ) #NEWLINE# self . __id_from_name [ protorpc_meth_name ] = method_id #NEWLINE# method_map [ method_id ] = self . __method_descriptor ( service , service . __name__ , method_info , protorpc_meth_name , protorpc_meth_info ) #NEWLINE# if ( method_id in method_collision_tracker ) : #NEWLINE# #INDENT# raise ApiConfigurationError ( ( 'Method %s used in multiple classes: %s and %s' % ( method_id , method_collision_tracker [ method_id ] , method_map . __name__ ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# method_collision_tracker [ method_id ] = service . __name__ #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if method_map : #NEWLINE# #INDENT# descriptor [ 'methods' ] = method_map #NEWLINE# descriptor [ 'descriptor' ] = self . __schema_descriptor ( services ) #NEWLINE# #UNINDENT# return descriptor