parse_frame returns unexpected result
Schwaneberg opened this issue · 4 comments
The type hint Tuple[int, Optional[SmlFrame]]
is ok for the first return return [match.end(), obj]
(hoewever, List[int, Optional[SmlFrame]]
would be the acurate hint), but not for the second return [end]
.
This causes an unexpected ValueError, if you do stuff like _, frame = SmlBase.parse_frame(sml_frame)
.
I recommend to change the second return to return (end, None)
You're right. Would you mind creating a PR? Otherwise I'll fix it by myself, but it may take some more time.
I guess it would make sense to change the type annotation from Tuple to List and always return a list.
I failed trying to fix the signature of the existing function. Therefore, release 0.1.0 contains a new function called find_frame
which always returns a fixed-size tuple. New code should prefer this function over the older parse_frame
.
Thank you for your report! I'm sorry for the long delay.