diff options
author | David Robertson <davidr@element.io> | 2022-06-11 18:11:57 +0100 |
---|---|---|
committer | David Robertson <davidr@element.io> | 2022-06-11 18:11:57 +0100 |
commit | 39d547bf745574ca296ae52af51c76f52929ced6 (patch) | |
tree | 7e575397cb36622208c915f8aef5f03acebca754 | |
parent | Use `ParamSpec` to annotate looping_call (diff) | |
download | synapse-39d547bf745574ca296ae52af51c76f52929ced6.tar.xz |
Annotate `default_config`
-rw-r--r-- | tests/utils.py | 18 |
1 files 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. """ |