From 8829cb09a31e62d32c70b2b8a48aed9705d4468c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20J=C3=A4rventaus?= Date: Wed, 12 Nov 2025 12:55:01 +0200 Subject: [PATCH] Some typing overloads for methods that I forgot to commit --- src/wikitextprocessor/parser.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/wikitextprocessor/parser.py b/src/wikitextprocessor/parser.py index 4e96d984..8643dc6b 100644 --- a/src/wikitextprocessor/parser.py +++ b/src/wikitextprocessor/parser.py @@ -493,6 +493,12 @@ def filter_empty_str_child(self) -> Iterator[Union[str, "WikiNode"]]: else: yield node + @overload + def find_html( + self, + target_tags: str | list[str], + ) -> Iterator["HTMLNode"]: ... + @overload def find_html( self, @@ -506,9 +512,23 @@ def find_html( def find_html( self, target_tags: str | list[str], - with_index: Literal[False] = ..., - attr_name: str = ..., - attr_value: str = ..., + with_index: Literal[False], + attr_name: str, + attr_value: str, + ) -> Iterator["HTMLNode"]: ... + + @overload + def find_html( + self, + target_tags: str | list[str], + with_index: Literal[True], + ) -> Iterator[tuple[int, "HTMLNode"]]: ... + + @overload + def find_html( + self, + target_tags: str | list[str], + with_index: Literal[False], ) -> Iterator["HTMLNode"]: ... def find_html(