Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce ruff/Perflint rules (PERF) #265

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
DimitriPapadopoulos marked this conversation as resolved.
Show resolved Hide resolved

# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
Expand Down
Loading