style(parser): Improve the type hint for find_by_text and find_by_regex

This commit is contained in:
Karim shoair
2026-02-06 03:19:00 +02:00
parent 05f62fba81
commit d00c34ee7f
+38
View File
@@ -1074,6 +1074,26 @@ class Selector(SelectorsGeneration):
return Selectors(map(self.__element_convertor, similar_elements))
@overload
def find_by_text(
self,
text: str,
first_match: Literal[True] = ...,
partial: bool = ...,
case_sensitive: bool = ...,
clean_match: bool = ...,
) -> "Selector": ...
@overload
def find_by_text(
self,
text: str,
first_match: Literal[False],
partial: bool = ...,
case_sensitive: bool = ...,
clean_match: bool = ...,
) -> "Selectors": ...
def find_by_text(
self,
text: str,
@@ -1122,6 +1142,24 @@ class Selector(SelectorsGeneration):
return results[0]
return results
@overload
def find_by_regex(
self,
query: str | Pattern[str],
first_match: Literal[True] = ...,
case_sensitive: bool = ...,
clean_match: bool = ...,
) -> "Selector": ...
@overload
def find_by_regex(
self,
query: str | Pattern[str],
first_match: Literal[False],
case_sensitive: bool = ...,
clean_match: bool = ...,
) -> "Selectors": ...
def find_by_regex(
self,
query: str | Pattern[str],