Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[py] Added Docstrings to ActionBuilder #15065

Merged
merged 9 commits into from
Jan 14, 2025
Merged

Conversation

shbenzer
Copy link
Contributor

@shbenzer shbenzer commented Jan 12, 2025

User description

Description

Added more detailed docstrings to ActionBuilder class

Motivation and Context

PEP compliance, increased documentation

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Documentation


Description

  • Added detailed docstrings to ActionBuilder methods for clarity.

  • Included parameter, return type, and example usage in docstrings.

  • Enhanced compliance with PEP standards for documentation.

  • Improved maintainability and readability of the ActionBuilder class.


Changes walkthrough 📝

Relevant files
Documentation
action_builder.py
Enhanced docstrings for `ActionBuilder` methods                   

py/selenium/webdriver/common/actions/action_builder.py

  • Added docstrings to multiple methods in ActionBuilder.
  • Documented parameters, return types, and examples for methods.
  • Improved clarity and compliance with PEP documentation standards.
  • +90/-1   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Example Error

    The example code in the perform() docstring contains invalid syntax for find_element() call and accessing perform as a property instead of a method

    >>> el = driver.find_element(id: "some_id")
    >>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys('keys').perform

    Copy link
    Contributor

    qodo-merge-pro bot commented Jan 12, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    ✅ Fix incorrect syntax in example code that would cause execution errors
    Suggestion Impact:The commit implemented part of the suggestion by fixing the find_element() parameter syntax from 'id:' to 'By.ID'

    code diff:

    -        >>> el = driver.find_element(id: "some_id")
    +        >>> el = driver.find_element(By.ID, "some_id")

    Fix the syntax error in the example code of the perform() docstring. The method call
    is missing parentheses and has incorrect parameter syntax.

    py/selenium/webdriver/common/actions/action_builder.py [159-162]

     >>> action_builder = ActionBuilder(driver)
     >>> keyboard = action_builder.key_input
    ->>> el = driver.find_element(id: "some_id")
    ->>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys('keys').perform
    +>>> el = driver.find_element(By.ID, "some_id")
    +>>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys('keys').perform()
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The suggestion fixes multiple critical syntax errors in the example code that would prevent it from running: incorrect parameter syntax for find_element(), missing parentheses in perform(), and using incorrect method chaining. These fixes are essential for the documentation to be useful.

    8

    Copy link
    Contributor

    @yvsvarma yvsvarma left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Looks good. Brings valuable improvements to the ActionBuilder class.

    @VietND96 VietND96 merged commit f6d95bb into SeleniumHQ:trunk Jan 14, 2025
    17 checks passed
    @shbenzer shbenzer deleted the docstrings branch January 16, 2025 00:38
    # for free to join this conversation on GitHub. Already have an account? # to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    4 participants