Skip to content

Commit 5dff43d

Browse files
authored
Merge pull request #574 from sfreilich/restore-class-decorator-overload
Restore class-decorator overload annotation for freeze_time
2 parents ba06fa4 + 1df6623 commit 5dff43d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

freezegun/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,13 @@ def __init__(
632632
self.as_kwarg = as_kwarg
633633
self.real_asyncio = real_asyncio
634634

635+
# mypy objects to this because Type is Callable, but Pytype needs it because
636+
# (unlike mypy's) its inference does not assume class decorators always leave
637+
# the type unchanged.
638+
@overload
639+
def __call__(self, func: Type[T2]) -> Type[T2]: # type: ignore[overload-overlap]
640+
...
641+
635642
@overload
636643
def __call__(self, func: "Callable[P, Awaitable[Any]]") -> "Callable[P, Awaitable[Any]]":
637644
...

0 commit comments

Comments
 (0)