From 3c1e9e388425853859c112eafa008f4f5ea877f4 Mon Sep 17 00:00:00 2001 From: rolandcrosby-check <88003730+rolandcrosby-check@users.noreply.github.com> Date: Wed, 12 Jan 2022 01:44:14 -0500 Subject: [PATCH] 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 --- django-stubs/utils/html.pyi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/django-stubs/utils/html.pyi b/django-stubs/utils/html.pyi index 314dcaa..ef35af0 100644 --- a/django-stubs/utils/html.pyi +++ b/django-stubs/utils/html.pyi @@ -1,5 +1,5 @@ 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 @@ -16,9 +16,7 @@ def escapejs(value: Any) -> SafeText: ... def json_script(value: Any, element_id: str) -> SafeText: ... def conditional_escape(text: Any) -> str: ... def format_html(format_string: str, *args: Any, **kwargs: Any) -> SafeText: ... -def format_html_join( - sep: str, format_string: str, args_generator: Union[Iterator[Any], List[Tuple[str]]] -) -> SafeText: ... +def format_html_join(sep: str, format_string: str, args_generator: Iterable[Iterable[Any]]) -> SafeText: ... def linebreaks(value: Any, autoescape: bool = ...) -> str: ... class MLStripper(HTMLParser):