def do_sort(block_list, clear_input_blocks: bool, *_): # Handle empty dataset. if block_list.initial_num_blocks() == 0: return block_list, {} if clear_input_blocks: blocks = block_list.copy() block_list.clear() else: blocks = block_list if isinstance(key, list): if not key: raise ValueError("`key` must be a list of non-zero length") for subkey in key: _validate_key_fn(ds, subkey) else: _validate_key_fn(ds, key) return sort_impl(blocks, clear_input_blocks, key, descending)
def _validate(self, ds: "Dataset") -> None: _validate_key_fn(ds, self._key_fn)