mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 00:44:49 -04:00
Add types to synapse.util. (#10601)
This commit is contained in:
parent
ceab5a4bfa
commit
524b8ead77
41 changed files with 400 additions and 253 deletions
|
@ -16,7 +16,7 @@
|
|||
|
||||
import time
|
||||
import urllib.parse
|
||||
from typing import TYPE_CHECKING, Callable, Iterable, Optional, Union
|
||||
from typing import TYPE_CHECKING, Callable, Optional, Sequence, Union
|
||||
|
||||
import jinja2
|
||||
|
||||
|
@ -25,9 +25,9 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
def build_jinja_env(
|
||||
template_search_directories: Iterable[str],
|
||||
template_search_directories: Sequence[str],
|
||||
config: "HomeServerConfig",
|
||||
autoescape: Union[bool, Callable[[str], bool], None] = None,
|
||||
autoescape: Union[bool, Callable[[Optional[str]], bool], None] = None,
|
||||
) -> jinja2.Environment:
|
||||
"""Set up a Jinja2 environment to load templates from the given search path
|
||||
|
||||
|
@ -110,5 +110,5 @@ def _create_mxc_to_http_filter(
|
|||
return mxc_to_http_filter
|
||||
|
||||
|
||||
def _format_ts_filter(value: int, format: str):
|
||||
def _format_ts_filter(value: int, format: str) -> str:
|
||||
return time.strftime(format, time.localtime(value / 1000))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue