mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Add additional types to the federation transport server. (#10213)
This commit is contained in:
parent
717f73c411
commit
0555d7b0dc
1
changelog.d/10213.misc
Normal file
1
changelog.d/10213.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Add type hints to the federation servlets.
|
File diff suppressed because it is too large
Load Diff
@ -109,12 +109,22 @@ def parse_boolean_from_args(args, name, default=None, required=False):
|
|||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def parse_bytes_from_args(
|
||||||
|
args: Dict[bytes, List[bytes]],
|
||||||
|
name: str,
|
||||||
|
default: Optional[bytes] = None,
|
||||||
|
) -> Optional[bytes]:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def parse_bytes_from_args(
|
def parse_bytes_from_args(
|
||||||
args: Dict[bytes, List[bytes]],
|
args: Dict[bytes, List[bytes]],
|
||||||
name: str,
|
name: str,
|
||||||
default: Literal[None] = None,
|
default: Literal[None] = None,
|
||||||
required: Literal[True] = True,
|
*,
|
||||||
|
required: Literal[True],
|
||||||
) -> bytes:
|
) -> bytes:
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -197,7 +207,12 @@ def parse_string(
|
|||||||
"""
|
"""
|
||||||
args = request.args # type: Dict[bytes, List[bytes]] # type: ignore
|
args = request.args # type: Dict[bytes, List[bytes]] # type: ignore
|
||||||
return parse_string_from_args(
|
return parse_string_from_args(
|
||||||
args, name, default, required, allowed_values, encoding
|
args,
|
||||||
|
name,
|
||||||
|
default,
|
||||||
|
required=required,
|
||||||
|
allowed_values=allowed_values,
|
||||||
|
encoding=encoding,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -227,7 +242,20 @@ def parse_strings_from_args(
|
|||||||
args: Dict[bytes, List[bytes]],
|
args: Dict[bytes, List[bytes]],
|
||||||
name: str,
|
name: str,
|
||||||
default: Optional[List[str]] = None,
|
default: Optional[List[str]] = None,
|
||||||
required: Literal[True] = True,
|
*,
|
||||||
|
allowed_values: Optional[Iterable[str]] = None,
|
||||||
|
encoding: str = "ascii",
|
||||||
|
) -> Optional[List[str]]:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def parse_strings_from_args(
|
||||||
|
args: Dict[bytes, List[bytes]],
|
||||||
|
name: str,
|
||||||
|
default: Optional[List[str]] = None,
|
||||||
|
*,
|
||||||
|
required: Literal[True],
|
||||||
allowed_values: Optional[Iterable[str]] = None,
|
allowed_values: Optional[Iterable[str]] = None,
|
||||||
encoding: str = "ascii",
|
encoding: str = "ascii",
|
||||||
) -> List[str]:
|
) -> List[str]:
|
||||||
@ -239,6 +267,7 @@ def parse_strings_from_args(
|
|||||||
args: Dict[bytes, List[bytes]],
|
args: Dict[bytes, List[bytes]],
|
||||||
name: str,
|
name: str,
|
||||||
default: Optional[List[str]] = None,
|
default: Optional[List[str]] = None,
|
||||||
|
*,
|
||||||
required: bool = False,
|
required: bool = False,
|
||||||
allowed_values: Optional[Iterable[str]] = None,
|
allowed_values: Optional[Iterable[str]] = None,
|
||||||
encoding: str = "ascii",
|
encoding: str = "ascii",
|
||||||
@ -299,7 +328,20 @@ def parse_string_from_args(
|
|||||||
args: Dict[bytes, List[bytes]],
|
args: Dict[bytes, List[bytes]],
|
||||||
name: str,
|
name: str,
|
||||||
default: Optional[str] = None,
|
default: Optional[str] = None,
|
||||||
required: Literal[True] = True,
|
*,
|
||||||
|
allowed_values: Optional[Iterable[str]] = None,
|
||||||
|
encoding: str = "ascii",
|
||||||
|
) -> Optional[str]:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def parse_string_from_args(
|
||||||
|
args: Dict[bytes, List[bytes]],
|
||||||
|
name: str,
|
||||||
|
default: Optional[str] = None,
|
||||||
|
*,
|
||||||
|
required: Literal[True],
|
||||||
allowed_values: Optional[Iterable[str]] = None,
|
allowed_values: Optional[Iterable[str]] = None,
|
||||||
encoding: str = "ascii",
|
encoding: str = "ascii",
|
||||||
) -> str:
|
) -> str:
|
||||||
|
Loading…
Reference in New Issue
Block a user