@staticmethod
    def detect_script_type(script_path):
        if not isinstance(script_path, string_types) and not isinstance(script_path, text_type):
            raise ValueError("Nothing to test, no files were provided in scenario")

        if not os.path.exists(script_path):
            raise ValueError("Script %s doesn't exist" % script_path)

        file_types = set()

        if os.path.isfile(script_path):  # regular file received
            file_types.add(os.path.splitext(script_path)[1].lower())
        else:  # dir received: check files
            for walk_rec in os.walk(script_path):
                for file_name in walk_rec[2]:
                    file_types.add(os.path.splitext(file_name)[1].lower())

        if '.java' in file_types:
            file_ext = '.java'
        elif '.py' in file_types:
            file_ext = '.py'
        elif '.jar' in file_types:
            file_ext = '.jar'
        else:
            raise ValueError("Unsupported script type: %s" % script_path)

        return file_ext
Pay attention - prepared data should not only be sorted,
dataset/ETHPy150Open Blazemeter/taurus/bzt/modules/selenium.py/SeleniumExecutor.detect_script_type--crossover with--dataset/ETHPy150Open anaderi/lhcb_trigger_ml/hep_ml/metrics_utils.py/_ks_2samp_fast