# Path: zarr/errors.py
# class ArrayIndexError(IndexError):
#     pass
# 
# class NegativeStepError(IndexError):
#     def __init__(self):
#         super().__init__("only slices with step >= 1 are supported")
# 
# def err_too_many_indices(selection, shape):
#     raise IndexError('too many indices for array; expected {}, got {}'
#                      .format(len(shape), len(selection)))
# 
# class VindexInvalidSelectionError(_BaseZarrIndexError):
#     _msg = (
#         "unsupported selection type for vectorized indexing; only "
#         "coordinate selection (tuple of integer arrays) and mask selection "
#         "(single Boolean array) are supported; got {0!r}"
#     )
# 
# class BoundsCheckError(_BaseZarrIndexError):
#     _msg = "index out of bounds for dimension with length {0}"


import collections
import itertools
import math
import numbers
import numpy as np
from zarr.errors import (
    ArrayIndexError,
    NegativeStepError,
    err_too_many_indices,
    VindexInvalidSelectionError,
    BoundsCheckError,
)
    if isinstance(selection, str):
        # single field selection
        fields = selection
        selection = ()
    elif not isinstance(selection, tuple):
        # single selection item, no fields
        fields = None
        # leave selection as-is
    else:
        # multiple items, split fields from selection items
        fields = [f for f in selection if isinstance(f, str)]
        fields = fields[0] if len(fields) == 1 else fields
        selection = tuple(s for s in selection if not isinstance(s, str))
        selection = selection[0] if len(selection) == 1 else selection
    return fields, selection


def make_slice_selection(selection):
    ls = []
    for dim_selection in selection:
        if is_integer(dim_selection):
            ls.append(slice(int(dim_selection), int(dim_selection) + 1, 1))
        elif isinstance(dim_selection, np.ndarray):
            if len(dim_selection) == 1:
                ls.append(
                    slice(
                        int(dim_selection[0]), int(dim_selection[0]) + 1, 1
                    )
                )
            else:

# Path: zarr/errors.py
# class ArrayIndexError(IndexError):
#     pass
# 
# class NegativeStepError(IndexError):
#     def __init__(self):
#         super().__init__("only slices with step >= 1 are supported")
# 
# def err_too_many_indices(selection, shape):
#     raise IndexError('too many indices for array; expected {}, got {}'
#                      .format(len(shape), len(selection)))
# 
# class VindexInvalidSelectionError(_BaseZarrIndexError):
#     _msg = (
#         "unsupported selection type for vectorized indexing; only "
#         "coordinate selection (tuple of integer arrays) and mask selection "
#         "(single Boolean array) are supported; got {0!r}"
#     )
# 
# class BoundsCheckError(_BaseZarrIndexError):
#     _msg = "index out of bounds for dimension with length {0}"


# Path: zarr/indexing.py
import collections
import itertools
import math
import numbers
import numpy as np
from zarr.errors import (
    ArrayIndexError,
    NegativeStepError,
    err_too_many_indices,
    VindexInvalidSelectionError,
    BoundsCheckError,
)

    if isinstance(selection, str):
        # single field selection
        fields = selection
        selection = ()
    elif not isinstance(selection, tuple):
        # single selection item, no fields
        fields = None
        # leave selection as-is
    else:
        # multiple items, split fields from selection items
        fields = [f for f in selection if isinstance(f, str)]
        fields = fields[0] if len(fields) == 1 else fields
        selection = tuple(s for s in selection if not isinstance(s, str))
        selection = selection[0] if len(selection) == 1 else selection
    return fields, selection


def make_slice_selection(selection):
    ls = []
    for dim_selection in selection:
        if is_integer(dim_selection):
            ls.append(slice(int(dim_selection), int(dim_selection) + 1, 1))
        elif isinstance(dim_selection, np.ndarray):
            if len(dim_selection) == 1:
                ls.append(
                    slice(
                        int(dim_selection[0]), int(dim_selection[0]) + 1, 1
                    )
                )
            else:

                raise ArrayIndexError()