-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py] Update docstrings style according to google guideline #16445
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
[py] Update docstrings style according to google guideline #16445
Conversation
…ChromiumOptions classes
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||
|
@cgoldberg one more batch of files |
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||
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.
For the docstrings that don't contain a description and only have the Returns/Args sections, they need to start on the second line and have indentation, or else they get smashed into a single line when we build the docs.
For example, if you change:
"""Returns:
The address of the remote devtools instance.
"""
to this:
"""
Returns:
The address of the remote devtools instance.
"""
... it will render correctly when we build the docs.
I don't know if having a blank first line breaks a ruff rule or style recommendation, but it seems to look good in the docs.
RUFF doesn't have any available options for finding and fixing such line breaks in docstrings. It seems that formatting decisions should be made based on the docstring's semantics. |
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.
Thanks... those look really good. 👍
|
Thanks , see you tomorrow :D |
User description
🔗 Related Issues
relates to #16427
💥 What does this PR do?
https://github.com/google/styleguide/blob/gh-pages/pyguide.md
This pull request focuses on improving the clarity and consistency of docstrings across several Selenium WebDriver Python modules, especially for Chromium, Chrome, Edge, and Firefox classes. The changes modernize docstring formats to follow a more standardized "Args"/"Returns"/"Example" style, making the documentation easier to read and understand for both users and contributors.
Docstring Standardization and Clarification
chromium/webdriver.pyandchrome/webdriver.pyto use consistent "Args" and "Returns" sections, replacing older ":Args:" and ":Returns:" formats. This includes clearer descriptions and examples for parameters and return values. [1] [2]chromium/options.pyfor properties and methods, ensuring each parameter and return value is clearly documented using the "Args" and "Returns" format. [1] [2] [3] [4] [5] [6] [7]Edge-Specific Documentation Improvements
edge/options.pyandedge/service.pyto clarify initialization parameters, property purposes, and method return values, all using the updated documentation style. [1] [2] [3] [4] [5]Other Browser-Specific Updates
FirefoxBinaryclass constructor infirefox/firefox_binary.pyto use the new docstring format for parameter documentation.Minor Enhancements
NotImplementedErrorinchromium/webdriver.py, to clarify their current status.These changes collectively make the codebase's documentation more accessible and maintainable, which will help both new and experienced developers understand and use these APIs more effectively.
🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
PR Type
Documentation
Description
Standardized Python docstrings to Google style guide format
Updated Args/Returns/Example sections across WebDriver modules
Enhanced clarity for Chromium, Chrome, Edge, and Firefox classes
Improved parameter descriptions and usage examples
Diagram Walkthrough
File Walkthrough
webdriver.py
Standardize Chrome WebDriver docstringspy/selenium/webdriver/chrome/webdriver.py
__init__docstring to Google style format:Args:toArgs:with proper indentationoptions.py
Refactor ChromiumOptions docstrings to Google stylepy/selenium/webdriver/chromium/options.py
__init__docstringbinary_location,debugger_address,extensionspropertiesadd_extension,add_encoded_extensionmethod docsenable_webextensionswith detailed noteswebdriver.py
Standardize ChromiumDriver method docstringspy/selenium/webdriver/chromium/webdriver.py
__init__to useArgs:formatlaunch_app,get_network_conditions,set_network_conditionsdocs
set_permissions,execute_cdp_cmdwith Example sectionsdownload_file,get_downloadable_files,delete_downloadable_filesoptions.py
Update Edge Options docstrings to Google stylepy/selenium/webdriver/edge/options.py
__init__docstringuse_webviewproperty with Returns sectionto_capabilitiesanddefault_capabilitiesdocsservice.py
Refactor Edge Service docstringspy/selenium/webdriver/edge/service.py
:param:toArgs:format__init__docstringservice_argsproperty with Returns and setter docsfirefox_binary.py
Standardize Firefox binary docstringspy/selenium/webdriver/firefox/firefox_binary.py
__init__docstring from:Args:toArgs:formatfirefox_pathandlog_filewebdriver.py
Refactor Firefox WebDriver docstrings to Google stylepy/selenium/webdriver/firefox/webdriver.py
__init__to Google style formatset_contextmethodcontext,install_addon,uninstall_addondocs