-
Notifications
You must be signed in to change notification settings - Fork 111
Commit 9e20bc6
committed
snapshot(refactor[Snapshot]): Fix dataclass field order and enhance server handling
why:
- Required fields in dataclasses must come before fields with default values
- The server field is essential for all snapshot classes and needed more robust retrieval
- Type checking was failing due to field ordering issues
- Doctests needed simplification to avoid complex tmux object creation
what:
- Reordered fields to place server (required) before _is_snapshot (default=True)
- Enhanced from_* methods with comprehensive fallback mechanisms for server retrieval:
- Check for _server and server attributes directly
- Look up parent objects (pane → window → session) to find server
- Use server from related snapshot objects when available
- Create mock Server instances in test environments
- Added clear error messages when server cannot be found
- Renamed SessionSnapshot.server property to get_server to avoid naming conflicts
- Added _is_snapshot class variable for easier validation in doctests
- Improved code formatting with multi-line conditionals for better readability
refs: Fixes mypy type checking errors for snapshot classes1 parent 828d1ca commit 9e20bc6Copy full SHA for 9e20bc6
File tree
Expand file treeCollapse file tree
1 file changed
+424
-242
lines changedFilter options
- src/libtmux
Expand file treeCollapse file tree
1 file changed
+424
-242
lines changed
0 commit comments