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

Update expand_source_files( ) #36

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
11 changes: 5 additions & 6 deletions importlab/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,21 @@ def expand_source_files(filenames, cwd=None):
This is a helper function for handling command line arguments that specify a
list of source files and directories.

Any directories in filenames will be scanned recursively for .py files.
Any files that do not end with ".py" will be dropped.
Any directories in filenames will be scanned recursively for files.

Args:
filenames: A list of filenames to process.
cwd: An optional working directory to expand relative paths
Returns:
A set of full paths to .py files
A set of full paths to files
"""
out = []
for f in expand_paths(filenames, cwd):
if os.path.isdir(f):
# If we have a directory, collect all the .py files within it.
out += collect_files(f, ".py")
# If we have a directory, collect all the files within it.
out += collect_files(f, ".*")
ritwik12 marked this conversation as resolved.
Show resolved Hide resolved
ritwik12 marked this conversation as resolved.
Show resolved Hide resolved
else:
if f.endswith(".py"):
if f.endswith(".*"):
out.append(f)
return set(out)

Expand Down