Skip to content

[py] chore: enable mypy disallow untyped decorators and update type hints - #17974

Merged
iampopovich merged 3 commits into
SeleniumHQ:trunkfrom
iampopovich:chore/fix-mypy-disallow_untyped_decorators-warnings
Sep 3, 2026
Merged

[py] chore: enable mypy disallow untyped decorators and update type hints#17974
iampopovich merged 3 commits into
SeleniumHQ:trunkfrom
iampopovich:chore/fix-mypy-disallow_untyped_decorators-warnings

Conversation

@iampopovich

Copy link
Copy Markdown
Contributor

🔗 Related Issues

it fixes mypy warnings

 bidi-generate: wrote speculation.py
  INFO: Found 1 target...
  Target //py:mypy up-to-date:
    bazel-bin/py/mypy
  INFO: Elapsed time: 34.396s, Critical Path: 0.94s
  INFO: 17 processes: 277 action cache hit, 4 internal, 13 processwrapper-sandbox.
  INFO: Build completed successfully, 17 total actions
  INFO: Running command line: bazel-bin/py/mypy
  selenium/webdriver/remote/webdriver.py:1483: error: Untyped decorator makes function "remove_virtual_authenticator" untyped  [untyped-decorator]
  selenium/webdriver/remote/webdriver.py:1496: error: Untyped decorator makes function "add_credential" untyped  [untyped-decorator]
  selenium/webdriver/remote/webdriver.py:1513: error: Untyped decorator makes function "get_credentials" untyped  [untyped-decorator]
  selenium/webdriver/remote/webdriver.py:1521: error: Untyped decorator makes function "remove_credential" untyped  [untyped-decorator]
  selenium/webdriver/remote/webdriver.py:1538: error: Untyped decorator makes function "remove_all_credentials" untyped  [untyped-decorator]
  selenium/webdriver/remote/webdriver.py:1543: error: Untyped decorator makes function "set_user_verified" untyped  [untyped-decorator]
  Found 6 errors in 1 file (checked 108 source files)

💥 What does this PR do?

🔧 Implementation Notes

🤖 AI assistance

  • No substantial AI assistance used
  • AI assisted (complete below)
    • Tool(s): claude code + sonnet 5 with medium effort
    • What was generated: type hints
    • I reviewed all AI output and can explain the change

💡 Additional Considerations

🔄 Types of changes

  • Cleanup (formatting, renaming)

@iampopovich iampopovich self-assigned this Sep 2, 2026
@selenium-ci selenium-ci added the C-py Python Bindings label Sep 2, 2026
@iampopovich
iampopovich marked this pull request as ready for review September 2, 2026 23:31
Copilot AI lite review requested due to automatic review settings September 2, 2026 23:31
@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Copilot AI left a comment

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.

🟢 Approval recommended

The changes are narrowly scoped to typing/configuration and correctly address the reported mypy untyped-decorator issues without altering WebDriver behavior.

Pull request overview

This PR tightens the Python binding’s type-checking configuration by enabling mypy’s disallow_untyped_decorators, and updates the WebDriver virtual-authenticator decorators to be fully typed so annotated methods don’t become implicitly untyped.

Changes:

  • Enable mypy disallow_untyped_decorators in py/pyproject.toml.
  • Add ParamSpec/Concatenate-based typing to _required_chromium_based_browser and _required_virtual_authenticator decorators to preserve wrapped method signatures and satisfy mypy.
File summaries
File Description
py/selenium/webdriver/remote/webdriver.py Types the internal decorators using ParamSpec/Concatenate so decorated WebDriver methods remain typed under stricter mypy settings.
py/pyproject.toml Turns on disallow_untyped_decorators to surface (and now enforce fixing) untyped decorator usage.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread py/selenium/webdriver/remote/webdriver.py
@iampopovich
iampopovich merged commit 34c7442 into SeleniumHQ:trunk Sep 3, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-py Python Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants