forked from qutebrowser/qutebrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust some type hints to better match parent classes
mypy 1.11 has stricter checking of the type signature overridden methods: https://github.com/python/mypy/blob/master/CHANGELOG.md#stricter-checks-for-untyped-overrides There's a couple of places where I added type hints and had to duplicate the default kwarg value from the parent. In `completionmodel.py` it was complaining that the type signature of `parent()` didn't match that of `QAbstractItemModel` and `QObject`. I've changed it to be happy, and incidently made it so the positional arg is optional, otherwise it's impossible to call `QObject.parent()`. Options that I see: 1. support both variant of parent() - what I've done, the technically correct solution 2. have the two overload definitions but in the actual implementation make the positional argument required - would mean one overload signature was a lie, but would make it more clear how to call `CompletionModel.parent() 3. do type: ignore[override] and leave it as it was In the end I don't expect there to be many callers of `CompletionModel.parent(child)`. I also added a few more function type hints to `completionmodel.py` while I was there. Not all of them though! In `objreg.py` I expanded the user of `_IndexType` because as 7b9d702 say, the window register uses int as the key.
- Loading branch information
Showing
4 changed files
with
25 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters