#NEWLINE# def module_completion( line ) : #NEWLINE# #INDENT# "\n    Returns a list containing the completion possibilities for an import line.\n\n    The line looks like this :\n    'import xml.d'\n    'from xml.dom import'\n    " #NEWLINE# words = line . split ( ' ' ) #NEWLINE# nwords = len ( words ) #NEWLINE# if ( ( nwords == 3 ) and ( words [ 0 ] == 'from' ) ) : #NEWLINE# #INDENT# return [ 'import ' ] #NEWLINE# #UNINDENT# if ( ( nwords < 3 ) and ( words [ 0 ] in [ 'import' , 'from' ] ) ) : #NEWLINE# #INDENT# if ( nwords == 1 ) : #NEWLINE# #INDENT# return get_root_modules ( ) #NEWLINE# #UNINDENT# mod = words [ 1 ] . split ( '.' ) #NEWLINE# if ( len ( mod ) < 2 ) : #NEWLINE# #INDENT# return get_root_modules ( ) #NEWLINE# #UNINDENT# completion_list = try_import ( '.' . join ( mod [ : ( - 1 ) ] ) , True ) #NEWLINE# return [ '.' . join ( ( mod [ : ( - 1 ) ] + [ el ] ) ) for el in completion_list ] #NEWLINE# #UNINDENT# if ( ( nwords >= 3 ) and ( words [ 0 ] == 'from' ) ) : #NEWLINE# #INDENT# mod = words [ 1 ] #NEWLINE# return try_import ( mod )