Skip to content

Commit

Permalink
fix usage of determine_data_shape, and set UNLIMITED_SIZE constant fr…
Browse files Browse the repository at this point in the history
…om existing UNDEFINED_ADDRESS, as they have the same value
  • Loading branch information
bmaranville committed Feb 27, 2024
1 parent 011dedd commit e933c46
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pyfive/dataobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
from .btree import GZIP_DEFLATE_FILTER, SHUFFLE_FILTER, FLETCH32_FILTER
from .misc_low_level import Heap, SymbolTable, GlobalHeap, FractalHeap

# these constants happen to have the same value...
UNLIMITED_SIZE = UNDEFINED_ADDRESS


class DataObjects(object):
"""
Expand Down Expand Up @@ -180,7 +183,7 @@ def unpack_attribute(self, offset):
offset += _padded_size(attr_dict['datatype_size'], padding_multiple)

# read in the dataspace information
shape = determine_data_shape(self.msg_data, offset)
shape, maxshape = determine_data_shape(self.msg_data, offset)
items = int(np.product(shape))
offset += _padded_size(attr_dict['dataspace_size'], padding_multiple)

Expand Down Expand Up @@ -657,8 +660,6 @@ def is_dataset(self):
""" True when DataObjects points to a dataset, False for a group. """
return len(self.find_msg_type(DATASPACE_MSG_TYPE)) > 0

UNLIMITED_SIZE = struct.unpack('<Q', b'\xff\xff\xff\xff\xff\xff\xff\xff')[0]


def determine_data_shape(buf, offset):
""" Return the shape of the dataset pointed to in a Dataspace message. """
Expand Down

0 comments on commit e933c46

Please sign in to comment.