mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-17 17:29:13 -04:00
Fix a handful of type annotations. (#10446)
* switch from `types.CoroutineType` to `typing.Coroutine` these should be identical semantically, and since `defer.ensureDeferred` is defined to take a `typing.Coroutine`, will keep mypy happy * Fix some annotations on inlineCallbacks functions * changelog
This commit is contained in:
parent
d518b05a86
commit
d8324b8238
4 changed files with 6 additions and 5 deletions
|
@ -25,7 +25,7 @@ See doc/log_contexts.rst for details on how this works.
|
|||
import inspect
|
||||
import logging
|
||||
import threading
|
||||
import types
|
||||
import typing
|
||||
import warnings
|
||||
from typing import TYPE_CHECKING, Optional, Tuple, TypeVar, Union
|
||||
|
||||
|
@ -745,7 +745,7 @@ def run_in_background(f, *args, **kwargs) -> defer.Deferred:
|
|||
# by synchronous exceptions, so let's turn them into Failures.
|
||||
return defer.fail()
|
||||
|
||||
if isinstance(res, types.CoroutineType):
|
||||
if isinstance(res, typing.Coroutine):
|
||||
res = defer.ensureDeferred(res)
|
||||
|
||||
# At this point we should have a Deferred, if not then f was a synchronous
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue