Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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