diff --git a/rebench/denoise.py b/rebench/denoise.py index ef2e40dc..45f97e02 100644 --- a/rebench/denoise.py +++ b/rebench/denoise.py @@ -191,9 +191,7 @@ def _set_scaling_governor(governor, num_cores): filename = ( "/sys/devices/system/cpu/cpu" + str(cpu_i) + "/cpufreq/scaling_governor" ) - with open( - filename, "w" - ) as gov_file: # pylint: disable=unspecified-encoding + with open(filename, "w", encoding="utf-8") as gov_file: gov_file.write(governor + "\n") except IOError: return "failed" @@ -208,8 +206,9 @@ def _set_no_turbo(with_no_turbo): value = "0" try: - # pylint: disable-next=unspecified-encoding - with open("/sys/devices/system/cpu/intel_pstate/no_turbo", "w") as nt_file: + with open( + "/sys/devices/system/cpu/intel_pstate/no_turbo", "w", encoding="utf-8" + ) as nt_file: nt_file.write(value + "\n") except IOError: return "failed" @@ -218,22 +217,25 @@ def _set_no_turbo(with_no_turbo): def _configure_perf_sampling(for_profiling): try: - # pylint: disable-next=unspecified-encoding - with open("/proc/sys/kernel/perf_cpu_time_max_percent", "w") as perc_file: + with open( + "/proc/sys/kernel/perf_cpu_time_max_percent", "w", encoding="utf-8" + ) as perc_file: if for_profiling: perc_file.write("0\n") else: perc_file.write("1\n") - # pylint: disable-next=unspecified-encoding - with open("/proc/sys/kernel/perf_event_max_sample_rate", "w") as sample_file: + with open( + "/proc/sys/kernel/perf_event_max_sample_rate", "w", encoding="utf-8" + ) as sample_file: # for profiling we just disabled it above, and then don't need to set it if not for_profiling: sample_file.write("1\n") if for_profiling: - # pylint: disable-next=unspecified-encoding - with open("/proc/sys/kernel/perf_event_paranoid", "w") as perf_file: + with open( + "/proc/sys/kernel/perf_event_paranoid", "w", encoding="utf-8" + ) as perf_file: perf_file.write("-1\n") except IOError: return "failed" @@ -246,16 +248,19 @@ def _configure_perf_sampling(for_profiling): def _restore_perf_sampling(): try: - # pylint: disable-next=unspecified-encoding - with open("/proc/sys/kernel/perf_cpu_time_max_percent", "w") as perc_file: + with open( + "/proc/sys/kernel/perf_cpu_time_max_percent", "w", encoding="utf-8" + ) as perc_file: perc_file.write("25\n") - # pylint: disable-next=unspecified-encoding - with open("/proc/sys/kernel/perf_event_max_sample_rate", "w") as sample_file: + with open( + "/proc/sys/kernel/perf_event_max_sample_rate", "w", encoding="utf-8" + ) as sample_file: sample_file.write("50000\n") - # pylint: disable-next=unspecified-encoding - with open("/proc/sys/kernel/perf_event_paranoid", "w") as perf_file: + with open( + "/proc/sys/kernel/perf_event_paranoid", "w", encoding="utf-8" + ) as perf_file: perf_file.write("3\n") except IOError: return "failed"