Commit 7d72810
committed
Fix mypy type annotations for _to_thread_with_lock
Add TypeVar to preserve return types through the _to_thread_with_lock
wrapper method. This fixes mypy errors about returning Any from functions
with concrete return type declarations.
- Import Callable and TypeVar from typing
- Add generic TypeVar T
- Annotate _to_thread_with_lock with proper generic types
- Annotate wrapped() inner function return type1 parent a4d77fe commit 7d72810
1 file changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
57 | | - | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| |||
0 commit comments