-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add functionality to convert file inputs to either json, csv or tsv. #338
Add functionality to convert file inputs to either json, csv or tsv. #338
Conversation
Thank you for the pull request!The Scribe team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :) If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and Data rooms once you're in. Also consider joining our bi-weekly Saturday dev syncs. It'd be great to have you! Maintainer checklist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good. Great work @john-thuo1 ✨
Thanks for the review @mhmohona ! I will proceed to look into the remaining tests for the functions then, |
Yes that'd be great, @john-thuo1! I'll review once those are in :) |
Checking in here, @john-thuo1 :) Do you want to do the tests in a separate PR, or continue on this one? Whatever would be best for you 😊 |
I had some challenges figuring out how to mock the input file, output directory, and output file and patching some functionalities, hence the delay, but it is all good now! I have finished the tests. You can go ahead with the review @andrewtavis and let me know of other test scenarios I can add. |
Sorry for asking, @john-thuo1, but would you be able to fix the tests given the changes that went through to the project? I'll review directly after that. I can also look into this if you'd prefer :) |
I have just pulled the changes. Going through the tests that have failed! |
Thanks, @john-thuo1! |
Merged the emoji work in as well to get rid of a merge conflict for you, @john-thuo1! Let me know if there's anything else I can do to support! |
@andrewtavis The rest of the tests are working apart from this one : |
I'll take a look at this, @john-thuo1! Thanks so much :) |
Test is fine now, @john-thuo1, at least locally. I fixed it before and there was a change overwriting the fix. Checking the rest now 😊 |
@@ -224,7 +259,9 @@ def main() -> None: | |||
return | |||
|
|||
if args.command in ["list", "l"]: | |||
list_wrapper(args.language, args.data_type, args.all) | |||
list_wrapper( | |||
language=args.language, data_type=args.data_type, all_bool=args.all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding in the args! Really appreciate explicit function calls to make the functionality more clear.
src/scribe_data/cli/main.py
Outdated
args.output_dir, | ||
args.overwrite, | ||
) | ||
convert( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functioning just like the others now 😊 I'll do a rename to convert_wrapper
for consistency and so people know this functions conditionally to call sub functions. More of a switcher, but then total_switcher
sounds a bit weird.
@andrewtavis It seems the get emoji never calls in get.py :
Proposed Alternative test case
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really really nice work here, @john-thuo1 :) Some tests needed to be commented out as I'd like to get this in, but overall this is a monumental addition to the project 😊 Really appreciate all the hard work and care you put into this!
@andrewtavis @mhmohona Thank you. The numerous back-and forths were very helpful in grasping the nuances of the task. |
Thank you, @john-thuo1! You were a perfect person to work through this :) |
Contributor Checklist
Description
This pull request adds functionality to convert data into CSV, TSV, and JSON formats. The changes include:
convert_to_json
andconvert_to_csv_or_tsv
functions inconvert.py
.main.py
to support new conversion commands.get
function to support different file formats other that JSON.Example Commands:
Tests for the convert methods have been implemented in
test_convert.py
Related issue
convert
fromget
in Scribe-Data CLI #213