#NEWLINE# @ staticmethod #NEWLINE# def detect_script_type( script_path ) : #NEWLINE# #INDENT# "\n        checks if script is java or python\n        if it's folder or single script\n\n        :param script_path: str\n        :return:\n        " #NEWLINE# if ( ( not isinstance ( script_path , string_types ) ) and ( not isinstance ( script_path , text_type ) ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Nothing to test, no files were provided in scenario' ) #NEWLINE# #UNINDENT# if ( not os . path . exists ( script_path ) ) : #NEWLINE# #INDENT# raise ValueError ( ( "Script %s doesn't exist" % script_path ) ) #NEWLINE# #UNINDENT# file_types = set ( ) #NEWLINE# if os . path . isfile ( script_path ) : #NEWLINE# #INDENT# file_types . add ( os . path . splitext ( script_path ) [ 1 ] . lower ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# for walk_rec in os . walk ( script_path ) : #NEWLINE# #INDENT# for file_name in walk_rec [ 2 ] : #NEWLINE# #INDENT# file_types . add ( os . path . splitext ( file_name ) [ 1 ] . lower ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( '.java' in file_types ) : #NEWLINE# #INDENT# file_ext = '.java' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( '.py' in file_types ) : #NEWLINE# #INDENT# file_ext = '.py' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( '.jar' in file_types ) : #NEWLINE# #INDENT# file_ext = '.jar' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( 'Unsupported script type: %s' % script_path ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return file_ext