-
Notifications
You must be signed in to change notification settings - Fork 573
chore: fix some mypy errors #1153
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
Conversation
Co-authored-by: Copilot <[email protected]>
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.
Pull Request Overview
This PR addresses mypy type checking errors throughout the Appium codebase. The changes primarily involve adding type annotations, type ignore directives, and type casting to resolve type compatibility issues with the library's method chaining patterns and selenium integration.
Key changes:
- Added
# type: ignore[override]directives to allow method chaining return types that differ from Selenium's base classes - Introduced type casting with
cast()to resolve argument type mismatches in Flutter integration - Added TYPE_CHECKING blocks with stub methods for improved type hinting
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| appium/webdriver/webelement.py | Adds TYPE_CHECKING block with find_element/find_elements stubs and override annotation for send_keys |
| appium/webdriver/webdriver.py | Adds TYPE_CHECKING block with find methods, fixes extensions parameter type, and adds command_executor annotation |
| appium/webdriver/extensions/flutter_integration/flutter_finder.py | Uses cast() to resolve AppiumBy constant type mismatches |
| appium/webdriver/extensions/flutter_integration/flutter_commands.py | Updates return type annotation to include WebElement in union |
| appium/webdriver/extensions/android/activities.py | Adds type ignore for WebDriverWait type variable issue |
| appium/webdriver/common/appiumby.py | Adds missing '-flutter text' constant to AppiumByType list |
| '-flutter semantics label', | ||
| '-flutter type', | ||
| '-flutter key', | ||
| '-flutter text', |
Copilot
AI
Aug 7, 2025
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.
Adding '-flutter text' to the AppiumByType list appears inconsistent with the existing Flutter constants. The other Flutter constants follow a pattern like '-flutter semantics label', '-flutter type', '-flutter key', but there's no corresponding AppiumBy.FLUTTER_INTEGRATION_TEXT constant visible in the context.
|
I'll merge this to publish a patch, then moving to #1155 |
Fixes some mypy errors.
# type: ignore[override]to ignore incompatible type errors because of our lirbary's override to let users chain methodstype: ignore[arg-type]for ignorable errors for selenium libfind_elementandfind_elementsfor typehint usageweb_element_cls=MobileWebElementso they are necessary only for typehintAfter
Before