-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
[bugfix]: Fix type hint errors in Features.py #5556
Conversation
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @huibosa - I've reviewed your changes and they look great!
General suggestions:
- Verify the consistency and appropriateness of default values for parameters now accepting NDArray to ensure they align with the expected types.
- Consider adding runtime validation for parameters accepting a wide range of types to ensure they are compatible with the method's operations.
- Review the handling of NDArray inputs in methods, especially for operations involving vector arithmetic or transformations, to prevent potential bugs.
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Docstrings: all looks good
Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨
Seems I have made a mistake on the the type |
We use |
The tests fail because the code requires from typing import TYPE_CHECKING
if TYPE_CHECKING:
from numpy.typing import NDArray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revise the PR according to the comments?
I don't know why |
The docs error has nothing to do with this PR, merging |
@huibosa Thanks for your contribution |
* [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1)
* [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1)
* [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1)
[bugfix]: Fix type hint errors in Features.py (#5556) * [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1) Co-authored-by: huibosa <78707242+huibosa@users.noreply.github.com>
[bugfix]: Fix type hint errors in Features.py (#5556) * [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1) Co-authored-by: huibosa <78707242+huibosa@users.noreply.github.com>
[bugfix]: Fix type hint errors in Features.py (#5556) * [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1) Co-authored-by: huibosa <78707242+huibosa@users.noreply.github.com>
* [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1)
* [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1)
* [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1)
[bugfix]: Fix type hint errors in Features.py (#5556) * [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1) Co-authored-by: huibosa <78707242+huibosa@users.noreply.github.com>
[bugfix]: Fix type hint errors in Features.py (#5556) * [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1) Co-authored-by: huibosa <78707242+huibosa@users.noreply.github.com>
[bugfix]: Fix type hint errors in Features.py (#5556) * [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1) Co-authored-by: huibosa <78707242+huibosa@users.noreply.github.com>
* [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1)
* [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1)
[bugfix]: Fix type hint errors in Features.py (#5556) * [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1) Co-authored-by: huibosa <78707242+huibosa@users.noreply.github.com>
[bugfix]: Fix type hint errors in Features.py (#5556) * [bugfix]: Fix type hint errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [revert]: Use '|' instead of Union * [revert]: undo some unwanted changes * Fix pre-commit errors --------- Co-authored-by: huibosa_macmini <huibosa@email.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk> (cherry picked from commit 74fc5c1) Co-authored-by: huibosa <78707242+huibosa@users.noreply.github.com>
Description
Union
instead of|
Squence[float]
andNDArray
for pointBackporting
This change should be backported to the previous releases, please add the relevant labels.
Refer here to resolve backport conflicts if any.