summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2021-11-12 15:50:54 +0000
committerGitHub <noreply@github.com>2021-11-12 15:50:54 +0000
commit4c96ce396e900a94af66ec070af925881b6e1e24 (patch)
tree446920e10d66c2ace553a68541ed64e0fbd543e1 /synapse
parentGeneralize the disallowed_untyped_defs in mypy.ini (#11322) (diff)
downloadsynapse-4c96ce396e900a94af66ec070af925881b6e1e24.tar.xz
Misc typing fixes for `tests`, part 1 of N (#11323)
* Annotate HomeserverTestCase.servlets
* Correct annotation of federation_auth_origin
* Use AnyStr custom_headers instead of a Union

This allows (str, str) and (bytes, bytes).
This disallows (str, bytes) and (bytes, str)

* DomainSpecificString.SIGIL is a ClassVar
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/__init__.py4
-rw-r--r--synapse/types.py3
2 files changed, 5 insertions, 2 deletions
diff --git a/synapse/rest/__init__.py b/synapse/rest/__init__.py

index e04af705eb..cebdeecb81 100644 --- a/synapse/rest/__init__.py +++ b/synapse/rest/__init__.py
@@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Callable from synapse.http.server import HttpServer, JsonResource from synapse.rest import admin @@ -62,6 +62,8 @@ from synapse.rest.client import ( if TYPE_CHECKING: from synapse.server import HomeServer +RegisterServletsFunc = Callable[["HomeServer", HttpServer], None] + class ClientRestResource(JsonResource): """Matrix Client API REST resource. diff --git a/synapse/types.py b/synapse/types.py
index 9d7a675662..fb72f19343 100644 --- a/synapse/types.py +++ b/synapse/types.py
@@ -19,6 +19,7 @@ from collections import namedtuple from typing import ( TYPE_CHECKING, Any, + ClassVar, Dict, Mapping, MutableMapping, @@ -219,7 +220,7 @@ class DomainSpecificString(metaclass=abc.ABCMeta): 'domain' : The domain part of the name """ - SIGIL: str = abc.abstractproperty() # type: ignore + SIGIL: ClassVar[str] = abc.abstractproperty() # type: ignore localpart = attr.ib(type=str) domain = attr.ib(type=str)