summary refs log tree commit diff
path: root/synapse/logging/context.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2021-07-22 12:00:16 +0100
committerGitHub <noreply@github.com>2021-07-22 12:00:16 +0100
commitd8324b8238a31b8d749b1dfe507c3bed3bcc6e17 (patch)
tree6783e1e477bac3bd9004d49e7417e44929eee2b3 /synapse/logging/context.py
parentMove dev/ docs to development/ (#10453) (diff)
downloadsynapse-d8324b8238a31b8d749b1dfe507c3bed3bcc6e17.tar.xz
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
Diffstat (limited to 'synapse/logging/context.py')
-rw-r--r--synapse/logging/context.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/logging/context.py b/synapse/logging/context.py
index 18ac507802..02e5ddd2ef 100644
--- a/synapse/logging/context.py
+++ b/synapse/logging/context.py
@@ -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