AssertionError in series:array
This code
time = map((x: 0.5*x), range(0, 10, 1))
print(time:array)
produces this error in instant mode:
Traceback (most recent call last):
File "vre-language/src/virtmat/language/utilities/errors.py", line 278, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/cli/run_model.py", line 108, in evaluate_prog
print(f'program output: >>>\n{prog.value}\n<<<')
File "/usr/lib/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/utilities/errors.py", line 189, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/utilities/types.py", line 209, in wrapper
return checktype_(func(obj), obj.type_)
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 50, in program_value
vals = [p.value for p in get_children_of_type('Print', self) if p.value]
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 50, in <listcomp>
vals = [p.value for p in get_children_of_type('Print', self) if p.value]
File "/usr/lib/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/utilities/errors.py", line 189, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/utilities/types.py", line 209, in wrapper
return checktype_(func(obj), obj.type_)
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 122, in print_value
return ' '.join(formatter(par.value) for par in self.params)
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 122, in <genexpr>
return ' '.join(formatter(par.value) for par in self.params)
File "/usr/lib/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/utilities/errors.py", line 189, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/utilities/types.py", line 209, in wrapper
return checktype_(func(obj), obj.type_)
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 128, in print_parameter_value
return self.param.value
File "/usr/lib/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/utilities/errors.py", line 193, in wrapper
raise TextXError(str(err), **get_location_context(obj)) from err
textx.exceptions.TextXError: vre-language/examples/4.vm:2:7: => 'time:array'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "python-3.10.12/bin/texts", line 8, in <module>
sys.exit(texts())
File "vre-language/src/virtmat/language/cli/__init__.py", line 25, in texts
clargs.func(clargs)
File "vre-language/src/virtmat/language/cli/run_model.py", line 142, in main
evaluate_prog(clargs, prog)
File "vre-language/src/virtmat/language/utilities/errors.py", line 280, in wrapper
process_error(err)
File "vre-language/src/virtmat/language/utilities/errors.py", line 268, in process_error
raise err.__cause__
File "vre-language/src/virtmat/language/utilities/errors.py", line 189, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/utilities/types.py", line 209, in wrapper
return checktype_(func(obj), obj.type_)
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 351, in iterable_property_value
ret = get_sliced_value(self)
File "vre-language/src/virtmat/language/utilities/types.py", line 220, in wrapper
rval = func(*args, **kwargs)
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 302, in get_sliced_value
assert all(isinstance(v.magnitude, int) for v in array)
AssertionError
and this error in deferred mode:
Traceback (most recent call last):
File "vre-language/src/virtmat/language/utilities/errors.py", line 278, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/cli/run_model.py", line 108, in evaluate_prog
print(f'program output: >>>\n{prog.value}\n<<<')
File "/usr/lib/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/utilities/errors.py", line 189, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 50, in program_value
vals = [p.value for p in get_children_of_type('Print', self) if p.value]
File "vre-language/src/virtmat/language/interpreter/instant_executor.py", line 50, in <listcomp>
vals = [p.value for p in get_children_of_type('Print', self) if p.value]
File "/usr/lib/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/utilities/errors.py", line 193, in wrapper
raise TextXError(str(err), **get_location_context(obj)) from err
textx.exceptions.TextXError: vre-language/examples/4.vm:2:1: 'numpy.ndarray' object has no attribute 'quantity' => 'print(time:array)'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "python-3.10.12/bin/texts", line 8, in <module>
sys.exit(texts())
File "vre-language/src/virtmat/language/cli/__init__.py", line 25, in texts
clargs.func(clargs)
File "vre-language/src/virtmat/language/cli/run_model.py", line 142, in main
evaluate_prog(clargs, prog)
File "vre-language/src/virtmat/language/utilities/errors.py", line 280, in wrapper
process_error(err)
File "vre-language/src/virtmat/language/utilities/errors.py", line 268, in process_error
raise err.__cause__
File "vre-language/src/virtmat/language/utilities/errors.py", line 189, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/utilities/types.py", line 209, in wrapper
return checktype_(func(obj), obj.type_)
File "vre-language/src/virtmat/language/interpreter/deferred_executor.py", line 937, in func_value
return func(*[p.value for p in pars])
File "vre-language/src/virtmat/language/interpreter/deferred_executor.py", line 64, in retfunc
values = [formatter(f(*a)) for f, a in zip(funcs, pargs)]
File "vre-language/src/virtmat/language/interpreter/deferred_executor.py", line 64, in <listcomp>
values = [formatter(f(*a)) for f, a in zip(funcs, pargs)]
File "vre-language/src/virtmat/language/interpreter/deferred_executor.py", line 309, in <lambda>
return (lambda *x: get_sliced_value(func(*x)).values.quantity, pars)
AttributeError: 'numpy.ndarray' object has no attribute 'quantity'