#NEWLINE# def get_completions( self , document , complete_event ) : #NEWLINE# #INDENT# text_before_cursor = document . text_before_cursor #NEWLINE# completions = self . _completer . autocomplete ( text_before_cursor ) #NEWLINE# prompt_completions = list ( self . _convert_to_prompt_completions ( completions , text_before_cursor ) ) #NEWLINE# if ( ( not prompt_completions ) and self . _completer . last_option and ( len ( self . _completer . cmd_path ) == 3 ) ) : #NEWLINE# #INDENT# LOG . debug ( 'No local autocompletions found, trying server side completion.' ) #NEWLINE# command = self . _completer . cmd_path #NEWLINE# service = command [ 1 ] #NEWLINE# if ( service == 's3api' ) : #NEWLINE# #INDENT# service = 's3' #NEWLINE# #UNINDENT# operation = command [ 2 ] #NEWLINE# param = self . _completer . arg_metadata . get ( self . _completer . last_option , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'api_name' ) #NEWLINE# if ( param is not None ) : #NEWLINE# #INDENT# LOG . debug ( 'Trying to retrieve autcompletion for: %s, %s, %s' , service , operation , param ) #NEWLINE# results = self . _server_side_completer . retrieve_candidate_values ( service , operation , param ) #NEWLINE# LOG . debug ( 'Results for %s, %s, %s: %s' , service , operation , location , results ) #NEWLINE# word_before_cursor = text_before_cursor . strip ( ) . split ( ) [ ( - 1 ) ] #NEWLINE# location = 0 #NEWLINE# if ( ( text_before_cursor [ ( - 1 ) ] != ' ' ) and word_before_cursor and results ) : #NEWLINE# #INDENT# results = fuzzy . fuzzy_search ( word_before_cursor , results ) #NEWLINE# location = ( - len ( word_before_cursor ) ) #NEWLINE# #UNINDENT# if ( results is not None ) : #NEWLINE# #INDENT# for result in results : #NEWLINE# #INDENT# ( yield Completion ( result , location , display = result , display_meta = '' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# for c in prompt_completions : #NEWLINE# #INDENT# ( yield c )