-
Notifications
You must be signed in to change notification settings - Fork 11
implement wildcard pattern for input #59
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
Changes from all commits
fc3a570
a02a085
f0ffd0f
0c19e3d
0124e43
2fe6286
bfa3d8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,9 +28,9 @@ def set_output_directory(args): | |
return output_dir | ||
|
||
|
||
def expand_list_file(args): | ||
def _expand_user_input(args): | ||
""" | ||
Expands the list of inputs by adding files from file lists and removing the file list. | ||
Expands the list of inputs by adding files from file lists and wildcards. | ||
|
||
Parameters | ||
---------- | ||
|
@@ -48,6 +48,11 @@ def expand_list_file(args): | |
file_inputs = [input_name.strip() for input_name in f.readlines()] | ||
args.input.extend(file_inputs) | ||
args.input.remove(file_list_input) | ||
wildcard_inputs = [input_name for input_name in args.input if "*" in input_name] | ||
for wildcard_input in wildcard_inputs: | ||
input_files = [str(file) for file in Path(".").glob(wildcard_input) if "file_list" not in file.name] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we may be able to remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is for files in the glob directory (not in args.input), so if we have a file list in the same directory as the wildcard, then it'll be loaded if we don't skip it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, yes better to have it to be on the safe side. It may be better to make it stricter so |
||
args.input.extend(input_files) | ||
args.input.remove(wildcard_input) | ||
return args | ||
|
||
|
||
|
@@ -70,6 +75,7 @@ def set_input_lists(args): | |
""" | ||
|
||
input_paths = [] | ||
args = _expand_user_input(args) | ||
sbillinge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
for input_name in args.input: | ||
input_path = Path(input_name).resolve() | ||
if input_path.exists(): | ||
|
@@ -86,7 +92,7 @@ def set_input_lists(args): | |
f"Cannot find {input_name}. Please specify valid input file(s) or directories." | ||
) | ||
else: | ||
raise FileNotFoundError(f"Cannot find {input_name}") | ||
raise FileNotFoundError(f"Cannot find {input_name}.") | ||
setattr(args, "input_paths", list(set(input_paths))) | ||
return args | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.