Repository navigation
[python-package] Fix mypy checks in compat.py - #6898
Conversation
jameslamb
left a comment
There was a problem hiding this comment.
Thanks for working on this!
I'd like to see the specific warnings this is trying to address before approving this PR... maybe I'll be able to suggest something more specific than Any that we could use here. Can you please add them to the PR description in plaintext?
jameslamb
left a comment
There was a problem hiding this comment.
I'd like to see the specific warnings this is trying to address before approving this PR
I want to move these forward so I just ran mypy myself to get this information. It's these:
python-package/lightgbm/compat.py:38: error: Function is missing a return type annotation [no-untyped-def]
python-package/lightgbm/compat.py:38: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
I think it's fine to just :Any these away. This function is just a compatibility layer for older version of scikit-learn that's uses internal to LightGBM... we have unit tests covering it, and having imprecise type hints does not affect the ability of other projects using LightGBM to use type-checkers on their own code that interacts with LightGBM.
I can see in the output of the lint job here (just run by me merging latest master into this PR) that there are no remaining compat.py errors from mypy on this branch: https://github.com/microsoft/LightGBM/actions/runs/16584600180/job/46907384257?pr=6898#step:3:991
I am ok with merging this.
|
This pull request has been automatically locked since there has not been any recent activity since it was closed. |
Motivation
Contributes to #3867
mypycurrently fails with 36 errors in 6 files. One of these files iscompat.py.Changes
This PR fixes the typing issues in
compat.py, eliminating 2 errors in 1 file. I don't think there is a strong drawback in usingAnyhere, this is a "stub function" anyways.