Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluation should stop if None is return by any expression #62

Open
VMRuiz opened this issue Sep 7, 2020 · 0 comments
Open

Evaluation should stop if None is return by any expression #62

VMRuiz opened this issue Sep 7, 2020 · 0 comments

Comments

@VMRuiz
Copy link

VMRuiz commented Sep 7, 2020

The following expression and all the variation over it that I have tested always produced an 'NoneType' object is not subscriptable error in logs.

Expression: re_search("#([\d,]+)")|first|sub(",","")|int
Data: ['\n']

or

Expression: re_search("#([\d,]+)")|map(lambda x: x[0].replace(",", ""))|int
Data: ['\n']

They work with the following expected data:

Data = [
    "#667 in Books (",
    " #6 in",
    " #34 in",
    " #46 in",
]

Output =  [667,  6,  34,  46]

The reason is that at some point one of the method will return None or [None] and the next method will fail when attempting to apply to convert int to int or executing a replacement or search over.

I think is reasonable to expect shublang to stop processing data if None is reached at some point as we can't always assume the input data will be 100% accurate.

Alternatively, we could implement a stop-if-none method in case we want to manually set the breaking points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant