feat: allow file paths to be passed in as pathlike objects#198
Open
kimboleh wants to merge 3 commits into
Open
feat: allow file paths to be passed in as pathlike objects#198kimboleh wants to merge 3 commits into
kimboleh wants to merge 3 commits into
Conversation
kimboleh
force-pushed
the
feature/accept-pathlike-objects
branch
from
June 25, 2026 01:55
f1754b2 to
c2cf697
Compare
kimboleh
commented
Jun 25, 2026
kimboleh
force-pushed
the
feature/accept-pathlike-objects
branch
from
June 25, 2026 02:23
c2cf697 to
4f75e84
Compare
nfelt14
requested changes
Jun 25, 2026
| file_format: A specialized file format we are writing as. | ||
| """ | ||
| _, path_extension = os.path.splitext(path) | ||
| _, path_extension = os.path.splitext(file_path) |
Collaborator
There was a problem hiding this comment.
There might be a better way to do this if you convert it to a Path object
Author
There was a problem hiding this comment.
I just pushed an update for this if you want to check it - definitely a cleaner way to handle things.
nfelt14
previously approved these changes
Jun 25, 2026
Breaking API Changes |
Test Results (macos)
tests/test_tm_data_types.py('/Users/runner/work/tm_data_types/tm_data_types/tests/test_tm_data_types.py', 602, 'Skipped: Skipping 1G test in GitHub Actions environment') |
Test Results (ubuntu)
tests/test_tm_data_types.py('/home/runner/work/tm_data_types/tm_data_types/tests/test_tm_data_types.py', 602, 'Skipped: Skipping 1G test in GitHub Actions environment') |
Test Results (windows)
tests\test_tm_data_types.py('D:\\a\\tm_data_types\\tm_data_types\\tests\\test_tm_data_types.py', 602, 'Skipped: Skipping 1G test in GitHub Actions environment') |
kimboleh
force-pushed
the
feature/accept-pathlike-objects
branch
from
June 25, 2026 23:30
4924791 to
d46864d
Compare
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.
Proposed changes
Allows for functions/methods/classes to accept
pathlib.Pathobjects in addition to just strings.Addresses #33
Most of these changes involve simply adding a Union type to allow for either a
stror aPathobject type to be passed in as a file path. There are a couple of places whereisinstancelogic has been implemented to handle a possible non-string in the form of a Path object.Most of the functionality is tested simply by passing Path objects to the
read_fileandwrite_filemethods, as most other functions simply pass their file paths on to those functions, but I've added testing for Path objects throughout the tests just to be thorough. A secondary look to make sure I have thorough coverage would be welcome.Types of changes
Checklist
Addresses #<issue_number>safetypre-commit hook fails locally for me withcannot import name 'build_client_session' from 'safety.auth'- this reproduces on main and appears to be a pre-existing dependency issue, or possibly something on my machine. I bypassed it with--no-verifyto commit, but please let me know if there's something I need to fix there.