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
```
This commit is contained in:
Jukka Lehtosalo
2020-08-28 16:50:05 +01:00
committed by GitHub
parent 3e966524b7
commit 5be9c91518

View File

@@ -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: ...