def _save(self, group, data, ids=None): serialized_data = serialize_chunk(data) max_bin_len = utils.get_maximum(serialized_data, len) with HDF5File() as file: dataset = self._create_dataset(file.create_group(group), len(serialized_data), str(max_bin_len)) ids = self._write(dataset, serialized_data, ids or self._get_unique_ids(dataset)) self._update_indices(data, ids) return ids
def test_get_maximum_empty(empty_list_data, func): assert (utils.get_maximum(empty_list_data, func) == None)
def test_get_maximum_int(string_int_list_data): assert (utils.get_maximum(string_int_list_data, int) == 12)
def test_get_maximum_len(string_list_data): assert (utils.get_maximum(string_list_data, len) == 15)
def _get_next_dataset_name(self, group): max_idx = utils.get_maximum(self._get_datasets(group), int) max_idx = -1 if max_idx is None else max_idx return str(max_idx + 1)