def __getitem__(self, idx: Any) -> NDArray:
    if (not isinstance(idx, tuple)):
        raise IndexError(f'Indexer must be tuple (received {type(idx)})')
    if (len(idx) != self.ndim):
        raise IndexError(f'Indexer must have {self.ndim} items (received {len(idx)} slices)')
    if (not all(((isinstance(i, slice) or isinstance(i, int)) for i in idx))):
        raise IndexError(f'Indexer must contain only slices or ints (received types {[type(i) for i in idx]})')
    squeeze_dims = tuple((i for i in range(len(idx)) if isinstance(idx[i], int)))
    idx = tuple(((slice(i, (i + 1)) if isinstance(i, int) else i) for i in idx))
    if (idx[0].start == idx[0].stop):
        return np.empty(((0,) * self.ndim), dtype=self.dtype)
    start_partition = (idx[0].start // self.partition_size)
    start_partition_offset = (idx[0].start % self.partition_size)
    end_partition = ((idx[0].stop - 1) // self.partition_size)
    end_partition_offset = ((idx[0].stop - 1) % self.partition_size)
    all_vaddr = []
    with bgen_metafile(self.metafile_path) as mf:
        for i in range(start_partition, (end_partition + 1)):
            partition = mf.read_partition(i)
            start_offset = (start_partition_offset if (i == start_partition) else 0)
            end_offset = ((end_partition_offset + 1) if (i == end_partition) else self.partition_size)
            vaddr = partition.variants.offset
            all_vaddr.extend(vaddr[start_offset:end_offset].tolist())
    with bgen_file(self.path) as bgen:
        res = None
        for (i, vaddr) in enumerate(all_vaddr):
            probs = bgen.read_probability(vaddr, precision=self.precision)[idx[1]]
            assert ((len(probs.shape) == 2) and (probs.shape[1] == 3))
            if (res is None):
                res = np.zeros((len(all_vaddr), len(probs), 3), dtype=self.dtype)
            res[i] = probs
        res = res[(..., idx[2])]
        return np.squeeze(res, axis=squeeze_dims)
def __getitem__(self, idx: Any) -> NDArray:
    if (not isinstance(idx, tuple)):
        raise IndexError(f'Indexer must be tuple (received {type(idx)})')
    if (len(idx) != self.ndim):
        raise IndexError(f'Indexer must have {self.ndim} items (received {len(idx)} slices)')
    if (not all(((isinstance(i, slice) or isinstance(i, int)) for i in idx))):
        raise IndexError(f'Indexer must contain only slices or ints (received types {[type(i) for i in idx]})')
    squeeze_dims = tuple((i for i in range(len(idx)) if isinstance(idx[i], int)))
    idx = tuple(((slice(i, (i + 1)) if isinstance(i, int) else i) for i in idx))
    if (idx[0].start == idx[0].stop):
        return np.empty(((0,) * self.ndim), dtype=self.dtype)
    start_partition = (idx[0].start // self.partition_size)
    start_partition_offset = (idx[0].start % self.partition_size)
    end_partition = ((idx[0].stop - 1) // self.partition_size)
    end_partition_offset = ((idx[0].stop - 1) % self.partition_size)
    all_vaddr = []
    with bgen_metafile(self.metafile_path) as mf:
        for i in range(start_partition, (end_partition + 1)):
            partition = mf.read_partition(i)
            start_offset = (start_partition_offset if (i == start_partition) else 0)
            end_offset = ((end_partition_offset + 1) if (i == end_partition) else self.partition_size)
            vaddr = partition.variants.offset
            all_vaddr.extend(vaddr[start_offset:end_offset].tolist())
    with bgen_file(self.path) as bgen:
        res = None
        for (i, vaddr) in enumerate(all_vaddr):
            probs = bgen.read_probability(vaddr, precision=self.precision)[idx[1]]
            assert ((len(probs.shape) == 2) and (probs.shape[1] == 3))
            if (res is None):
                res = np.zeros((len(all_vaddr), len(probs), 3), dtype=self.dtype)
            res[i] = probs
        res = res[(..., idx[2])]
        return np.squeeze(res, axis=squeeze_dims)