diff options
author | Richard van der Hoff <richard@matrix.org> | 2021-06-16 15:35:00 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2021-06-16 15:35:00 +0100 |
commit | 89013b99bd6bf54c079db27059a57d48dc9bac0f (patch) | |
tree | 2cb94604893136c35e16e053139617b30f65c20b /synapse/http/servlet.py | |
parent | Merge branch 'release-v1.36' into matrix-org-hotfixes (diff) | |
parent | A guide to the request log lines format. (#8436) (diff) | |
download | synapse-89013b99bd6bf54c079db27059a57d48dc9bac0f.tar.xz |
Merge remote-tracking branch 'origin/develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/http/servlet.py')
-rw-r--r-- | synapse/http/servlet.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/synapse/http/servlet.py b/synapse/http/servlet.py index d61563d39b..3c43f32586 100644 --- a/synapse/http/servlet.py +++ b/synapse/http/servlet.py @@ -13,7 +13,6 @@ # limitations under the License. """ This module contains base REST classes for constructing REST servlets. """ - import logging from typing import Dict, Iterable, List, Optional, overload @@ -295,6 +294,30 @@ def parse_strings_from_args( return default +@overload +def parse_string_from_args( + args: Dict[bytes, List[bytes]], + name: str, + default: Optional[str] = None, + required: Literal[True] = True, + allowed_values: Optional[Iterable[str]] = None, + encoding: str = "ascii", +) -> str: + ... + + +@overload +def parse_string_from_args( + args: Dict[bytes, List[bytes]], + name: str, + default: Optional[str] = None, + required: bool = False, + allowed_values: Optional[Iterable[str]] = None, + encoding: str = "ascii", +) -> Optional[str]: + ... + + def parse_string_from_args( args: Dict[bytes, List[bytes]], name: str, |