Allow Iterable[Iterable[Any]] as args_generator argument to format_html_join (#722)

* Allow List[Tuple[Any]] as args_generator argument to format_html_join

format_html_join's args_generator argument can be anything that contains
tuples of things that can be coerced to strings or that have a
`__html__` method.

Fixes #721.

* Use `Iterable[Iterable[Any]]` as `args_generator` type

* Run linter
This commit is contained in:
rolandcrosby-check
2022-01-12 01:44:14 -05:00
committed by GitHub
parent 4cdf8a8d39
commit 3c1e9e3884

View File

@@ -1,5 +1,5 @@
from html.parser import HTMLParser from html.parser import HTMLParser
from typing import Any, Iterator, List, Optional, Tuple, Union from typing import Any, Iterable, List, Optional, Tuple
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
@@ -16,9 +16,7 @@ def escapejs(value: Any) -> SafeText: ...
def json_script(value: Any, element_id: str) -> SafeText: ... def json_script(value: Any, element_id: str) -> SafeText: ...
def conditional_escape(text: Any) -> str: ... def conditional_escape(text: Any) -> str: ...
def format_html(format_string: str, *args: Any, **kwargs: Any) -> SafeText: ... def format_html(format_string: str, *args: Any, **kwargs: Any) -> SafeText: ...
def format_html_join( def format_html_join(sep: str, format_string: str, args_generator: Iterable[Iterable[Any]]) -> SafeText: ...
sep: str, format_string: str, args_generator: Union[Iterator[Any], List[Tuple[str]]]
) -> SafeText: ...
def linebreaks(value: Any, autoescape: bool = ...) -> str: ... def linebreaks(value: Any, autoescape: bool = ...) -> str: ...
class MLStripper(HTMLParser): class MLStripper(HTMLParser):