@staticmethod
    def combine_profiles(profile_dir, outfile, sortby='cumulative'):
        s = StringIO.StringIO()
        stat_files = [f for f in os.listdir(profile_dir) if os.path.isfile(os.path.join(profile_dir, f))
                      or f.endswith('.stats')]
        ps = pstats.Stats(os.path.join(profile_dir, stat_files[0]), stream=s)
        if len(stat_files) > 1:
            for stat in stat_files[1:]:
                ps.add(os.path.join(profile_dir, stat))

        profile_name = os.path.join(profile_dir, '{}.profile'.format(outfile.replace('.profile', '')))
        with open(profile_name, 'w') as f:
            ps.strip_dirs()
            ps.sort_stats(sortby)
            ps.print_stats()
            f.write(s.getvalue())
dataset/ETHPy150Open lobocv/pyperform/pyperform/thread.py/_Profiler.combine_profiles/operator `and` -> `or`