#NEWLINE# def get_from( self , resource , version , location ) : #NEWLINE# #INDENT# if ( resource . name in [ 'apk' , 'jar' ] ) : #NEWLINE# #INDENT# return get_from_location_by_extension ( resource , location , resource . name , version ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( resource . name == 'file' ) : #NEWLINE# #INDENT# filepath = os . path . join ( location , resource . path ) #NEWLINE# if os . path . exists ( filepath ) : #NEWLINE# #INDENT# return filepath #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( resource . name == 'revent' ) : #NEWLINE# #INDENT# filename = '.' . join ( [ resource . owner . device . name , resource . stage , 'revent' ] ) . lower ( ) #NEWLINE# alternate_location = os . path . join ( location , 'revent_files' ) #NEWLINE# if os . path . isdir ( alternate_location ) : #NEWLINE# #INDENT# for candidate in os . listdir ( alternate_location ) : #NEWLINE# #INDENT# if ( candidate . lower ( ) == filename . lower ( ) ) : #NEWLINE# #INDENT# return os . path . join ( alternate_location , candidate ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if os . path . isdir ( location ) : #NEWLINE# #INDENT# for candidate in os . listdir ( location ) : #NEWLINE# #INDENT# if ( candidate . lower ( ) == filename . lower ( ) ) : #NEWLINE# #INDENT# return os . path . join ( location , candidate ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'Unexpected resource type: {}' . format ( resource . name ) )