Ejemplo n.º 1
0
def position(dynamic, check=None):
    if check is None:
        return utils.create_number(dynamic.context_position)
    return utils.create_boolean(
            utils.get_single_instance(check, d.Number).get_as_int() == dynamic.context_position)
Ejemplo n.º 2
0
def count(dynamic, sequence=None):
    if sequence is None:
        return utils.create_number(dynamic.context_size)
    return sequence.get_size()
Ejemplo n.º 3
0
def size(dynamic):
    thing = dynamic.context_item
    if not isinstance(thing, (d.List, d.Object)):
        raise e.TypeException("Expected " + str(thing) + " to be a list or object")
    return utils.create_number(dynamic.context_item.get_size())