diff --git a/distutils/archive_util.py b/distutils/archive_util.py index 07cd97f4..cc4699b1 100644 --- a/distutils/archive_util.py +++ b/distutils/archive_util.py @@ -266,8 +266,7 @@ def make_archive( raise ValueError(f"unknown archive format '{format}'") func = format_info[0] - for arg, val in format_info[1]: - kwargs[arg] = val + kwargs.update(format_info[1]) if format != 'zip': kwargs['owner'] = owner diff --git a/distutils/command/build_ext.py b/distutils/command/build_ext.py index cf475fe8..a7e3038b 100644 --- a/distutils/command/build_ext.py +++ b/distutils/command/build_ext.py @@ -638,8 +638,7 @@ def swig_sources(self, sources, extension): # Do not override commandline arguments if not self.swig_opts: - for o in extension.swig_opts: - swig_cmd.append(o) + swig_cmd.extend(extension.swig_opts) for source in swig_sources: target = swig_targets[source] diff --git a/distutils/command/install.py b/distutils/command/install.py index 1fc09eef..b83e061e 100644 --- a/distutils/command/install.py +++ b/distutils/command/install.py @@ -680,7 +680,7 @@ def create_home_path(self): if not self.user: return home = convert_path(os.path.expanduser("~")) - for _name, path in self.config_vars.items(): + for path in self.config_vars.values(): if str(path).startswith(home) and not os.path.isdir(path): self.debug_print(f"os.makedirs('{path}', 0o700)") os.makedirs(path, 0o700) diff --git a/distutils/cygwinccompiler.py b/distutils/cygwinccompiler.py index ce412e83..3743f14e 100644 --- a/distutils/cygwinccompiler.py +++ b/distutils/cygwinccompiler.py @@ -172,8 +172,7 @@ def link( # Generate .def file contents = [f"LIBRARY {os.path.basename(output_filename)}", "EXPORTS"] - for sym in export_symbols: - contents.append(sym) + contents.extend(export_symbols) self.execute(write_file, (def_file, contents), f"writing {def_file}") # next add options for def-file diff --git a/distutils/dist.py b/distutils/dist.py index 115302b3..6cc7cd0c 100644 --- a/distutils/dist.py +++ b/distutils/dist.py @@ -741,9 +741,7 @@ def print_commands(self): import distutils.command std_commands = distutils.command.__all__ - is_std = set() - for cmd in std_commands: - is_std.add(cmd) + is_std = set(std_commands) extra_commands = [cmd for cmd in self.cmdclass.keys() if cmd not in is_std] @@ -769,9 +767,7 @@ def get_command_list(self): import distutils.command std_commands = distutils.command.__all__ - is_std = set() - for cmd in std_commands: - is_std.add(cmd) + is_std = set(std_commands) extra_commands = [cmd for cmd in self.cmdclass.keys() if cmd not in is_std] diff --git a/ruff.toml b/ruff.toml index 41c9459b..0d55637d 100644 --- a/ruff.toml +++ b/ruff.toml @@ -8,11 +8,15 @@ extend-select = [ "B", "I", "ISC", + "PERF", "RUF010", "RUF100", "UP", ] ignore = [ + # local + "PERF203", + # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules "W191", "E111",