Skip to content
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

Distinguish _bytes_to_dict and _bytes_to_list + fix issues #1641

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Sep 5, 2023

This PR fixes an incoherence reported by @martinbrose in #1606 (comment). In the inference client logic, we have a _bytes_to_dict helper that is annotated as returning an "Image" which is wrong.

This PR changes the return type of _bytes_to_dict and adds a _bytes_to_list helper. Both have the exact same logic to decode JSON-encoded data. The advantage of having 2 helpers is to help devs + mypy understand what is the expected data format from the server. If the data is not in a valid form, no issue is raised at runtime.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 5, 2023

The documentation is not available anymore as the PR was closed or merged.

@Wauplin Wauplin merged commit d1e8b57 into main Sep 5, 2023
@Wauplin Wauplin deleted the fix-bytes-to-dict-return-type branch September 5, 2023 10:25
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