Skip to content

Commit

Permalink
Update utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrjones committed Dec 22, 2024
1 parent 125a729 commit 608f390
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/zarr/storage/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def _normalize_byte_range_index(data: Buffer, byte_range: ByteRangeRequest) -> t
elif isinstance(byte_range, tuple):
start = byte_range[0]
length = byte_range[1] - start
elif start := byte_range.get("offset"):
length = len(data) - start
elif suffix := byte_range.get("suffix"):
start = len(data) - suffix
elif "offset" in byte_range:
length = len(data) - byte_range["offset"]
elif "suffix" in byte_range:
start = len(data) - byte_range["suffix"]
length = len(data) - start
return (start, length)

0 comments on commit 608f390

Please sign in to comment.