[Config] Add type-hints to _ValueContextManager methods (#5344)

Without these type-hints, I've found that PyCharm misidentifies the returned type, causing a number of false positives in static type checking.
This commit is contained in:
Toby Harradine 2021-12-25 13:19:18 +11:00 committed by GitHub
parent 551e6d9f55
commit e878483318
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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