Skip to content

Commit

Permalink
Merge pull request #265 from DimitriPapadopoulos/PERF
Browse files Browse the repository at this point in the history
Enforce ruff/Perflint rules (PERF)
  • Loading branch information
jaraco authored Aug 22, 2024
2 parents 164f276 + 2b5815c commit d776697
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
3 changes: 1 addition & 2 deletions distutils/archive_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions distutils/command/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion distutils/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions distutils/cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions distutils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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]

Expand Down
4 changes: 4 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d776697

Please sign in to comment.