forked from python-qt-tools/PyQt5-stubs
-
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.
Merge pull request python-qt-tools#102 from altendky/pyqtslot_fixup
fix `pyqtSlot` `result` parameter type and `Callable` generic
- Loading branch information
Showing
3 changed files
with
38 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
from PyQt5.QtCore import pyqtSlot | ||
|
||
@pyqtSlot(str) | ||
def func(s: str) -> int: | ||
def func_none(s: str) -> None: | ||
return | ||
|
||
@pyqtSlot(str, result=int) | ||
def func_int(s: str) -> int: | ||
return 42 | ||
|
||
func("test") | ||
@pyqtSlot(str, result='int') | ||
def func_str(s: str) -> str: | ||
return '42' | ||
|
||
func_none("test") | ||
x = func_int("test") # type: int |