import csp
import typing
from datetime import datetime, timedelta
import sys
print(csp.__version__); print(sys.version); print(sys.platform)
@csp.node
def val(x: csp.ts[object]) -> csp.ts[typing.Any]:
return x
@csp.node
def val2(x: csp.ts[typing.Any]) -> csp.ts[object]:
return x
csp.run(val2, csp.const(1), starttime=datetime.utcnow(), endtime=timedelta(seconds=3))
csp.run(val, csp.const(1), starttime=datetime.utcnow(), endtime=timedelta(seconds=3)) # fails here
TypeError Traceback (most recent call last)
Cell In[22], [line 20](vscode-notebook-cell:?execution_count=22&line=20)
[17](vscode-notebook-cell:?execution_count=22&line=17) return x
[19](vscode-notebook-cell:?execution_count=22&line=19) csp.run(val2, csp.const(1), starttime=datetime.utcnow(), endtime=timedelta(seconds=3))
---> [20](vscode-notebook-cell:?execution_count=22&line=20) csp.run(val, csp.const(1), starttime=datetime.utcnow(), endtime=timedelta(seconds=3)) # fails here
File csp/csp/impl/wiring/runtime.py:167, in run(g, starttime, endtime, queue_wait_time, realtime, output_numpy, *args, **kwargs)
[157](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.netcsp/csp/impl/wiring/runtime.py:157) def run(
[158](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.netcsp/csp/impl/wiring/runtime.py:158) g,
[159](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.net/csp/csp/impl/wiring/runtime.py:159) *args,
(...)
[165](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.net/csp/csp/impl/wiring/runtime.py:165) **kwargs,
[166](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.net/csp/csp/impl/wiring/runtime.py:166) ):
--> [167](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.net/csp/csp/impl/wiring/runtime.py:167) with ExceptionContext():
[168](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.net/csp/csp/impl/wiring/runtime.py:168) starttime, endtime = _normalize_run_times(starttime, endtime, realtime)
[170](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.net/csp/csp/impl/wiring/runtime.py:170) engine_settings = {"queue_wait_time": queue_wait_time, "realtime": realtime, "output_numpy": output_numpy}
File csp/csp/impl/error_handling.py:40, in ExceptionContext.__exit__(self, exc_type, exc_val, exc_tb)
[37](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.net/csp/csp/impl/error_handling.py:37) if exc_type is CspParseError and exc_val.filename is not None and exc_val.lineno is not None:
[38](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.net/csp/csp/impl/error_handling.py:38) new_tb = _cspimpl.create_traceback(new_tb, exc_val.frame, exc_val.lineno, exc_val.lineno)
---> [40](https://vscode-remote+ssh-002dremote-002bdev06.vscode-resource.vscode-cdn.net/csp/csp/impl/error_handling.py:40) raise exc_val.with_traceback(new_tb)
Cell In[22], [line 13](vscode-notebook-cell:?execution_count=22&line=13)
[11](vscode-notebook-cell:?execution_count=22&line=11) @csp.node
[12](vscode-notebook-cell:?execution_count=22&line=12) def val(x: csp.ts[object]) -> csp.ts[typing.Any]:
---> [13](vscode-notebook-cell:?execution_count=22&line=13) return x
TypeError: PyOutputProxy.h:outputTick:56:TypeError: "val" node expected output type on output #0 to be of type "Any" got type "int"
Describe the bug
typing.Anyis not handled properly. This occurs both ifCSP_PYDANTICis set as an environment behavior or notTo Reproduce
Expected behavior
Both of these should pass
Error Message
Runtime Environment
0.0.7
3.12.7 | packaged by conda-forge | (main, Oct 4 2024, 16:05:46) [GCC 13.3.0]
linux