-
Notifications
You must be signed in to change notification settings - Fork 572
Add explicit type declarations #482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
32cd6bf
Fixed mypy warning: touch_action.py
ki4070ma a5b94ed
Fixed mypy warning: multi_action.py
ki4070ma a29821c
Fixed mypy warning: extensions/android
ki4070ma 160f334
Fixed mypy warning: extensions/search_context
ki4070ma 01506da
Updated
ki4070ma bb21500
Revert some changes to run unit test
ki4070ma f8bd382
Review comments
ki4070ma 88776fa
Updates
ki4070ma dde7ac4
Updates
ki4070ma a3ae246
Add mypy check to ci.sh
ki4070ma f39e41c
Add mypy to Pipfile
ki4070ma 0f0f1f9
Updates
ki4070ma 3d7f609
Update README
ki4070ma c2fb780
Revert unexpected changes
ki4070ma 809036a
Updates Dict
ki4070ma 52069f9
Revert unexpected changes
ki4070ma 4af6cb3
Updates
ki4070ma 24e9bd9
Review comments
ki4070ma 561d9f0
Review comments
ki4070ma 91a26a4
tweak
ki4070ma ad0fe09
Restore and modify changes
ki4070ma a09eba8
Fix wrong return type
ki4070ma e77e67e
Add comments
ki4070ma edecdd7
Revert unexpected changes
ki4070ma a7c2b43
Fix mypy error
ki4070ma 47f51ab
updates
ki4070ma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ mock = "~=3.0" | |
pylint = "~=2.4" | ||
astroid = "~=2.3" | ||
isort = "~=4.3" | ||
|
||
mypy = "==0.761" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,17 +19,25 @@ | |
# chaining as the spec requires. | ||
|
||
import copy | ||
from typing import TYPE_CHECKING, Dict, List, Optional, TypeVar, Union | ||
|
||
from appium.webdriver.mobilecommand import MobileCommand as Command | ||
|
||
if TYPE_CHECKING: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
from appium.webdriver.webdriver import WebDriver | ||
from appium.webdriver.webelement import WebElement | ||
from appium.webdriver.common.touch_action import TouchAction | ||
|
||
T = TypeVar('T', bound='MultiAction') | ||
|
||
|
||
class MultiAction(object): | ||
def __init__(self, driver, element=None): | ||
def __init__(self, driver: 'WebDriver', element: Optional['WebElement'] = None) -> None: | ||
self._driver = driver | ||
self._element = element | ||
self._touch_actions = [] | ||
self._touch_actions: List['TouchAction'] = [] | ||
|
||
def add(self, *touch_actions): | ||
def add(self, *touch_actions: 'TouchAction') -> None: | ||
"""Add TouchAction objects to the MultiAction, to be performed later. | ||
|
||
Args: | ||
|
@@ -49,7 +57,7 @@ def add(self, *touch_actions): | |
|
||
self._touch_actions.append(copy.copy(touch_action)) | ||
|
||
def perform(self): | ||
def perform(self: T) -> T: | ||
"""Perform the actions stored in the object. | ||
|
||
Usage: | ||
|
@@ -68,7 +76,7 @@ def perform(self): | |
return self | ||
|
||
@property | ||
def json_wire_gestures(self): | ||
def json_wire_gestures(self) -> Dict[str, Union[List, str]]: | ||
actions = [] | ||
for action in self._touch_actions: | ||
actions.append(action.json_wire_gestures) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋