dgs.utils.state.collate_lists

dgs.utils.state.collate_lists(batch: State | list[State] | list[list[State]]) list[State][source]

Collate function used to not concatenate a batch of States.

Given the batch data, return a list of states. If the batch data is a single state, a list with the single state is returned. If the batch data is a list of states, the list is returned. if the batch data is a list containing list of states, the sub-list of states is collated using the regular collate_states() function. Thus, a list of collated states is returned.

Parameters:

batch – Either a list of States, a single State, or a list containing list of States.

Returns:

A list of States. Every State can have a different number of items.