diff --git a/distutils/command/config.py b/distutils/command/config.py index 9818418f..c8f37029 100644 --- a/distutils/command/config.py +++ b/distutils/command/config.py @@ -103,8 +103,7 @@ def _gen_temp_sourcefile(self, body, headers, lang): filename = "_configtest" + LANG_EXT[lang] with open(filename, "w", encoding='utf-8') as file: if headers: - for header in headers: - file.write(f"#include <{header}>\n") + file.writelines(f"#include <{header}>\n" for header in headers) file.write("\n") file.write(body) if body[-1] != "\n": diff --git a/distutils/dist.py b/distutils/dist.py index d2b257b2..fff99117 100644 --- a/distutils/dist.py +++ b/distutils/dist.py @@ -445,7 +445,7 @@ def parse_config_files(self, filenames=None): # noqa: C901 try: if alias: setattr(self, alias, not strtobool(val)) - elif opt in ('verbose',): # ugh! + elif opt == 'verbose': setattr(self, opt, strtobool(val)) else: setattr(self, opt, val) diff --git a/distutils/tests/test_core.py b/distutils/tests/test_core.py index bad3fb7e..2f83162e 100644 --- a/distutils/tests/test_core.py +++ b/distutils/tests/test_core.py @@ -101,8 +101,7 @@ def test_run_setup_uses_current_dir(self, tmp_path): distutils.core.run_setup(setup_py) output = sys.stdout.getvalue() - if output.endswith("\n"): - output = output[:-1] + output = output.removesuffix("\n") assert cwd == output def test_run_setup_within_if_main(self, temp_file): diff --git a/ruff.toml b/ruff.toml index 06aa2304..46c2c23f 100644 --- a/ruff.toml +++ b/ruff.toml @@ -20,6 +20,7 @@ extend-select = [ # local "B", + "FURB", "ISC", "PERF", "RUF010",