From 5be9c915181ffb3e12d61ce0d740098cc9dfcbd1 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Fri, 28 Aug 2020 16:50:05 +0100 Subject: [PATCH] freezegun: Fix __exit__ and remove union return types (#4491) These caused false positives, for example in code like this: ``` with freeze_time(None) as ft: # False positive here ft.tick(3) # False positive here ``` --- third_party/3/freezegun/api.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/third_party/3/freezegun/api.pyi b/third_party/3/freezegun/api.pyi index 3f65acff3..a0d50ed7f 100644 --- a/third_party/3/freezegun/api.pyi +++ b/third_party/3/freezegun/api.pyi @@ -1,6 +1,6 @@ from datetime import date, datetime, timedelta from numbers import Real -from typing import Awaitable, Callable, Iterator, Optional, Sequence, Type, TypeVar, Union, overload +from typing import Any, Awaitable, Callable, Iterator, Optional, Sequence, Type, TypeVar, Union, overload _T = TypeVar("_T") _Freezable = Union[str, datetime, date, timedelta] @@ -38,9 +38,9 @@ class _freeze_time: def __call__(self, func: Callable[..., Awaitable[_T]]) -> Callable[..., Awaitable[_T]]: ... @overload def __call__(self, func: Callable[..., _T]) -> Callable[..., _T]: ... - def __enter__(self) -> Union[StepTickTimeFactory, TickingDateTimeFactory, FrozenDateTimeFactory]: ... - def __exit__(self) -> None: ... - def start(self) -> Union[StepTickTimeFactory, TickingDateTimeFactory, FrozenDateTimeFactory]: ... + def __enter__(self) -> Any: ... + def __exit__(self, *args: Any) -> None: ... + def start(self) -> Any: ... def stop(self) -> None: ... def decorate_class(self, klass: Type[_T]) -> _T: ... def decorate_coroutine(self, coroutine: _T) -> _T: ...