Skip to content

Commit 24d0194

Browse files
committed
[py] Fix the rest of the linting errors
1 parent 04791a7 commit 24d0194

File tree

25 files changed

+141
-123
lines changed

25 files changed

+141
-123
lines changed

py/selenium/webdriver/chromium/webdriver.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def set_network_conditions(self, **network_conditions) -> None:
9999
offline=False,
100100
latency=5, # additional latency (ms)
101101
download_throughput=500 * 1024, # maximal throughput
102-
upload_throughput=500 * 1024) # maximal throughput
102+
upload_throughput=500 * 1024,
103+
) # maximal throughput
103104
104105
Note: 'throughput' can be used to set both (for download and upload).
105106
"""
@@ -119,7 +120,7 @@ def set_permissions(self, name: str, value: str) -> None:
119120
:Usage:
120121
::
121122
122-
driver.set_permissions('clipboard-read', 'denied')
123+
driver.set_permissions("clipboard-read", "denied")
123124
"""
124125
self.execute("setPermissions", {"descriptor": {"name": name}, "state": value})
125126

@@ -172,10 +173,10 @@ def get_log(self, log_type):
172173
173174
Example:
174175
--------
175-
>>> driver.get_log('browser')
176-
>>> driver.get_log('driver')
177-
>>> driver.get_log('client')
178-
>>> driver.get_log('server')
176+
>>> driver.get_log("browser")
177+
>>> driver.get_log("driver")
178+
>>> driver.get_log("client")
179+
>>> driver.get_log("server")
179180
"""
180181
return self.execute(Command.GET_LOG, {"type": log_type})["value"]
181182

py/selenium/webdriver/common/action_chains.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def key_down(self, value: str, element: WebElement | None = None) -> ActionChain
201201
202202
Example, pressing ctrl+c::
203203
204-
ActionChains(driver).key_down(Keys.CONTROL).send_keys('c').key_up(Keys.CONTROL).perform()
204+
ActionChains(driver).key_down(Keys.CONTROL).send_keys("c").key_up(Keys.CONTROL).perform()
205205
"""
206206
if element:
207207
self.click(element)
@@ -221,7 +221,7 @@ def key_up(self, value: str, element: WebElement | None = None) -> ActionChains:
221221
222222
Example, pressing ctrl+c::
223223
224-
ActionChains(driver).key_down(Keys.CONTROL).send_keys('c').key_up(Keys.CONTROL).perform()
224+
ActionChains(driver).key_down(Keys.CONTROL).send_keys("c").key_up(Keys.CONTROL).perform()
225225
"""
226226
if element:
227227
self.click(element)

py/selenium/webdriver/common/actions/action_builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def perform(self) -> None:
159159
>>> action_builder = ActionBuilder(driver)
160160
>>> keyboard = action_builder.key_input
161161
>>> el = driver.find_element(id: "some_id")
162-
>>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys('keys').perform()
162+
>>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys("keys").perform()
163163
"""
164164
enc = {"actions": []}
165165
for device in self.devices:
@@ -177,7 +177,7 @@ def clear_actions(self) -> None:
177177
>>> action_builder = ActionBuilder(driver)
178178
>>> keyboard = action_builder.key_input
179179
>>> el = driver.find_element(By.ID, "some_id")
180-
>>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys('keys')
180+
>>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys("keys")
181181
>>> action_builder.clear_actions()
182182
"""
183183
self.driver.execute(Command.W3C_CLEAR_ACTIONS)

py/selenium/webdriver/common/alert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def accept(self) -> None:
6767
:Usage:
6868
::
6969
70-
Alert(driver).accept() # Confirm a alert dialog.
70+
Alert(driver).accept() # Confirm a alert dialog.
7171
"""
7272
self.driver.execute(Command.W3C_ACCEPT_ALERT)
7373

py/selenium/webdriver/common/bidi/browsing_context.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@ def get_tree(
402402
max_depth: Optional[int] = None,
403403
root: Optional[str] = None,
404404
) -> List[BrowsingContextInfo]:
405-
"""Returns a tree of all descendent navigables including the given parent itself, or all top-level contexts when no parent is provided.
405+
"""Returns a tree of all descendent navigables including the given parent itself, or all top-level contexts
406+
when no parent is provided.
406407
407408
Parameters:
408409
-----------
@@ -513,7 +514,8 @@ def print(
513514
scale: float = 1.0,
514515
shrink_to_fit: bool = True,
515516
) -> str:
516-
"""Creates a paginated representation of a document, and returns it as a PDF document represented as a Base64-encoded string.
517+
"""Creates a paginated representation of a document, and returns it as a PDF document represented as a
518+
Base64-encoded string.
517519
518520
Parameters:
519521
-----------

py/selenium/webdriver/common/by.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,51 +28,51 @@ class By:
2828
--
2929
Select the element by its ID.
3030
31-
>>> element = driver.find_element(By.ID, 'myElement')
31+
>>> element = driver.find_element(By.ID, "myElement")
3232
3333
XPATH:
3434
------
3535
Select the element via XPATH.
3636
- absolute path
3737
- relative path
3838
39-
>>> element = driver.find_element(By.XPATH, '//html/body/div')
39+
>>> element = driver.find_element(By.XPATH, "//html/body/div")
4040
4141
LINK_TEXT:
4242
----------
4343
Select the link element having the exact text.
4444
45-
>>> element = driver.find_element(By.LINK_TEXT, 'myLink')
45+
>>> element = driver.find_element(By.LINK_TEXT, "myLink")
4646
4747
PARTIAL_LINK_TEXT:
4848
------------------
4949
Select the link element having the partial text.
5050
51-
>>> element = driver.find_element(By.PARTIAL_LINK_TEXT, 'my')
51+
>>> element = driver.find_element(By.PARTIAL_LINK_TEXT, "my")
5252
5353
NAME:
5454
----
5555
Select the element by its name attribute.
5656
57-
>>> element = driver.find_element(By.NAME, 'myElement')
57+
>>> element = driver.find_element(By.NAME, "myElement")
5858
5959
TAG_NAME:
6060
--------
6161
Select the element by its tag name.
6262
63-
>>> element = driver.find_element(By.TAG_NAME, 'div')
63+
>>> element = driver.find_element(By.TAG_NAME, "div")
6464
6565
CLASS_NAME:
6666
-----------
6767
Select the element by its class name.
6868
69-
>>> element = driver.find_element(By.CLASS_NAME, 'myElement')
69+
>>> element = driver.find_element(By.CLASS_NAME, "myElement")
7070
7171
CSS_SELECTOR:
7272
-------------
7373
Select the element by its CSS selector.
7474
75-
>>> element = driver.find_element(By.CSS_SELECTOR, 'div.myElement')
75+
>>> element = driver.find_element(By.CSS_SELECTOR, "div.myElement")
7676
"""
7777

7878
ID = "id"

py/selenium/webdriver/common/desired_capabilities.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ class DesiredCapabilities:
3131
3232
# Create a desired capabilities object as a starting point.
3333
capabilities = DesiredCapabilities.FIREFOX.copy()
34-
capabilities['platform'] = "WINDOWS"
35-
capabilities['version'] = "10"
34+
capabilities["platform"] = "WINDOWS"
35+
capabilities["version"] = "10"
3636
3737
# Instantiate an instance of Remote WebDriver with the desired capabilities.
38-
driver = webdriver.Remote(desired_capabilities=capabilities,
39-
command_executor=selenium_grid_url)
38+
driver = webdriver.Remote(desired_capabilities=capabilities, command_executor=selenium_grid_url)
4039
4140
Note: Always use '.copy()' on the DesiredCapabilities object to avoid the side
4241
effects of altering the Global class instance.

py/selenium/webdriver/firefox/firefox_profile.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,12 @@ def _addon_details(self, addon_path):
229229
230230
Returns::
231231
232-
{'id': u'[email protected]', # id of the addon
233-
'version': u'1.4', # version of the addon
234-
'name': u'Rainbow', # name of the addon
235-
'unpack': False } # whether to unpack the addon
232+
{
233+
"id": "[email protected]", # id of the addon
234+
"version": "1.4", # version of the addon
235+
"name": "Rainbow", # name of the addon
236+
"unpack": False,
237+
} # whether to unpack the addon
236238
"""
237239

238240
details = {"id": None, "unpack": False, "name": None, "version": None}

py/selenium/webdriver/firefox/webdriver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def install_addon(self, path, temporary=False) -> str:
123123
:Usage:
124124
::
125125
126-
driver.install_addon('/path/to/firebug.xpi')
126+
driver.install_addon("/path/to/firebug.xpi")
127127
"""
128128

129129
if os.path.isdir(path):
@@ -151,7 +151,7 @@ def uninstall_addon(self, identifier) -> None:
151151
:Usage:
152152
::
153153
154-
driver.uninstall_addon('[email protected]')
154+
driver.uninstall_addon("[email protected]")
155155
"""
156156
self.execute("UNINSTALL_ADDON", {"id": identifier})
157157

@@ -167,7 +167,7 @@ def get_full_page_screenshot_as_file(self, filename) -> bool:
167167
:Usage:
168168
::
169169
170-
driver.get_full_page_screenshot_as_file('/Screenshots/foo.png')
170+
driver.get_full_page_screenshot_as_file("/Screenshots/foo.png")
171171
"""
172172
if not filename.lower().endswith(".png"):
173173
warnings.warn(
@@ -196,7 +196,7 @@ def save_full_page_screenshot(self, filename) -> bool:
196196
:Usage:
197197
::
198198
199-
driver.save_full_page_screenshot('/Screenshots/foo.png')
199+
driver.save_full_page_screenshot("/Screenshots/foo.png")
200200
"""
201201
return self.get_full_page_screenshot_as_file(filename)
202202

py/selenium/webdriver/remote/switch_to.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def frame(self, frame_reference: Union[str, int, WebElement]) -> None:
7979
:Usage:
8080
::
8181
82-
driver.switch_to.frame('frame_name')
82+
driver.switch_to.frame("frame_name")
8383
driver.switch_to.frame(1)
8484
driver.switch_to.frame(driver.find_elements(By.TAG_NAME, "iframe")[0])
8585
"""
@@ -103,7 +103,7 @@ def new_window(self, type_hint: Optional[str] = None) -> None:
103103
:Usage:
104104
::
105105
106-
driver.switch_to.new_window('tab')
106+
driver.switch_to.new_window("tab")
107107
"""
108108
value = self._driver.execute(Command.NEW_WINDOW, {"type": type_hint})["value"]
109109
self._w3c_window(value["handle"])
@@ -128,7 +128,7 @@ def window(self, window_name: str) -> None:
128128
:Usage:
129129
::
130130
131-
driver.switch_to.window('main')
131+
driver.switch_to.window("main")
132132
"""
133133
self._w3c_window(window_name)
134134

0 commit comments

Comments
 (0)