PYTHON-5121 - Use canonical Extended JSON for BSON binary vector spec…#2215
Merged
NoahStapp merged 3 commits intomongodb:masterfrom Mar 24, 2025
Merged
PYTHON-5121 - Use canonical Extended JSON for BSON binary vector spec…#2215NoahStapp merged 3 commits intomongodb:masterfrom
NoahStapp merged 3 commits intomongodb:masterfrom
Conversation
ShaneHarvey
requested changes
Mar 24, 2025
test/test_bson_binary_vector.py
Outdated
| _TEST_PATH = Path(__file__).parent / "bson_binary_vector" | ||
|
|
||
|
|
||
| def convert_extended_json(vector) -> float: |
Member
There was a problem hiding this comment.
Can we load the entire JSON file using json_util.loads() instead?
Contributor
Author
There was a problem hiding this comment.
I added a new json_util.load() method for this exact purpose.
ShaneHarvey
requested changes
Mar 24, 2025
bson/json_util.py
Outdated
| return json.loads(s, *args, **kwargs) | ||
|
|
||
|
|
||
| def load(fp: Any, *args: Any, **kwargs: Any) -> Any: |
Member
There was a problem hiding this comment.
Let's open a new ticket for this. Adding this increases the scope of this ticket too much and opens other questions like "do we also need json_util.dump?"
I also question if this is valuable enough to add since it's pretty simple to use json_util.loads:
json_util.loads(fp.read())
Contributor
Author
There was a problem hiding this comment.
Good point--I don't think we need json_util.load() when we can use json_util.loads(fp.read()).
ShaneHarvey
approved these changes
Mar 24, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
… tests