Node parser fails to recognize renamed `ts` inputs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 441
- Forks
- 90
- Avg merge
- 1d 12m
- Merged PRs (30d)
- 5
Description
Describe the bug
Baskets in csp are not iterable, but should be.
To Reproduce
This code will raise an error:
import csp
from csp import ts
@csp.node
def n(values: [ts[int]]):
for val in values:
if csp.ticked(val):
pass
>> CspParseError: unrecognized input 'val'
This code will not:
import csp
from csp import ts
@csp.node
def n(values: [ts[int]]):
for i in range(len(values)):
if csp.ticked(values[i]):
pass
Similarly for dictbaskets:
import csp
from csp import ts
@csp.node
def n(values: {str: ts[int]}):
for key, val in values.items():
if csp.ticked(val):
pass
>> CspParseError: unrecognized input 'val'
import csp
from csp import ts
@csp.node
def n(values: {str: ts[int]}):
for key, val in values.items():
if csp.ticked(values[key]):
pass
Expected behavior
Both of the snippets given above (for list/dictbaskets) should be equivalent.
Error Message
Runtime Environment
0.0.4
3.8.12 (default, Apr 7 2022, 17:33:24)
[GCC 11.2.0]
linux
Additional context
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the listbasket and dictbasket examples with Python 3.8.12, then trace the csp.node parser and the CspParseError path for loop variables and renamed ts inputs. Done means both iteration forms are accepted equivalently and regression coverage confirms the reported snippets no longer raise the parse error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- stream-processing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100