#NEWLINE# def moduleImporterPathToFilenameAndCode( elts ) : #NEWLINE# #INDENT# 'given a list of strings (from a CodeLocation::External) return the filename\n    and file data associated with them, or return None' #NEWLINE# path = os . path . abspath ( os . path . join ( * elts ) ) #NEWLINE# if os . path . isfile ( ( path + '.fora' ) ) : #NEWLINE# #INDENT# path = ( path + '.fora' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if os . path . isfile ( ( path + '.script.fora' ) ) : #NEWLINE# #INDENT# path = ( path + '.script.fora' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# with open ( path , 'rb' ) as f : #NEWLINE# #INDENT# return ( path , f . read ( ) ) #NEWLINE# #UNINDENT# if ( ( len ( elts ) == 1 ) and os . path . isfile ( elts [ 0 ] ) ) : #NEWLINE# #INDENT# with open ( elts [ 0 ] , 'rb' ) as f : #NEWLINE# #INDENT# return ( elts [ 0 ] , f . read ( ) )