

def coerce_subset_groups(collect):
    '\n    If necessary, reassign non-grouped subsets in a DataCollection\n    into SubsetGroups.\n\n    This is used to support DataCollections saved with\n    version 1 of glue.core.state.save_data_collection\n    '
    for data in collect:
        for subset in data.subsets:
            if (not isinstance(subset, GroupedSubset)):
                warn('DataCollection has subsets outside of subset groups, which are no longer supported. Moving to subset groups')
                subset.delete()
                grp = collect.new_subset_group()
                grp.subset_state = subset.subset_state
                grp.style = subset.style
                grp.label = subset.label

dataset/ETHPy150Open glue-viz/glue/glue/core/subset_group.py coerce_subset_groups/original