Skip to content

Commit

Permalink
[py]: type hints for missing dunder __init__
Browse files Browse the repository at this point in the history
  • Loading branch information
symonk committed Dec 10, 2022
1 parent ae57ced commit 3152c96
Show file tree
Hide file tree
Showing 17 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion py/selenium/webdriver/chrome/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(
chrome_options=None,
service: Service = None,
keep_alive=DEFAULT_KEEP_ALIVE,
):
) -> None:
"""
Creates a new instance of the chrome driver.
Starts the service and then creates new instance of chrome driver.
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/chromium/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(
browser_name: str,
keep_alive: bool = True,
ignore_proxy: typing.Optional[bool] = False,
):
) -> None:
super().__init__(remote_server_addr, keep_alive, ignore_proxy=ignore_proxy)
self.browser_name = browser_name
self._commands["launchApp"] = ("POST", "/session/$sessionId/chromium/launch_app")
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/chromium/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(
log_path: typing.Optional[str] = None,
env: typing.Optional[typing.Mapping[str, str]] = None,
start_error_message: typing.Optional[str] = None,
):
) -> None:
self.service_args = service_args or []
if log_path:
self.service_args.append(f"--log-path={log_path}")
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/chromium/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(
service_log_path=DEFAULT_SERVICE_LOG_PATH,
service: Service = None,
keep_alive=DEFAULT_KEEP_ALIVE,
):
) -> None:
"""
Creates a new WebDriver instance of the ChromiumDriver.
Starts the service and then creates new WebDriver instance of ChromiumDriver.
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/edge/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
log_path: typing.Optional[str] = None,
service_args: typing.Optional[typing.List[str]] = None,
env: typing.Optional[typing.Mapping[str, str]] = None,
):
) -> None:
self.service_args = service_args or []

if verbose:
Expand Down
4 changes: 2 additions & 2 deletions py/selenium/webdriver/edge/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def __init__(
service_log_path=DEFAULT_SERVICE_LOG_PATH,
service: Service = None,
keep_alive=False,
verbose=False,
):
verbose=False, # Todo: Why is this now unused?
) -> None:
"""
Creates a new instance of the edge driver.
Starts the service and then creates new instance of edge driver.
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/firefox/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FirefoxRemoteConnection(RemoteConnection):

browser_name = DesiredCapabilities.FIREFOX["browserName"]

def __init__(self, remote_server_addr, keep_alive=True, ignore_proxy=False):
def __init__(self, remote_server_addr, keep_alive=True, ignore_proxy=False) -> None:
super().__init__(remote_server_addr, keep_alive, ignore_proxy=ignore_proxy)

self._commands["GET_CONTEXT"] = ("GET", "/session/$sessionId/moz/context")
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/firefox/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(
service_args: typing.Optional[typing.List[str]] = None,
log_path: typing.Optional[str] = None,
env: typing.Optional[typing.Mapping[str, str]] = None,
):
) -> None:
# Todo: This is vastly inconsistent, requires a follow up to standardise.
file = log_path or "geckodriver.log"
log_file = open(file, "a+", encoding="utf-8")
Expand Down
4 changes: 2 additions & 2 deletions py/selenium/webdriver/firefox/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def __init__(
service=None,
desired_capabilities=None,
log_path=DEFAULT_LOG_PATH,
keep_alive=True,
):
keep_alive=True, # Todo: Why is this now unused?
) -> None:
"""Starts a new local session of Firefox.
Based on the combination and specificity of the various keyword
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/ie/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Options(ArgOptions):
ATTACH_TO_EDGE_CHROME = "ie.edgechromium"
EDGE_EXECUTABLE_PATH = "ie.edgepath"

def __init__(self):
def __init__(self) -> None:
super().__init__()
self._options = {}
self._additional = {}
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/ie/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
host: typing.Optional[str] = None,
log_level: typing.Optional[str] = None,
log_file: typing.Optional[str] = None,
):
) -> None:
"""
Creates a new instance of the Service
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/ie/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(
service: Service = None,
desired_capabilities=None,
keep_alive=DEFAULT_KEEP_ALIVE,
):
) -> None:
"""
Creates a new instance of the Ie driver.
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/remote/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def __init__(
keep_alive=True,
file_detector=None,
options: Union[BaseOptions, List[BaseOptions]] = None,
):
) -> None:
"""
Create a new driver that will issue commands using the wire protocol.
Expand Down
4 changes: 2 additions & 2 deletions py/selenium/webdriver/remote/webelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ class WebElement(BaseWebElement):
performed through this interface.
All method calls will do a freshness check to ensure that the element
reference is still valid. This essentially determines whether or not the
reference is still valid. This essentially determines whether the
element is still attached to the DOM. If this test fails, then an
``StaleElementReferenceException`` is thrown, and all future calls to this
instance will fail."""

def __init__(self, parent, id_):
def __init__(self, parent, id_) -> None:
self._parent = parent
self._id = id_

Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/safari/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SafariRemoteConnection(RemoteConnection):

browser_name = DesiredCapabilities.SAFARI["browserName"]

def __init__(self, remote_server_addr: str, keep_alive: bool = True, ignore_proxy: bool = False):
def __init__(self, remote_server_addr: str, keep_alive: bool = True, ignore_proxy: bool = False) -> None:
super().__init__(remote_server_addr, keep_alive, ignore_proxy=ignore_proxy)
self._commands["GET_PERMISSIONS"] = ("GET", "/session/$sessionId/apple/permissions")
self._commands["SET_PERMISSIONS"] = ("POST", "/session/$sessionId/apple/permissions")
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/safari/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(
quiet: bool = False,
service_args: typing.Optional[typing.List[str]] = None,
env: typing.Optional[typing.Mapping[str, str]] = None,
):
) -> None:
self._check_executable(executable_path)
self.service_args = service_args or []
self.quiet = quiet
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/safari/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(
service_args=None,
options: Options = None,
service: Service = None,
):
) -> None:
"""
Creates a new Safari driver instance and launches or finds a running safaridriver service.
Expand Down

0 comments on commit 3152c96

Please sign in to comment.