We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ebbab13 commit 06a8109Copy full SHA for 06a8109
late/__init__.py
@@ -7,6 +7,7 @@
7
__all__ = ['latebinding', 'late', '__']
8
9
10
+_R = TypeVar('_R')
11
_T = TypeVar('_T')
12
_V = TypeVar('_V')
13
@@ -15,7 +16,7 @@ class _LateBound(NamedTuple):
15
16
actual: Any
17
18
-def late(o: _T | Iterator[_V]) -> _T | _V:
19
+def late(o: _T | Iterator[_V] | Callable[[], _R]) -> _T | _V | _R:
20
if isinstance(o, int | float | str | bool | bytes | bytearray | frozenset):
21
return o # type: ignore
22
test/complex_test.py
@@ -23,7 +23,7 @@ def a() -> int:
23
return t
24
25
@latebinding
26
- def f(x: int = __(a)) -> int: # type: ignore
+ def f(x: int = __(a)) -> int:
27
return 2 * x
28
29
assert f() == 2
0 commit comments