From 09adae52137f1bb37a4906b9a1888f0fd8279424 Mon Sep 17 00:00:00 2001 From: Red-GitHubBot <88117545+Red-GitHubBot@users.noreply.github.com> Date: Sat, 25 Dec 2021 03:21:45 +0100 Subject: [PATCH] [3.4] [Config] Add type-hints to _ValueContextManager methods (#5344) (#5486) Without these type-hints, I've found that PyCharm misidentifies the returned type, causing a number of false positives in static type checking. (cherry picked from commit e878483318cea041e70bdbcc62c2467c994dc527) Co-authored-by: Toby Harradine Co-authored-by: Toby Harradine --- redbot/core/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redbot/core/config.py b/redbot/core/config.py index 84ef96419..6db8af5ba 100644 --- a/redbot/core/config.py +++ b/redbot/core/config.py @@ -89,10 +89,10 @@ class _ValueCtxManager(Awaitable[_T], AsyncContextManager[_T]): # pylint: disab self.__acquire_lock = acquire_lock self.__lock = self.value_obj.get_lock() - def __await__(self): + def __await__(self) -> _T: return self.coro.__await__() - async def __aenter__(self): + async def __aenter__(self) -> _T: if self.__acquire_lock is True: await self.__lock.acquire() self.raw_value = await self