-
Notifications
You must be signed in to change notification settings - Fork 267
ENH: Allow path-like objects for tractogram load/saving #1421
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
ENH: Allow path-like objects for tractogram load/saving #1421
Conversation
Codecov Report
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.44%. Comparing base (a8a1759
) to head (5970509
).
Additional details and impacted files
@@ Coverage Diff @@ ## master #1421 +/- ## ======================================= Coverage 95.44% 95.44% ======================================= Files 209 209 Lines 29782 29803 +21 Branches 4472 4478 +6 ======================================= + Hits 28424 28445 +21 Misses 925 925 Partials 433 433
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
5254601
to
e263641
Compare
Allow path-like objects for tractogram load/saving. Crucially, this patch set uses the capabilities of `pathlib.Path` to get the suffix of a filename when detecing the format instead of relying on the `splitext` function of the `os.path` module, which requires a `str` instance. Add the corresponding tests. Change the docstrings to mark the types of the filenames as `path-like` objects instead of only `str` objects.
e263641
to
92e8cb2
Compare
@effigies this is ready to be merged.
relying on the splitext function of the os.path module, which requires a str instance.
In [3]: import os.path In [4]: from pathlib import Path In [5]: os.path.splitext('/path/to/streamline.tck') Out[5]: ('/path/to/streamline', '.tck')
os.path
was retrofitted to allow PathLike
s in almost all of its functions. I don't think this change is necessary, but documenting and testing the support for PathLike
s is welcome. Could you try reverting the splitext change and see if the tests still pass?
Closed by mistake. Sorry. Re-opened as #1435.
Allow path-like objects for tractogram load/saving.
Crucially, this patch set uses the capabilities of
pathlib.Path
to get the suffix of a filename when detecing the format instead of relying on thesplitext
function of theos.path
module, which requires astr
instance.Add the corresponding tests.
Change the docstrings to mark the types of the filenames as
path-like
objects instead of onlystr
objects.