Skip to content
20 changes: 14 additions & 6 deletions appium/protocols/webdriver/can_execute_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Any, List, Optional, Protocol
from typing import Any, List, Optional, Protocol, TYPE_CHECKING
from warnings import deprecated


class CanExecuteScripts(Protocol):
def pin_script(self, script: str, script_key: Optional[Any] = None) -> Any: ...
Comment thread
KazuCocoa marked this conversation as resolved.
def execute_script(self, script: str, *args: Any) -> Any: ...

def unpin(self, script_key: Any) -> None: ...
# TODO: remove `if not TYPE_CHECKING` guard after properly implement them
# The use of these methods will produce DeprecationWarnings at runtime
if not TYPE_CHECKING:
@deprecated("pin_script is deprecated for removal")
def pin_script(self, script: str, script_key: Optional[Any] = None) -> Any: ...

def get_pinned_scripts(self) -> List[str]: ...
@deprecated("unpin is deprecated for removal")
def unpin(self, script_key: Any) -> None: ...

def execute_script(self, script: str, *args: Any) -> Any: ...
@deprecated("get_pinned_scripts is deprecated for removal")
def get_pinned_scripts(self) -> List[str]: ...

def execute_async_script(self, script: str, *args: Any) -> Any: ...
@deprecated("execute_async_script is deprecated for removal")
def execute_async_script(self, script: str, *args: Any) -> Any: ...
2 changes: 2 additions & 0 deletions appium/webdriver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
Appium Python Client: WebDriver module
"""

__all__ = ["Remote", "WebElement"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks reasonable to me. This fixes mypy --strict also.


from .webdriver import WebDriver as Remote
from .webelement import WebElement