Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Pane.capture_pane helpers#568

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
tony wants to merge6 commits intomaster
base:master
Choose a base branch
Loading
frompane-capture-snapshots
Draft

Conversation

@tony
Copy link
Member

@tonytony commentedFeb 15, 2025
edited
Loading

Changes

feat: Addtest_snapshot

Test plan

Coverage

uv run pytest --cov=libtmux.snapshot tests/test_snapshot.py -v

Automatic

Summary by Sourcery

Introduce snapshot and recording functionality for tmux panes. This allows capturing and analyzing pane content and metadata at various points in time. Add tests to verify the correctness of the new features.

New Features:

  • IntroducePane.snapshot() to create a snapshot of the pane's current state.
  • IntroducePane.record() to create a recording of pane snapshots.
  • AddPaneSnapshot class to store pane content and metadata.
  • AddPaneRecording class to manage a time-series of pane snapshots.
  • Addtest_snapshot to test the snapshot functionality and ensure correctness of capturing pane content and metadata.
  • Addtest_pane_recording to test the recording functionality, including adding snapshots, iterating through them, and filtering by time.

Tests:

  • Add tests for snapshot and recording functionality.

@sourcery-ai
Copy link

sourcery-aibot commentedFeb 15, 2025
edited
Loading

Reviewer's Guide by Sourcery

This pull request introduces snapshot and recording functionality for tmux panes. It addsPaneSnapshot andPaneRecording classes, along with corresponding methods in thePane class, to facilitate capturing and managing pane states for testing and debugging.

Sequence diagram for creating a PaneSnapshot

sequenceDiagram    participant User    participant Pane    participant PaneSnapshot    User->>Pane: snapshot(start, end)    Pane->>PaneSnapshot: from_pane(self, start, end)    activate PaneSnapshot    PaneSnapshot-->>Pane: PaneSnapshot instance    deactivate PaneSnapshot    Pane-->>User: PaneSnapshot instance
Loading

Sequence diagram for creating a PaneRecording and adding a snapshot

sequenceDiagram    participant User    participant Pane    participant PaneRecording    participant PaneSnapshot    User->>Pane: record()    Pane->>PaneRecording: PaneRecording()    activate PaneRecording    PaneRecording-->>Pane: PaneRecording instance    deactivate PaneRecording    User->>PaneRecording: add_snapshot(pane, start, end)    PaneRecording->>Pane: snapshot(start, end)    Pane->>PaneSnapshot: from_pane(self, start, end)    activate PaneSnapshot    PaneSnapshot-->>Pane: PaneSnapshot instance    deactivate PaneSnapshot    Pane->>PaneRecording: append(PaneSnapshot)    PaneRecording-->>User: void
Loading

Updated class diagram for Pane, PaneSnapshot, and PaneRecording

classDiagram    class Pane {        +capture_pane()        +snapshot()        +record()    }    class PaneSnapshot {        +content: list[str]        +timestamp: datetime        +pane_id: str        +window_id: str        +session_id: str        +server_name: str        +metadata: dict[str, str]        +from_pane()        +content_str    }    class PaneRecording {        +snapshots: list[PaneSnapshot]        +add_snapshot()        +latest        +get_snapshots_between()    }    Pane -- PaneSnapshot : creates    Pane -- PaneRecording : creates    PaneRecording -- PaneSnapshot : contains
Loading

File-Level Changes

ChangeDetailsFiles
IntroducesPaneSnapshot andPaneRecording classes for capturing and recording pane states.
  • AddsPaneSnapshot dataclass to represent a frozen snapshot of a pane's state, including content, timestamp, and metadata.
  • AddsPaneRecording dataclass to maintain a time-series ofPaneSnapshot objects.
  • Implements methods for creating snapshots from a pane and adding them to a recording.
  • Implements methods for iterating, indexing, and filtering snapshots within a recording.
src/libtmux/snapshot.py
tests/test_snapshot.py
Addssnapshot andrecord methods to thePane class.
  • Addssnapshot method to create aPaneSnapshot from the current pane state.
  • Addsrecord method to create a newPaneRecording instance for the pane.
src/libtmux/pane.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 yourdashboard 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

@codecov
Copy link

codecovbot commentedFeb 15, 2025
edited
Loading

Codecov Report

Attention: Patch coverage is99.03846% with2 lines in your changes missing coverage. Please review.

Project coverage is 89.27%. Comparing base(92660e4) to head(734d41a).

Files with missing linesPatch %Lines
src/libtmux/snapshot.py97.01%1 Missing and 1 partial⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@##           context-managers     #568      +/-   ##====================================================+ Coverage             88.84%   89.27%   +0.42%====================================================  Files                    36       38       +2       Lines                  4080     4288     +208       Branches                376      378       +2     ====================================================+ Hits                   3625     3828     +203- Misses                  310      313       +3- Partials                145      147       +2

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

Base automatically changed fromcontext-managers tomasterFebruary 15, 2025 17:20
@tonytonyforce-pushed thepane-capture-snapshots branch 3 times, most recently fromc58334b tofc1d7f4CompareFebruary 16, 2025 22:24
@tonytonyforce-pushed thepane-capture-snapshots branch fromfc1d7f4 toc61ba63CompareFebruary 16, 2025 22:33
@tonytonyforce-pushed thepane-capture-snapshots branch 2 times, most recently fromc305c76 to6d91728CompareFebruary 23, 2025 20:36
@tonytonyforce-pushed thepane-capture-snapshots branch from6d91728 to3cc1d33CompareFebruary 24, 2025 00:34
@tonytonyforce-pushed thepane-capture-snapshots branch from3cc1d33 to42e0ac8CompareFebruary 25, 2025 22:17
@tonytonyforce-pushed themaster branch 4 times, most recently from0188aed toea5b0c4CompareApril 12, 2025 12:08
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@tony

[8]ページ先頭

©2009-2025 Movatter.jp