Repository navigation
fix: accept lists of byte values as fill values for byte dtypes - #4493
Open
barlowa124 wants to merge 3 commits into
Open
barlowa124 wants to merge 3 commits into
barlowa124 wants to merge 3 commits into
Conversation
The Zarr V3 spec allows fill values for byte data types to be given either as a base64-encoded string or as an array of byte values, but from_json_scalar only accepted the string form. NullTerminatedBytes, RawBytes, and VariableLengthBytes now accept a JSON list of integers in [0, 255] and reject non-byte elements with a clear TypeError. Refs zarr-developers#4453 Generated with Devin Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4493 +/- ##
=======================================
Coverage 94.69% 94.70%
=======================================
Files 94 94
Lines 13606 13627 +21
=======================================
+ Hits 12884 12905 +21
Misses 722 722
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Summary
Refs #4453, fourth checklist item. A
fill_valueon a byte data typemust be written as a base64 string today, though the Zarr V3 spec also
permits a list of byte values.
from_json_scalaronNullTerminatedBytes,RawBytesandVariableLengthBytesrejectedthat form, so a spec-valid
fill_value: [65]raisedTypeError.The new
check_json_byte_listinnpy/common.pymatches a JSON listof integers 0 through 255, booleans excluded. All three byte dtypes
accept the form and convert through
bytes(...). Anything else fallsthrough to the existing
TypeError, whose message now names bothaccepted forms.
For reviewers
Open question: should a byte list longer than the fixed length be
rejected rather than truncated by
np.bytes_/np.void? Silenttruncation is kept because the base64 path already behaves that way,
keeping the two forms consistent.
Author attestation
TODO
Done:
changes/Outstanding:
docs/user-guide/*.md