-
Notifications
You must be signed in to change notification settings - Fork 145
Fixes toJson in sc2reader/scripts/sc2json.py #118
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
Conversation
Note: the failing style check in circleci doesn't seem to be from my change 🤔
|
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 submitting this! I have a few suggestions in order of preference:
- Ideally, we make the code both Python2 and Python3 compatible. If Python3 doesn't have an equivalent parameter, then we should drop it in that case. If it's running in Python2, then we should pass it
- Alternatively, we could just drop it altogether. In that case, I would recommend that yu also remove the encoding as an argument to this function since it does nothing.
I'm not too concerned about test coverage here. I would prefer it, but I can understand if you don't want to put the extra work in to cover something that already isn't covered.
And yes, the spellcheck appears to be unrelated to your code. Since you hit on it, can you fix the spelling on that as well?
try:
factory.register_plugin(
"Replay", toJSON(encoding=args.encoding, indent=args.indent)
) # legacy Python
except TypeError:
factory.register_plugin("Replay", toJSON(indent=args.indent)) However, #85 (comment) Python 2 died 188 days ago on 1/1/2020. |
True, but I don't see why we should drop support if it is convenient enough, and in this case, it appears to be so. On this issue, if the |
|
The typo is fixed in #119 |
Fixed type - Committed suggestion from PR review ggtracker#118 Co-authored-by: Christian Clauss <[email protected]>
Sorry for the late reply only catching up on this conversation now - to clarify though:
@cclauss fixed the typo (thanks!) - I added that as a commit to this PR |
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.
LGTM
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 the change!
Fixes
toJson
insc2reader/scripts/sc2json.py
to not take encoding - encoding is not a kwarg in json.dumps in python3.7 . I'm not sure how to add tests for cli/argparse code and there don't seem to be existing tests for that part, so I hope that's ok? Also not sure about the guidelines for python2/python3 support, but this was run with python3.7.8 which should be the current main stable supported version AFAIK. I tried this patch out locally and it seemed to work for me:before:
after:
Please let me know if there's a better way I should be doing this, or if there are any other issues with the PR. Thanks!