def _parse_shape(context, builder, ty, val):
    if isinstance(ty, types.Integer):
        ndim = 1
        shapes = [context.cast(builder, val, ty, types.intp)]
    else:
        assert isinstance(ty, types.BaseTuple)
        ndim = ty.count
        arrshape = context.cast(builder, val, ty,
                                types.UniTuple(types.intp, ndim))
        shapes = cgutils.unpack_tuple(builder, val, count=ndim)

    zero = context.get_constant_generic(builder, types.intp, 0)
    for dim in range(ndim):
        is_neg = builder.icmp_signed('<', shapes[dim], zero)
        with cgutils.if_unlikely(builder, is_neg):
            context.call_conv.return_user_exc(builder, ValueError,
                                              ("negative dimensions not allowed",))

    return shapes
Test to set a physical device to be used as an LVM physical volume
dataset/ETHPy150Open numba/numba/numba/targets/arrayobj.py/_parse_shape--crossover with--dataset/ETHPy150Open saltstack/salt/tests/unit/states/lvm_test.py/LvmTestCase.test_pv_present