Skip to content

Conversation

NoahStapp
Copy link
Contributor

… tests

@NoahStapp NoahStapp requested a review from caseyclements March 24, 2025 15:05
_TEST_PATH = Path(__file__).parent / "bson_binary_vector"


def convert_extended_json(vector) -> float:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we load the entire JSON file using json_util.loads() instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a new json_util.load() method for this exact purpose.

@NoahStapp NoahStapp requested review from ShaneHarvey and removed request for caseyclements March 24, 2025 18:16
return json.loads(s, *args, **kwargs)


def load(fp: Any, *args: Any, **kwargs: Any) -> Any:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point--I don't think we need json_util.load() when we can use json_util.loads(fp.read()).

@NoahStapp NoahStapp requested a review from ShaneHarvey March 24, 2025 19:41
@NoahStapp NoahStapp merged commit 296046c into mongodb:master Mar 24, 2025
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants