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 warings import deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warings?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Opps😅



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 not yet implemented")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would rather say is deprecated for removal

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I assumed those methods would be implemented later. If there are no plans to do so, I will make the changes as you suggested.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not sure it makes sense to implement them in mobile context, but it still makes sense to confirm that with other maintainers

def pin_script(self, script: str, script_key: Optional[Any] = None) -> Any: ...

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

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

def execute_async_script(self, script: str, *args: Any) -> Any: ...
@deprecated("execute_async_script is not yet implemented")
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
Loading