Accept a path or file handle in write_scene_list - #566
Closed
jennifferweslowski-design wants to merge 3 commits into
Closed
Accept a path or file handle in write_scene_list#566jennifferweslowski-design wants to merge 3 commits into
jennifferweslowski-design wants to merge 3 commits into
Conversation
Open path arguments with a context manager so the file is closed after writing. Existing file-handle callers are unchanged.
Breakthrough
approved these changes
Aug 15, 2026
Breakthrough
approved these changes
Aug 16, 2026
Breakthrough
left a comment
Owner
There was a problem hiding this comment.
Needs formatting w/ ruff but LGTM otherwise! 👍
Author
|
After further review of the discussion in #523, I realize this PR takes the opposite direction from the maintainer guidance that callers should pass an already-opened file handle (and use a context manager themselves). Even though the change is test-covered and received approval, pushing an API that conflicts with the stated design intent is not the right outcome. I'm closing this PR to avoid further review time and noise. Sorry for the confusion, and thank you for the careful feedback. |
Owner
|
Consider keeping this open, there is some existing precedent for allowing this in other libraries. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #523
write_scene_list("scenes.csv", scenes)currently raisesTypeError: argument 1 must have a "write" methodbecause the path string is passed straight tocsv.writer.This change lets the first argument be a file handle (existing callers) or a
str/pathlib.Path. A path is opened withnewline=""inside a context manager so the file is closed after writing, which matches the concern on the issue.Tests cover a
StringIOhandle, astrpath, and aPath. No video fixtures.I could not run the suite in this environment; the new tests follow the existing
_fake_scenespattern intests/test_output.py.