[py] correct type annotations of default-None params#15341
[py] correct type annotations of default-None params#15341cgoldberg merged 8 commits intoSeleniumHQ:trunkfrom
Conversation
Used regex for search: : \w+ = None
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
|
Is this still relevant? |
|
Yes of coures it is still relevant. It's type hints. Not sure why it's taken so long to deal with |
It's a community project run by volunteers who put in a lot of effort and get paid nothing. We are pretty diligent with reviewing contributions, but not everything gets immediate attention. |
|
Let me know if I can help expedite things! There's no logic changes or anything, so it shouldn't take much to review |
|
This is causing test failures. I can reproduce when using your branch: Can you take a look? |
|
My bad, tiny mistake in my haste. Fixed! Can you please re-run CI? |
|
CI failed, but it wasn't related to these changes... We have a flaky test. I'm running it again. |
cgoldberg
left a comment
There was a problem hiding this comment.
@DeflateAwning
CI is green and this looks good to go.
Thanks for the contribution!
|
Thanks a lot! Really appreciate it! |
User description
Corrected type hints/annotations, mostly of arguments with default values of
None.Also added a few entirely-missing type hints, mostly for strings.
Motivation and Context
Pyright type checker was throwing errors in many of these cases.
Types of changes
Checklist
None of the other checklist items are required.
Recommend a squash merge.
PR Type
Bug fix, Enhancement
Description
Corrected type annotations for parameters with default
Nonevalues.Added missing type hints, primarily for strings and lists.
Improved type safety by using
Optionaland explicit type declarations.Enhanced code clarity and compatibility with type checkers like Pyright.
Changes walkthrough 📝
18 files
Updated type hints for `log_output` parameter.Added `Optional` type hints for `options` and `service`.Corrected type hints for
executable_path,log_output, anddriver_path_env_key.Added `Optional` type hints for multiple parameters.Updated type hint for `source` parameter.Corrected type hints for multiple parameters including `log_output`.Updated type hints for
executable_path,log_output, anddriver_path_env_key.Added `Optional` type hints for `options` and `service`.Corrected type hints for
executable_path,log_output, anddriver_path_env_key.Added `Optional` type hints for `options` and `service`.Updated type hints for
executable_path,log_output, anddriver_path_env_key.Added `Optional` type hints for `options` and `service`.Added `Optional` type hint for `_client_config`.Corrected type hints for `executable_path` and `driver_path_env_key`.Added `Optional` type hints for `options` and `service`.Updated type hint for `execute_script` method.Added `Optional` type hint for `service` parameter.Added `Optional` type hint for `service` parameter.2 files
Added type hints for `arguments` and `add_argument` methods.Enhanced type hints for `execute` and `execute_script` methods.