Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ check-all: ## Run all lint checks and unittest

.PHONY: isort
isort: ## Run isort
python -m isort $(ARGS) .
python -m isort --profile black $(ARGS) .

.PHONY: black
black: ## Run black
Expand Down
6 changes: 3 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
black = "~=22.12.0"
black = "<24.0.0"
httpretty = "~=1.1"
isort = "~=5.11"
mypy = "~=1.2"
isort = "<6.0"
mypy = "<2.0"
mock = "~=5.0"
pre-commit = "~=2.21"
pylint = "~=2.17.3"
Expand Down
27 changes: 27 additions & 0 deletions appium/protocols/webdriver/can_remember_extension_presence.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import TypeVar

from ..protocol import Protocol

T = TypeVar('T')


class CanRememberExtensionPresence(Protocol):
def assert_extension_exists(self: T, ext_name: str) -> T:
...

def mark_extension_absence(self: T, ext_name: str) -> T:
...
1 change: 0 additions & 1 deletion appium/webdriver/appium_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def __init__(
ignore_proxy: Optional[bool] = False,
init_args_for_pool_manager: Union[Dict[str, Any], None] = None,
):

# Need to call before super().__init__ in order to pass arguments for the pool manager in the super.
self._init_args_for_pool_manager = init_args_for_pool_manager or {}

Expand Down
26 changes: 13 additions & 13 deletions appium/webdriver/extensions/action_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import List, Optional, Tuple, TypeVar
from typing import TYPE_CHECKING, List, Optional, Tuple, cast

from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.actions import interaction
from selenium.webdriver.common.actions.action_builder import ActionBuilder
from selenium.webdriver.common.actions.mouse_button import MouseButton
from selenium.webdriver.common.actions.pointer_input import PointerInput

from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
from appium.webdriver.webelement import WebElement

T = TypeVar('T', bound=CanExecuteCommands)
if TYPE_CHECKING:
from appium.webdriver.webdriver import WebDriver


class ActionHelpers:
def scroll(self: T, origin_el: WebElement, destination_el: WebElement, duration: Optional[int] = None) -> T:
def scroll(self, origin_el: WebElement, destination_el: WebElement, duration: Optional[int] = None) -> 'WebDriver':
"""Scrolls from one element to another

Args:
Expand Down Expand Up @@ -59,9 +59,9 @@ def scroll(self: T, origin_el: WebElement, destination_el: WebElement, duration:
actions.w3c_actions.pointer_action.move_to(destination_el)
actions.w3c_actions.pointer_action.release()
actions.perform()
return self
return cast('WebDriver', self)

def drag_and_drop(self: T, origin_el: WebElement, destination_el: WebElement) -> T:
def drag_and_drop(self, origin_el: WebElement, destination_el: WebElement) -> 'WebDriver':
"""Drag the origin element to the destination element

Args:
Expand All @@ -77,9 +77,9 @@ def drag_and_drop(self: T, origin_el: WebElement, destination_el: WebElement) ->
actions.w3c_actions.pointer_action.move_to(destination_el)
actions.w3c_actions.pointer_action.release()
actions.perform()
return self
return cast('WebDriver', self)

def tap(self: T, positions: List[Tuple[int, int]], duration: Optional[int] = None) -> T:
def tap(self, positions: List[Tuple[int, int]], duration: Optional[int] = None) -> 'WebDriver':
"""Taps on an particular place with up to five fingers, holding for a
certain time

Expand Down Expand Up @@ -127,9 +127,9 @@ def tap(self: T, positions: List[Tuple[int, int]], duration: Optional[int] = Non
new_input.create_pause(0.1)
new_input.create_pointer_up(MouseButton.LEFT)
actions.perform()
return self
return cast('WebDriver', self)

def swipe(self: T, start_x: int, start_y: int, end_x: int, end_y: int, duration: int = 0) -> T:
def swipe(self, start_x: int, start_y: int, end_x: int, end_y: int, duration: int = 0) -> 'WebDriver':
"""Swipe from one point to another point, for an optional duration.

Args:
Expand All @@ -156,9 +156,9 @@ def swipe(self: T, start_x: int, start_y: int, end_x: int, end_y: int, duration:
actions.w3c_actions.pointer_action.move_to_location(end_x, end_y)
actions.w3c_actions.pointer_action.release()
actions.perform()
return self
return cast('WebDriver', self)

def flick(self: T, start_x: int, start_y: int, end_x: int, end_y: int) -> T:
def flick(self, start_x: int, start_y: int, end_x: int, end_y: int) -> 'WebDriver':
"""Flick from one point to another point.

Args:
Expand All @@ -180,4 +180,4 @@ def flick(self: T, start_x: int, start_y: int, end_x: int, end_y: int) -> T:
actions.w3c_actions.pointer_action.move_to_location(end_x, end_y)
actions.w3c_actions.pointer_action.release()
actions.perform()
return self
return cast('WebDriver', self)
1 change: 0 additions & 1 deletion appium/webdriver/extensions/android/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


class Power(CanExecuteCommands):

AC_OFF, AC_ON = 'off', 'on'

def set_power_capacity(self: T, percent: int) -> T:
Expand Down
Loading