-
Notifications
You must be signed in to change notification settings - Fork 205
SG-38306 Python2 Removal - Part 8 - Remove deprecated ensure_ascii parameter from SG object #405
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
base: ticket/SG-38306-python2-various
Are you sure you want to change the base?
SG-38306 Python2 Removal - Part 8 - Remove deprecated ensure_ascii parameter from SG object #405
Conversation
8ac9c8d
to
5d8b18d
Compare
2f109c4
to
f6275cd
Compare
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.
Pull Request Overview
This PR removes the legacy ensure_ascii
parameter from the Shotgun client and its mock, cleans up related JSON decoding code, and updates tests to reflect the new default JSON encoding behavior.
- Drop
ensure_ascii
argument and methods inShotgun
andMockgun
- Remove old tests and helper for Python 2
ensure_ascii
behavior; add a new test verifying non-ASCII payload encoding - Update client and API code to always use
json.dumps(..., ensure_ascii=False)
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
tests/test_client.py | Remove passing ensure_ascii to Shotgun in tests |
tests/test_api.py | Remove old ensure_ascii tests and add new JSON dump test |
shotgun_api3/shotgun.py | Remove ensure_ascii parameter, related methods, and logic |
shotgun_api3/lib/mockgun/mockgun.py | Remove ensure_ascii parameter from mock client constructor |
Comments suppressed due to low confidence (2)
tests/test_client.py:649
- [nitpick] The
ensure_ascii
parameter is no longer used inside this helper; consider removing it from the signature to avoid unused parameters.
def _assert_decode_resonse(self, ensure_ascii, data):
tests/test_api.py:831
- [nitpick] The docstring is inaccurate and has a grammar typo (
SG'payload
). Please reword to clearly state that the JSON payload is dumped withensure_ascii=False
to allow non-ASCII characters.
"""Make sure SG'payload is using ensure_ascii for json dumps"""
The ensure_ascii parameter was added in the Python 2 world when strings and bytes could be confusing when loading/dumping JSON.
Now, in the Python 3 world, this complexity does not exist anymore as there is clear different between the 2 types. Json dump will always return a string. And loader will convert any "json string" type to a default Python string (i.e. a unicode type in Py2).
PR orders
WIP