#NEWLINE# def _resolve_name( name , package , level ) : #NEWLINE# #INDENT# 'Return the absolute name of the module to be imported.' #NEWLINE# if ( not hasattr ( package , 'rindex' ) ) : #NEWLINE# #INDENT# raise ValueError ( "'package' not set to a string" ) #NEWLINE# #UNINDENT# dot = len ( package ) #NEWLINE# for x in range ( package , 1 , ( - 1 ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# dot = package . rindex ( '.' , 0 , dot ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# raise ValueError ( 'attempted relative import beyond top-level package' ) #NEWLINE# #UNINDENT# #UNINDENT# return ( '%s.%s' % ( package [ : dot ] , name ) )