style(parser): Improve the type hint for find_by_text and find_by_regex
This commit is contained in:
@@ -1074,6 +1074,26 @@ class Selector(SelectorsGeneration):
|
|||||||
|
|
||||||
return Selectors(map(self.__element_convertor, similar_elements))
|
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(
|
def find_by_text(
|
||||||
self,
|
self,
|
||||||
text: str,
|
text: str,
|
||||||
@@ -1122,6 +1142,24 @@ class Selector(SelectorsGeneration):
|
|||||||
return results[0]
|
return results[0]
|
||||||
return results
|
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(
|
def find_by_regex(
|
||||||
self,
|
self,
|
||||||
query: str | Pattern[str],
|
query: str | Pattern[str],
|
||||||
|
|||||||
Reference in New Issue
Block a user