Skip to content

Commit 2c887b3

Browse files
authored
Merge branch 'SeleniumHQ:trunk' into py-bump-requirements
2 parents d53c583 + ff55efd commit 2c887b3

File tree

22 files changed

+62
-44
lines changed

22 files changed

+62
-44
lines changed

py/selenium/webdriver/chrome/service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class Service(service.ChromiumService):
3737

3838
def __init__(
3939
self,
40-
executable_path=None,
40+
executable_path: Optional[str] = None,
4141
port: int = 0,
4242
service_args: Optional[List[str]] = None,
43-
log_output: SubprocessStdAlias = None,
43+
log_output: Optional[SubprocessStdAlias] = None,
4444
env: Optional[Mapping[str, str]] = None,
4545
**kwargs,
4646
) -> None:

py/selenium/webdriver/chrome/webdriver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
from typing import Optional
19+
1820
from selenium.webdriver.chromium.webdriver import ChromiumDriver
1921
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
2022

@@ -27,8 +29,8 @@ class WebDriver(ChromiumDriver):
2729

2830
def __init__(
2931
self,
30-
options: Options = None,
31-
service: Service = None,
32+
options: Optional[Options] = None,
33+
service: Optional[Service] = None,
3234
keep_alive: bool = True,
3335
) -> None:
3436
"""Creates a new instance of the chrome driver. Starts the service and

py/selenium/webdriver/chromium/service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ class ChromiumService(service.Service):
3737

3838
def __init__(
3939
self,
40-
executable_path: str = None,
40+
executable_path: Optional[str] = None,
4141
port: int = 0,
4242
service_args: Optional[List[str]] = None,
43-
log_output: SubprocessStdAlias = None,
43+
log_output: Optional[SubprocessStdAlias] = None,
4444
env: Optional[Mapping[str, str]] = None,
45-
driver_path_env_key: str = None,
45+
driver_path_env_key: Optional[str] = None,
4646
**kwargs,
4747
) -> None:
4848
self.service_args = service_args or []

py/selenium/webdriver/chromium/webdriver.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
from typing import Optional
19+
1820
from selenium.webdriver.chromium.remote_connection import ChromiumRemoteConnection
1921
from selenium.webdriver.common.driver_finder import DriverFinder
2022
from selenium.webdriver.common.options import ArgOptions
@@ -29,10 +31,10 @@ class ChromiumDriver(RemoteWebDriver):
2931

3032
def __init__(
3133
self,
32-
browser_name: str = None,
33-
vendor_prefix: str = None,
34+
browser_name: Optional[str] = None,
35+
vendor_prefix: Optional[str] = None,
3436
options: ArgOptions = ArgOptions(),
35-
service: Service = None,
37+
service: Optional[Service] = None,
3638
keep_alive: bool = True,
3739
) -> None:
3840
"""Creates a new WebDriver instance of the ChromiumDriver. Starts the

py/selenium/webdriver/common/actions/key_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
class KeyActions(Interaction):
2828
def __init__(self, source: KeyInput | PointerInput | WheelInput | None = None) -> None:
29-
if not source:
29+
if source is None:
3030
source = KeyInput(KEY)
3131
self.source = source
3232
super().__init__(source)

py/selenium/webdriver/common/actions/pointer_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(self, source: Optional[PointerInput] = None, duration: int = 250):
3131
- source: PointerInput instance
3232
- duration: override the default 250 msecs of DEFAULT_MOVE_DURATION in source
3333
"""
34-
if not source:
34+
if source is None:
3535
source = PointerInput(interaction.POINTER_MOUSE, "mouse")
3636
self.source = source
3737
self._duration = duration

py/selenium/webdriver/common/actions/wheel_actions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17+
18+
from typing import Optional
19+
1720
from .interaction import Interaction
1821
from .wheel_input import WheelInput
1922

2023

2124
class WheelActions(Interaction):
22-
def __init__(self, source: WheelInput = None):
23-
if not source:
25+
def __init__(self, source: Optional[WheelInput] = None):
26+
if source is None:
2427
source = WheelInput("wheel")
2528
super().__init__(source)
2629

py/selenium/webdriver/common/options.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from abc import ABCMeta
2020
from abc import abstractmethod
2121
from enum import Enum
22+
from typing import List
2223
from typing import Optional
2324

2425
from selenium.common.exceptions import InvalidArgumentException
@@ -475,14 +476,14 @@ class ArgOptions(BaseOptions):
475476

476477
def __init__(self) -> None:
477478
super().__init__()
478-
self._arguments = []
479+
self._arguments: List[str] = []
479480

480481
@property
481482
def arguments(self):
482483
""":Returns: A list of arguments needed for the browser."""
483484
return self._arguments
484485

485-
def add_argument(self, argument) -> None:
486+
def add_argument(self, argument: str) -> None:
486487
"""Adds an argument to the list.
487488
488489
:Args:

py/selenium/webdriver/common/service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ class Service(ABC):
5555

5656
def __init__(
5757
self,
58-
executable_path: str = None,
58+
executable_path: Optional[str] = None,
5959
port: int = 0,
60-
log_output: SubprocessStdAlias = None,
60+
log_output: Optional[SubprocessStdAlias] = None,
6161
env: Optional[Mapping[Any, Any]] = None,
62-
driver_path_env_key: str = None,
62+
driver_path_env_key: Optional[str] = None,
6363
**kwargs,
6464
) -> None:
6565
if isinstance(log_output, str):

py/selenium/webdriver/edge/service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ class Service(service.ChromiumService):
3737

3838
def __init__(
3939
self,
40-
executable_path: str = None,
40+
executable_path: Optional[str] = None,
4141
port: int = 0,
42-
log_output: SubprocessStdAlias = None,
42+
log_output: Optional[SubprocessStdAlias] = None,
4343
service_args: Optional[List[str]] = None,
4444
env: Optional[Mapping[str, str]] = None,
45-
driver_path_env_key: str = None,
45+
driver_path_env_key: Optional[str] = None,
4646
**kwargs,
4747
) -> None:
4848
self.service_args = service_args or []

0 commit comments

Comments
 (0)