-
Notifications
You must be signed in to change notification settings - Fork 111
Fix new_window
argument typing in Session
#596
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
base: master
Are you sure you want to change the base?
Fix new_window
argument typing in Session
#596
Conversation
Reviewer's GuideThis PR fixes the Updated Class Diagram for Session.new_window Method SignatureclassDiagram
class Session {
+new_window(window_name: str | None, start_directory: str | None, attach: bool, window_index: str, window_shell: str | None, environment: dict[str, str] | None) Window
}
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Data5tream - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -587,7 +587,7 @@ def new_window( | |||
self, | |||
window_name: str | None = None, | |||
*, | |||
start_directory: None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Consider accepting PathLike inputs for start_directory
Update the annotation to os.PathLike[str] | str | None (or Path | str | None) and convert to str afterward so callers can pass pathlib.Path or other PathLike objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds good. But it would change the public API. I'll need input on that @tony 😃
@@ -677,7 +677,7 @@ def new_window( | |||
|
|||
window_args += ("-P",) | |||
|
|||
if start_directory: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Explicit None check changes behavior for empty strings
An empty string now passes and becomes ./
. To skip empty values, revert to if start_directory:
or explicitly require non-empty paths.
Corrects the
start_directory
type of thenew_window
method on theSession
class.Fixes #595
Summary by Sourcery
Fix the typing and conditional handling of the
start_directory
argument inSession.new_window
to accept string paths and avoid skipping valid values.Bug Fixes:
start_directory
annotation tostr | None
inSession.new_window
if start_directory is not None
so empty strings aren’t misinterpreted as absent paths