Skip to content

Commit 7fbf4bb

Browse files
committed
refactor: update parameter documentation to use 'Args' format for consistency across multiple files
1 parent a14f153 commit 7fbf4bb

File tree

7 files changed

+170
-339
lines changed

7 files changed

+170
-339
lines changed

py/selenium/webdriver/common/bidi/browser.py

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def get_state(self) -> str:
5959
"""Gets the state of the client window.
6060
6161
Returns:
62-
-------
6362
str: The state of the client window (one of the ClientWindowState constants).
6463
"""
6564
return self.state
@@ -68,7 +67,6 @@ def get_client_window(self) -> str:
6867
"""Gets the client window identifier.
6968
7069
Returns:
71-
-------
7270
str: The client window identifier.
7371
"""
7472
return self.client_window
@@ -77,7 +75,6 @@ def get_width(self) -> int:
7775
"""Gets the width of the client window.
7876
7977
Returns:
80-
-------
8178
int: The width of the client window.
8279
"""
8380
return self.width
@@ -86,7 +83,6 @@ def get_height(self) -> int:
8683
"""Gets the height of the client window.
8784
8885
Returns:
89-
-------
9086
int: The height of the client window.
9187
"""
9288
return self.height
@@ -95,7 +91,6 @@ def get_x(self) -> int:
9591
"""Gets the x coordinate of the client window.
9692
9793
Returns:
98-
-------
9994
int: The x coordinate of the client window.
10095
"""
10196
return self.x
@@ -104,7 +99,6 @@ def get_y(self) -> int:
10499
"""Gets the y coordinate of the client window.
105100
106101
Returns:
107-
-------
108102
int: The y coordinate of the client window.
109103
"""
110104
return self.y
@@ -113,7 +107,6 @@ def is_active(self) -> bool:
113107
"""Checks if the client window is active.
114108
115109
Returns:
116-
-------
117110
bool: True if the client window is active, False otherwise.
118111
"""
119112
return self.active
@@ -122,16 +115,13 @@ def is_active(self) -> bool:
122115
def from_dict(cls, data: dict) -> "ClientWindowInfo":
123116
"""Creates a ClientWindowInfo instance from a dictionary.
124117
125-
Parameters:
126-
-----------
118+
Args:
127119
data: A dictionary containing the client window information.
128120
129121
Returns:
130-
-------
131122
ClientWindowInfo: A new instance of ClientWindowInfo.
132123
133124
Raises:
134-
------
135125
ValueError: If required fields are missing or have invalid types.
136126
"""
137127
try:
@@ -175,7 +165,7 @@ def from_dict(cls, data: dict) -> "ClientWindowInfo":
175165
active=active,
176166
)
177167
except (KeyError, TypeError) as e:
178-
raise ValueError(f"Invalid data format for ClientWindowInfo: {e}")
168+
raise ValueError(f"Invalid data format for ClientWindowInfo: {e}") from e
179169

180170

181171
class Browser:
@@ -194,14 +184,12 @@ def create_user_context(
194184
) -> str:
195185
"""Creates a new user context.
196186
197-
Parameters:
198-
-----------
199-
accept_insecure_certs: Optional flag to accept insecure TLS certificates
200-
proxy: Optional proxy configuration for the user context
201-
unhandled_prompt_behavior: Optional configuration for handling user prompts
187+
Args:
188+
accept_insecure_certs: Optional flag to accept insecure TLS certificates.
189+
proxy: Optional proxy configuration for the user context.
190+
unhandled_prompt_behavior: Optional configuration for handling user prompts.
202191
203192
Returns:
204-
-------
205193
str: The ID of the created user context.
206194
"""
207195
params: dict[str, Any] = {}
@@ -222,7 +210,6 @@ def get_user_contexts(self) -> list[str]:
222210
"""Gets all user contexts.
223211
224212
Returns:
225-
-------
226213
List[str]: A list of user context IDs.
227214
"""
228215
result = self.conn.execute(command_builder("browser.getUserContexts", {}))
@@ -231,16 +218,14 @@ def get_user_contexts(self) -> list[str]:
231218
def remove_user_context(self, user_context_id: str) -> None:
232219
"""Removes a user context.
233220
234-
Parameters:
235-
-----------
221+
Args:
236222
user_context_id: The ID of the user context to remove.
237223
238224
Raises:
239-
------
240-
Exception: If the user context ID is "default" or does not exist.
225+
ValueError: If the user context ID is "default" or does not exist.
241226
"""
242227
if user_context_id == "default":
243-
raise Exception("Cannot remove the default user context")
228+
raise ValueError("Cannot remove the default user context")
244229

245230
params = {"userContext": user_context_id}
246231
self.conn.execute(command_builder("browser.removeUserContext", params))
@@ -249,7 +234,6 @@ def get_client_windows(self) -> list[ClientWindowInfo]:
249234
"""Gets all client windows.
250235
251236
Returns:
252-
-------
253237
List[ClientWindowInfo]: A list of client window information.
254238
"""
255239
result = self.conn.execute(command_builder("browser.getClientWindows", {}))

0 commit comments

Comments
 (0)