def _get_zip_keys(spec): """ Extracts zip_keys from `spec` and standardizes value into a list of zip_groups (tuples of keys (string)). :param spec: :type spec: `dict` :return: Standardized zip_keys value :rtype: `list` of `tuple` of `str` :raise ValueError: zip_keys cannot be standardized """ zip_keys = spec.get('zip_keys') if not zip_keys: return [] elif islist(zip_keys, uniform=lambda e: isinstance(e, string_types)): return [tuple(zip_keys)] elif islist(zip_keys, uniform=lambda e: islist(e, uniform=lambda e: isinstance(e, string_types))): return [tuple(zg) for zg in zip_keys] raise ValueError("zip_keys expect list of string or list of lists of string")
def _get_zip_keys(spec): """ Extracts 'zip_keys' from `spec` and standardizes value into a list of zip_groups (tuples of keys (string)). :param spec: Variants specification :type spec: dict :return: Standardized 'zip_keys' value :rtype: set :raise ValueError: 'zip_keys' cannot be standardized """ zip_keys = spec.get('zip_keys') if not zip_keys: return set() elif islist(zip_keys, uniform=lambda e: isinstance(e, string_types)): return {frozenset(zip_keys)} elif islist(zip_keys, uniform=lambda e: islist( e, uniform=lambda e: isinstance(e, string_types))): return {frozenset(zg) for zg in zip_keys} raise ValueError( "'zip_keys' expect list of string or list of lists of string")