Exemplo n.º 1
0
def equals(arrayA, arrayB):
    if not hasattr(arrayA, '__getitem__') or not hasattr(arrayB, '__getitem__') :
        raise CalcException('E: %s is not subscriptable')

    try:
        return unpack_variable((arrayA and arrayB))
    except (TypeError, IndexError) as e:
        raise CalcException('E: %s' % str(e))
Exemplo n.º 2
0
def insert(array, index, _object):
    if not hasattr(array, '__getitem__'):
        raise CalcException('E: %s is not subscriptable')

    try:
        v = array.insert(int(index), _object)
    except (TypeError, IndexError) as e:
        raise CalcException('E: %s' % str(e))
    
    return unpack_variable(v)
Exemplo n.º 3
0
def remove(array, _object):
    if not hasattr(array, '__getitem__'):
        raise CalcException('E: %s is not subscriptable')

    try:
        v = array.remove(_object)
    except (TypeError, IndexError) as e:
        raise CalcException('E: %s' % str(e))
    
    return unpack_variable(None)
Exemplo n.º 4
0
def get(array, index):
    #a = unpack_variable(check_variable(array))
    #i = unpack_variable(check_variable(index))

    if not hasattr(array, '__getitem__'):
        raise CalcException('E: %s is not subscriptable')

    try:
        v = array[int(index)]
    except (TypeError, IndexError) as e:
        raise CalcException('E: %s' % str(e))
    
    return unpack_variable(v)