Skip to content
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] Added Docstrings to ActionBuilder #15065

Open
wants to merge 7 commits into
base: trunk
Choose a base branch
from

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

    @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.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants