Skip to content

Added docstring - #427

Merged
xtsea merged 2 commits into
betafrom
dev
Sep 13, 2025
Merged

Added docstring#427
xtsea merged 2 commits into
betafrom
dev

Conversation

@xtsea

@xtsea xtsea commented Sep 13, 2025

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Document and streamline response handling and content generation classes by adding descriptive docstrings, refining HTTP request and error handling, and improving logging and code formatting.

Enhancements:

  • Add docstrings to ResponseResult and GeneratedImageOrVideo classes and their methods
  • Move requests import to module level and simplify content extraction in to_buffer_request
  • Enhance error messages in to_buffer_request and enforce logger presence before logging in to_save
  • Wrap long method chains in parentheses and standardize code formatting

@sourcery-ai

sourcery-ai Bot commented Sep 13, 2025

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This PR enriches the export classes with comprehensive docstrings, refines error messages and logging behavior, reorganizes imports, and tidies up method formatting for improved readability.

Class diagram for updated ResponseResult and GeneratedImageOrVideo classes

classDiagram
    class ResponseResult {
        - _client
        - _is_ultimate
        - _response
        + __init__(client, response, is_ultimate)
        + to_result()
        + to_obj()
        + to_json_dumps(indent)
        + to_dict()
    }

    class GeneratedImageOrVideo {
        - _client
        - _content
        - _file_path
        - _logger
        + __init__(client, content, file_path, logger)
        + create_task_and_wait(max_retries, poll_interval)
        + run()
        + to_save()
        + to_buffer_request(response_content, default_ryzenth_openai, return_image_base64, disabled_http_with_buffer)
        + to_buffer_and_list()
        + to_obj()
        + to_json_dumps(indent)
        + to_dict()
        + to_base64()
        + to_fileobj()
        + __repr__()
    }
Loading

File-Level Changes

Change Details Files
Add comprehensive docstrings to classes and methods
  • Insert class-level docstrings for ResponseResult and GeneratedImageOrVideo
  • Add method-level docstrings across all to_* and run/create_task methods
Ryzenth/_export_class.py
Enhance error messaging for clarity
  • Improve failure message when polling exceeds retries
  • Refine HTTP error text in to_buffer_request
  • Standardize exception messages on save and request failures
Ryzenth/_export_class.py
Introduce conditional logger invocation
  • Guard logger.info call with a check for logger existence
Ryzenth/_export_class.py
Refactor code formatting and variable assignments
  • Break long method chains into multi-line statements
  • Rename and adjust inline variable for to_buffer_request content
Ryzenth/_export_class.py
Relocate requests import to module scope
  • Move import requests out of method and to top of module
Ryzenth/_export_class.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@xtsea
xtsea merged commit 57a5e55 into beta Sep 13, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant