From 39d547bf745574ca296ae52af51c76f52929ced6 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Sat, 11 Jun 2022 18:11:57 +0100 Subject: Annotate `default_config` --- tests/utils.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/utils.py b/tests/utils.py index c93fc8990b..6a66a938a7 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -15,7 +15,9 @@ import atexit import os -from typing import TYPE_CHECKING, cast +from typing import TYPE_CHECKING, Dict, Union, cast, overload + +from typing_extensions import Literal from synapse.api.constants import EventTypes from synapse.api.room_versions import RoomVersions @@ -117,7 +119,19 @@ def setupdb() -> None: atexit.register(_cleanup) -def default_config(name, parse=False): +@overload +def default_config(name: str, parse: Literal[False] = ...) -> Dict[str, object]: + ... + + +@overload +def default_config(name: str, parse: Literal[True]) -> HomeServerConfig: + ... + + +def default_config( + name: str, parse: bool = False +) -> Union[Dict[str, object], HomeServerConfig]: """ Create a reasonable test config. """ -- cgit 1.4.1