Skip to content

Commit

Permalink
Merge pull request #245 from DimitriPapadopoulos/FURB
Browse files Browse the repository at this point in the history
Apply ruff/refurb rules (FURB)
  • Loading branch information
jaraco committed Jun 28, 2024
2 parents 5598256 + 8b9f35e commit 491cd24
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
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

0 comments on commit 491cd24

Please sign in to comment.