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

Doc improvements #559

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Doc improvements #559

wants to merge 10 commits into from

Conversation

tony
Copy link
Member

@tony tony commented Feb 1, 2025

Changes

Streamlining docs for consistency, sustainability.

Summary by Sourcery

Documentation:

  • Improve docstrings in the Window class.

Copy link

sourcery-ai bot commented Feb 1, 2025

Reviewer's Guide by Sourcery

This pull request focuses on improving the documentation within the libtmux.window.py file. It includes changes to docstrings, parameter descriptions, and return types to enhance clarity and consistency. Additionally, some deprecated methods were marked as such.

Class diagram for Window class documentation improvements

classDiagram
    class Window {
        +session: Session
        +panes: QueryList[Pane]
        +active_pane: Pane
        +cmd(cmd: str, *args, target: Optional[str|int]) tmux_cmd
        +select_pane(target_pane: str|int) Pane
        +split(target: Optional[str|int], start_directory: Optional[str], attach: bool, direction: Optional[PaneDirection], full_window_split: bool, zoom: bool, shell: Optional[str], size: Optional[str|int], environment: Optional[dict]) Pane
        +resize(adjustment_direction: Optional[ResizeAdjustmentDirection], adjustment: Optional[int], height: Optional[int], width: Optional[int], expand: Optional[bool], shrink: Optional[bool]) Window
        +select_layout(layout: Optional[str]) Window
        +set_window_option(option: str, value: str|int) Window
        +show_window_options(g: Optional[bool]) WindowOptionDict
        +show_window_option(option: str, g: bool) str|int|None
        +rename_window(new_name: str) Window
        +kill(all_except: Optional[bool]) None
        +move_window(destination: str, session: Optional[str]) Window
        +select() Window
        +new_window(...) Window
    }
    note for Window "Documentation improvements:
    - Enhanced method descriptions
    - Clarified parameter types
    - Added return type details
    - Improved examples
    - Marked deprecated methods"
Loading

File-Level Changes

Change Details Files
Improved docstrings for the Window class and its methods.
  • Added a conceptual parameter description for the session parameter in the Window class docstring.
  • Clarified the purpose of the from_window_id method.
  • Improved the description of the session property.
  • Clarified the return type of the panes property.
  • Enhanced the documentation for the cmd method, including parameter descriptions and return type.
  • Improved the documentation for the select_pane method, including parameter descriptions, return type, and exception handling.
  • Enhanced the documentation for the split method, including parameter descriptions and return type.
  • Improved the documentation for the resize method, including parameter descriptions, return type, and exception handling.
  • Clarified the purpose of the last_pane method.
  • Improved the documentation for the select_layout method, including parameter descriptions, return type, and exception handling.
  • Enhanced the documentation for the set_window_option method, including parameter descriptions, return type, and exception handling.
  • Improved the documentation for the show_window_options method, including parameter descriptions and return type.
  • Enhanced the documentation for the show_window_option method, including parameter descriptions, return type, and exception handling.
  • Improved the documentation for the rename_window method, including parameter descriptions and return type.
  • Enhanced the documentation for the kill method, including parameter descriptions and exception handling.
  • Improved the documentation for the move_window method, including parameter descriptions, return type, and exception handling.
  • Improved the documentation for the new_window method, including parameter descriptions and return type.
  • Enhanced the documentation for the select method, including parameter descriptions, return type, and exception handling.
  • Clarified the purpose of the active_pane property.
  • Improved the documentation for the __eq__ method.
  • Improved the documentation for the __repr__ method.
  • Added examples to the documentation for the id, name, index, height, and width properties.
src/libtmux/window.py
Marked deprecated methods and properties.
  • Added deprecation warnings to split_window method.
  • Added deprecation warnings to attached_pane property.
  • Added deprecation warnings to select_window method.
  • Added deprecation warnings to kill_window method.
  • Added deprecation warnings to get method.
  • Added deprecation warnings to __getitem__ method.
  • Added deprecation warnings to get_by_id method.
  • Added deprecation warnings to where method.
  • Added deprecation warnings to find_where method.
  • Added deprecation warnings to _list_panes method.
  • Added deprecation warnings to _panes property.
  • Added deprecation warnings to list_panes method.
  • Added deprecation warnings to children property.
src/libtmux/window.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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @tony - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +470 to 474
if val.isdigit():
window_options[key] = int(val)
else:
window_options[key] = val

Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Replace if statement with if expression (assign-if-exp)

Suggested change
if val.isdigit():
window_options[key] = int(val)
else:
window_options[key] = val
window_options[key] = int(val) if val.isdigit() else val

Copy link

codecov bot commented Feb 1, 2025

Codecov Report

Attention: Patch coverage is 70.00000% with 33 lines in your changes missing coverage. Please review.

Project coverage is 88.76%. Comparing base (a3e5393) to head (3de6757).

Files with missing lines Patch % Lines
src/libtmux/session.py 58.33% 10 Missing and 5 partials ⚠️
src/libtmux/exc.py 20.00% 8 Missing ⚠️
src/libtmux/server.py 80.95% 4 Missing ⚠️
src/libtmux/window.py 84.21% 2 Missing and 1 partial ⚠️
src/libtmux/pane.py 66.66% 0 Missing and 2 partials ⚠️
src/libtmux/common.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #559      +/-   ##
==========================================
+ Coverage   88.67%   88.76%   +0.08%     
==========================================
  Files          36       36              
  Lines        3922     3898      -24     
  Branches      362      358       -4     
==========================================
- Hits         3478     3460      -18     
+ Misses        307      304       -3     
+ Partials      137      134       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tony tony force-pushed the doc-makeover branch 5 times, most recently from f596e54 to 0d2e6c8 Compare February 2, 2025 18:54
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