Skip to content

Commit 41a34df

Browse files
authored
Fix "NoReturn" type-hinnts. (#10120)
The [NoReturn](https://docs.python.org/3/library/typing.html#typing.NoReturn) type-hint in Python indicates the function never returns (e.g., it always raises an exception). These methods are incorrectly marked as `NoReturn` when they in fact return no value (`None`), and should by hinted using `None`.
1 parent 0f60649 commit 41a34df

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

py/selenium/webdriver/common/options.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# under the License.
1717

1818
from abc import ABCMeta, abstractmethod
19-
from typing import NoReturn
2019
from selenium.webdriver.common.proxy import Proxy
2120
from selenium.common.exceptions import InvalidArgumentException
2221

@@ -48,7 +47,7 @@ def browser_version(self) -> str:
4847
return self._caps["browserVersion"]
4948

5049
@browser_version.setter
51-
def browser_version(self, version: str) -> NoReturn:
50+
def browser_version(self, version: str) -> None:
5251
"""
5352
Requires the major version of the browser to match provided value:
5453
https://w3c.github.io/webdriver/#dfn-browser-version
@@ -65,7 +64,7 @@ def platform_name(self) -> str:
6564
return self._caps["platformName"]
6665

6766
@platform_name.setter
68-
def platform_name(self, platform: str) -> NoReturn:
67+
def platform_name(self, platform: str) -> None:
6968
"""
7069
Requires the platform to match the provided value: https://w3c.github.io/webdriver/#dfn-platform-name
7170
@@ -81,7 +80,7 @@ def page_load_strategy(self) -> str:
8180
return self._caps["pageLoadStrategy"]
8281

8382
@page_load_strategy.setter
84-
def page_load_strategy(self, strategy: str) -> NoReturn:
83+
def page_load_strategy(self, strategy: str) -> None:
8584
"""
8685
Determines the point at which a navigation command is returned:
8786
https://w3c.github.io/webdriver/#dfn-table-of-page-load-strategies
@@ -101,7 +100,7 @@ def unhandled_prompt_behavior(self) -> str:
101100
return self._caps["unhandledPromptBehavior"]
102101

103102
@unhandled_prompt_behavior.setter
104-
def unhandled_prompt_behavior(self, behavior: str) -> NoReturn:
103+
def unhandled_prompt_behavior(self, behavior: str) -> None:
105104
"""
106105
How the driver should respond when an alert is present and the command sent is not handling the alert:
107106
https://w3c.github.io/webdriver/#dfn-table-of-page-load-strategies
@@ -122,7 +121,7 @@ def timeouts(self) -> dict:
122121
return self._caps["timeouts"]
123122

124123
@timeouts.setter
125-
def timeouts(self, timeouts: dict) -> NoReturn:
124+
def timeouts(self, timeouts: dict) -> None:
126125
"""
127126
How long the driver should wait for actions to complete before returning an error
128127
https://w3c.github.io/webdriver/#timeouts
@@ -159,7 +158,7 @@ def accept_insecure_certs(self) -> bool:
159158
return self._caps.get('acceptInsecureCerts')
160159

161160
@accept_insecure_certs.setter
162-
def accept_insecure_certs(self, value: bool) -> NoReturn:
161+
def accept_insecure_certs(self, value: bool) -> None:
163162
"""
164163
Whether untrusted and self-signed TLS certificates are implicitly trusted:
165164
https://w3c.github.io/webdriver/#dfn-insecure-tls-certificates

0 commit comments

Comments
 (0)