Skip to content

Commit 44db66f

Browse files
committed
[py] Fix : MyPy Type Errors
1 parent e943cc1 commit 44db66f

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

py/selenium/webdriver/support/event_firing_webdriver.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def after_navigate_to(self, url, driver):
7373
if not isinstance(event_listener, AbstractEventListener):
7474
raise WebDriverException("Event listener must be a subclass of AbstractEventListener")
7575
self._driver = driver
76-
self._driver._wrap_value = self._wrap_value
76+
self._original_wrap_value = getattr(self._driver, "_wrap_value", None)
77+
setattr(self._driver, "_wrap_value", self._wrap_value)
7778
self._listener = event_listener
7879

7980
@property

py/selenium/webdriver/webkitgtk/service.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
from selenium.webdriver.common import service
2424

25-
DEFAULT_EXECUTABLE_PATH: str = shutil.which("WebKitWebDriver")
25+
DEFAULT_EXECUTABLE_PATH: Optional[str] = shutil.which("WebKitWebDriver")
2626

2727

2828
class Service(service.Service):
@@ -40,7 +40,7 @@ class Service(service.Service):
4040

4141
def __init__(
4242
self,
43-
executable_path: str = DEFAULT_EXECUTABLE_PATH,
43+
executable_path: Optional[str] = DEFAULT_EXECUTABLE_PATH,
4444
port: int = 0,
4545
log_path: Optional[str] = None,
4646
log_output: Optional[str] = None,
@@ -49,15 +49,17 @@ def __init__(
4949
**kwargs,
5050
) -> None:
5151
self._service_args = list(service_args or [])
52+
log_file = None
53+
output_file = None
5254
if log_path is not None:
5355
warnings.warn("log_path is deprecated, use log_output instead", DeprecationWarning, stacklevel=2)
54-
log_path = open(log_path, "wb")
55-
log_output = open(log_output, "wb") if log_output else None
56-
56+
log_file = open(log_path, "wb")
57+
if log_output:
58+
output_file = open(log_output, "wb")
5759
super().__init__(
5860
executable_path=executable_path,
5961
port=port,
60-
log_output=log_path or log_output,
62+
log_output=log_file or output_file,
6163
env=env,
6264
**kwargs,
6365
)

py/selenium/webdriver/wpewebkit/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Service(service.Service):
3939

4040
def __init__(
4141
self,
42-
executable_path: str = DEFAULT_EXECUTABLE_PATH,
42+
executable_path: Optional[str] = DEFAULT_EXECUTABLE_PATH,
4343
port: int = 0,
4444
log_output: Optional[str] = None,
4545
service_args: Optional[Sequence[str]] = None,

0 commit comments

Comments
 (0)