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 Support for JSONL Writer #628
Add Support for JSONL Writer #628
Conversation
* If lines=true in kwargs, write in JSONL format * Add test for writing to JSONL file
…nto f/jsonl-writer-support
Pull Request Test Coverage Report for Build 3111981167
💛 - Coveralls |
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.
Found 16 potential problems in the proposed changes. Check the Files changed tab for more details.
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.
Found 12 potential problems in the proposed changes. Check the Files changed tab for more details.
... print(open('example.file3.jsonl').read()) | ||
{"name": "Gilbert", "wins": [["straight", "7S"], ["one pair", "10H"]]} | ||
{"name": "Alexa", "wins": [["two pair", "4S"], ["two pair", "9S"]]} | ||
{"name": "May", "wins": []} |
Check warning
Code scanning / Pylint (reported by Codacy)
Trailing whitespace
{"name": "Alexa", "wins": [["two pair", "4S"], ["two pair", "9S"]]} | ||
{"name": "May", "wins": []} | ||
{"name": "Deloise", "wins": [["three of a kind", "5S"]]} | ||
|
Check warning
Code scanning / Pylint (reported by Codacy)
Trailing whitespace
finally: | ||
f.detach() | ||
|
||
|
||
def _writeobj(encoder, obj, f, prefix, suffix): | ||
def _writeobj(encoder, obj, f, prefix, suffix, lines=False): |
Check warning
Code scanning / Pylint (reported by Codacy)
Argument name "f" doesn't conform to snake_case naming style
>>> table1 = [['name', 'wins'], | ||
... ['Gilbert', [['straight', '7S'], ['one pair', '10H']]], | ||
... ['Alexa', [['two pair', '4S'], ['two pair', '9S']]], | ||
... ['May', []], |
Check warning
Code scanning / Pylint (reported by Codacy)
Trailing whitespace
{"name": "May", "wins": []} | ||
{"name": "Deloise", "wins": [["three of a kind", "5S"]]} | ||
|
||
|
Check warning
Code scanning / Pylint (reported by Codacy)
Trailing whitespace
finally: | ||
f.detach() | ||
|
||
|
||
def _writeobj(encoder, obj, f, prefix, suffix): | ||
def _writeobj(encoder, obj, f, prefix, suffix, lines=False): |
Check warning
Code scanning / Pylint (reported by Codacy)
Too many arguments (6/5)
assert result[2]['bar'] == 2 | ||
|
||
|
||
def test_tojson_2(): |
Check warning
Code scanning / Pylint (reported by Codacy)
Missing function docstring
@@ -49,3 +50,44 @@ | |||
|
|||
ieq(expect, actual) | |||
ieq(expect, actual) # verify can iterate twice | |||
|
|||
|
|||
def test_tojson_1(): |
Check warning
Code scanning / Pylint (reported by Codacy)
Missing function docstring
['Alexa', [['two pair', '4S'], ['two pair', '9S']]], | ||
['May', []], | ||
['Deloise', [['three of a kind', '5S']]]] | ||
f = NamedTemporaryFile(delete=False, mode='r') |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "f" doesn't conform to snake_case naming style
('a', 1), | ||
('b', 2), | ||
('c', 2)) | ||
f = NamedTemporaryFile(delete=False, mode='r') |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "f" doesn't conform to snake_case naming style
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.
- Nice feature! Well done. 👍
- I noticed you flagged the "ready to review" and after reading it, I think it's pretty good.
- I have just one suggestion:
- For preserving the code history, it may be better to consolidate the changes in 2 or 3 atomic commits:
.gitignore
json.py
test_jsonl.py
(but it's ok if grouped together with the previous)
- Do you mind making a
git rebase -i master
for rewriting/squashing the commits?
- For preserving the code history, it may be better to consolidate the changes in 2 or 3 atomic commits:
This PR has the objective of adding support for writing to JSONL files
Changes
lines
argument is set to trueChecklist
Use this checklist for assuring the quality of pull requests that include new code and or make changes to existing code.
tox
/pytest