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

Apply ruff/refurb rules (FURB) #245

Merged
merged 5 commits into from
Apr 13, 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
4 changes: 1 addition & 3 deletions distutils/dir_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ def create_tree(base_dir, files, mode=0o777, verbose=1, dry_run=0):
'dry_run' flags are as for 'mkpath()'.
"""
# First get the list of directories to create
need_dir = set()
for file in files:
need_dir.add(os.path.join(base_dir, os.path.dirname(file)))
need_dir = set(os.path.join(base_dir, os.path.dirname(file)) for file in files)

# Now create them
for dir in sorted(need_dir):
Expand Down
8 changes: 4 additions & 4 deletions distutils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,15 +647,15 @@ def _show_help(
options = self.global_options
parser.set_option_table(options)
parser.print_help(self.common_usage + "\nGlobal options:")
print('')
print()

if display_options:
parser.set_option_table(self.display_options)
parser.print_help(
"Information display options (just display "
+ "information, ignore any commands)"
)
print('')
print()

for command in self.commands:
if isinstance(command, type) and issubclass(command, Command):
Expand All @@ -669,7 +669,7 @@ def _show_help(
else:
parser.set_option_table(klass.user_options)
parser.print_help("Options for '%s' command:" % klass.__name__)
print('')
print()

print(gen_usage(self.script_name))

Expand All @@ -686,7 +686,7 @@ def handle_display_options(self, option_order):
# we ignore "foo bar").
if self.help_commands:
self.print_commands()
print('')
print()
print(gen_usage(self.script_name))
return 1

Expand Down
2 changes: 1 addition & 1 deletion distutils/tests/test_msvc9compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_remove_visual_c_ref(self):
f = open(manifest)
try:
# removing trailing spaces
content = '\n'.join([line.rstrip() for line in f.readlines()])
content = '\n'.join([line.rstrip() for line in f])
finally:
f.close()

Expand Down
5 changes: 1 addition & 4 deletions distutils/unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,7 @@ def find_library_file(self, dirs, lib, debug=0):

roots = map(self._library_root, dirs)

searched = (
os.path.join(root, lib_name)
for root, lib_name in itertools.product(roots, lib_names)
)
searched = itertools.starmap(os.path.join, itertools.product(roots, lib_names))

found = filter(os.path.exists, searched)

Expand Down
Loading