Skip to content

Commit 0ddfd06

Browse files
committed
refactor: remove redundant asterisk from find method overloads and reorganize query method overloads
1 parent 3b64889 commit 0ddfd06

File tree

1 file changed

+45
-50
lines changed

1 file changed

+45
-50
lines changed

pydoll/elements/mixins/find_elements_mixin.py

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class FindElementsMixin:
4747
@overload
4848
async def find(
4949
self,
50-
*,
5150
id: Optional[str] = ...,
5251
class_name: Optional[str] = ...,
5352
name: Optional[str] = ...,
@@ -62,7 +61,6 @@ async def find(
6261
@overload
6362
async def find(
6463
self,
65-
*,
6664
id: Optional[str] = ...,
6765
class_name: Optional[str] = ...,
6866
name: Optional[str] = ...,
@@ -77,7 +75,6 @@ async def find(
7775
@overload
7876
async def find(
7977
self,
80-
*,
8178
id: Optional[str] = ...,
8279
class_name: Optional[str] = ...,
8380
name: Optional[str] = ...,
@@ -92,7 +89,6 @@ async def find(
9289
@overload
9390
async def find(
9491
self,
95-
*,
9692
id: Optional[str] = ...,
9793
class_name: Optional[str] = ...,
9894
name: Optional[str] = ...,
@@ -107,7 +103,6 @@ async def find(
107103
@overload
108104
async def find(
109105
self,
110-
*,
111106
id: Optional[str] = ...,
112107
class_name: Optional[str] = ...,
113108
name: Optional[str] = ...,
@@ -119,51 +114,6 @@ async def find(
119114
**attributes: dict[str, str],
120115
) -> Union['WebElement', list['WebElement'], None]: ...
121116

122-
@overload
123-
async def query(
124-
self,
125-
expression: str,
126-
timeout: int = ...,
127-
find_all: Literal[False] = False,
128-
raise_exc: Literal[True] = True,
129-
) -> 'WebElement': ...
130-
131-
@overload
132-
async def query(
133-
self,
134-
expression: str,
135-
timeout: int = ...,
136-
find_all: Literal[False] = False,
137-
raise_exc: Literal[False] = False,
138-
) -> Optional['WebElement']: ...
139-
140-
@overload
141-
async def query(
142-
self,
143-
expression: str,
144-
timeout: int = ...,
145-
find_all: Literal[True] = True,
146-
raise_exc: Literal[True] = True,
147-
) -> list['WebElement']: ...
148-
149-
@overload
150-
async def query(
151-
self,
152-
expression: str,
153-
timeout: int = ...,
154-
find_all: Literal[True] = True,
155-
raise_exc: Literal[False] = False,
156-
) -> Optional[list['WebElement']]: ...
157-
158-
@overload
159-
async def query(
160-
self,
161-
expression: str,
162-
timeout: int = ...,
163-
find_all: bool = ...,
164-
raise_exc: bool = ...,
165-
) -> Union['WebElement', list['WebElement'], None]: ...
166-
167117
async def find( # noqa: PLR0913, PLR0917
168118
self,
169119
id: Optional[str] = None,
@@ -221,6 +171,51 @@ async def find( # noqa: PLR0913, PLR0917
221171
by, value, timeout=timeout, find_all=find_all, raise_exc=raise_exc
222172
)
223173

174+
@overload
175+
async def query(
176+
self,
177+
expression: str,
178+
timeout: int = ...,
179+
find_all: Literal[False] = False,
180+
raise_exc: Literal[True] = True,
181+
) -> 'WebElement': ...
182+
183+
@overload
184+
async def query(
185+
self,
186+
expression: str,
187+
timeout: int = ...,
188+
find_all: Literal[False] = False,
189+
raise_exc: Literal[False] = False,
190+
) -> Optional['WebElement']: ...
191+
192+
@overload
193+
async def query(
194+
self,
195+
expression: str,
196+
timeout: int = ...,
197+
find_all: Literal[True] = True,
198+
raise_exc: Literal[True] = True,
199+
) -> list['WebElement']: ...
200+
201+
@overload
202+
async def query(
203+
self,
204+
expression: str,
205+
timeout: int = ...,
206+
find_all: Literal[True] = True,
207+
raise_exc: Literal[False] = False,
208+
) -> Optional[list['WebElement']]: ...
209+
210+
@overload
211+
async def query(
212+
self,
213+
expression: str,
214+
timeout: int = ...,
215+
find_all: bool = ...,
216+
raise_exc: bool = ...,
217+
) -> Union['WebElement', list['WebElement'], None]: ...
218+
224219
async def query(
225220
self, expression: str, timeout: int = 0, find_all: bool = False, raise_exc: bool = True
226221
) -> Union['WebElement', list['WebElement'], None]:

0 commit comments

Comments
 (0)