feat: strict typing stream.iter_array - #1993
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
e10e3
left a comment
There was a problem hiding this comment.
Thank you for the effort, that's indeed a lot of overloads for that function.
I'm surprised by the quantity of changes that you propose. Usually, typing PRs only add types, they aim at not changing the behaviour. If they make changes, it's as little as possible, only to improve the quality of the type annotations.
Hence, why did you need to add tests in a typing PR?
Why did you need to change the whole implementation of iter_array?
| """The type of a single target value, i.e. of a row of a 1D array of targets.""" | ||
|
|
||
| Array: typing.TypeAlias = "np.ndarray | Sequence[typing.Any]" | ||
| """A numpy array or a plain Python sequence.""" |
| """One row of features, labeled, which is what an estimator takes as its `x`.""" | ||
|
|
||
|
|
||
| def _passthrough(row: str) -> str: |
There was a problem hiding this comment.
This function is used exactly once. Why not define it at its usage location?
Scope as per title: add strict typing for
stream.iter_arraymodule/function.This is the most tricky typing PR I did so far in river as the runtime behavior allows for a lot of cases.