Skip to content

Conversation

perrygoy
Copy link
Member

@perrygoy perrygoy commented Jul 9, 2025

Python 3.8 has reached its end-of-life, so let's remove that. Also let's add Python 3.13 while we're at it, and update all the files to use the new rules from black, ruff, and mypy!

This PR is almost entirely mechanical, with some small tweaks for mypy to be happy.

@perrygoy perrygoy requested a review from bandophahita July 9, 2025 21:55

@wraps(func)
def wrapper(*args: P.args, **kwargs: P.kwargs) -> Function:
def wrapper(*args: P.args, **kwargs: P.kwargs) -> Callable[P, T]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Dang, this was so so so incorrect. I'm actually surprised even the old mypy allowed it.
This is what it should be:

def pos_args_deprecated(*keywords: str) -> Callable[[Callable[P, T]], Callable[P, T]]:
    """Warn users which positional arguments should be called via keyword."""

    def deprecated(func: Callable[P, T]) -> Callable[P, T]:
        argnames = func.__code__.co_varnames[: func.__code__.co_argcount]
        i = min([argnames.index(kw) for kw in keywords])
        kw_argnames = argnames[i:]

        @wraps(func)
        def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:

Copy link
Contributor

@bandophahita bandophahita left a comment

Choose a reason for hiding this comment

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

It's my fault, but the annotations in common.py are way off.

driver = the_actor.ability_to(UseAMobileDevice).driver
try:
return driver.find_element(*self)
# bug in Selenium https://github.com/SeleniumHQ/selenium/issues/16035
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

The Appium team was fast -- they released 5.1.3 with the changes that fix the mypy error here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants