-
Notifications
You must be signed in to change notification settings - Fork 12
load input directory and files #50
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b61906b
current progress on loading specified input file and glob all files i…
yucongalicechen f7d1174
merged updates from main
yucongalicechen d164dba
modified input file function to accept either one file or one directory
yucongalicechen 3c49a18
added test cases for UC1-4 and made input a required argument
yucongalicechen f8b7203
added more test cases
yucongalicechen 3d5c5ee
included comments for tests
yucongalicechen 06ae14b
added tests for a file list and edited help message addressing the ru…
yucongalicechen a02b573
added tests for file list and multiple files
yucongalicechen 7d39a74
fix grammar
yucongalicechen ead5830
intermediate process (more tests need to be added): using input_direc…
yucongalicechen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
def set_input_files(args): | ||
""" | ||
Set input directory and files, default is current working directory and all files in it | ||
Set input directory and files | ||
|
||
Parameters | ||
---------- | ||
|
@@ -20,12 +20,19 @@ def set_input_files(args): | |
args argparse.Namespace | ||
|
||
""" | ||
input_dir = Path.cwd() / Path(args.input_file).parent if args.input_file else Path.cwd() | ||
setattr(args, "input_directory", input_dir) | ||
if not args.input_file: | ||
input_files = glob.glob(str(input_dir) + "/*", recursive=True) | ||
if not args.input_file or not Path(args.input_file).exists(): | ||
raise ValueError("Please specify valid input file or directory.") | ||
|
||
if not Path(args.input_file).is_dir(): | ||
input_dir = Path.cwd() / Path(args.input_file).parent | ||
input_file_name = Path(args.input_file).name | ||
args.input_file = input_file_name | ||
else: | ||
input_dir = Path(args.input_file).resolve() | ||
input_files = [file for file in glob.glob(str(input_dir) + "/*", recursive=True) if os.path.isfile(file)] | ||
input_file_names = [os.path.basename(input_file_path) for input_file_path in input_files] | ||
args.input_file = input_file_names | ||
setattr(args, "input_directory", input_dir) | ||
return args | ||
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. otherwise, I think this looks good. |
||
|
||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.