Skip to content

Commit e0fff5c

Browse files
committed
update docstrings to accept str or os.PathLike
1 parent 6c0497e commit e0fff5c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

nibabel/filebasedimages.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def set_filename(self, filename):
246246
247247
Parameters
248248
----------
249-
filename : str
249+
filename : str or os.PathLike
250250
If the image format only has one file associated with it,
251251
this will be the only filename set into the image
252252
``.file_map`` attribute. Otherwise, the image instance will
@@ -279,7 +279,7 @@ def filespec_to_file_map(klass, filespec):
279279
280280
Parameters
281281
----------
282-
filespec : str
282+
filespec : str or os.PathLike
283283
Filename that might be for this image file type.
284284
285285
Returns
@@ -321,7 +321,7 @@ def to_filename(self, filename):
321321
322322
Parameters
323323
----------
324-
filename : str
324+
filename : str or os.PathLike
325325
filename to which to save image. We will parse `filename`
326326
with ``filespec_to_file_map`` to work out names for image,
327327
header etc.
@@ -419,7 +419,7 @@ def _sniff_meta_for(klass, filename, sniff_nbytes, sniff=None):
419419
420420
Parameters
421421
----------
422-
filename : str
422+
filename : str or os.PathLike
423423
Filename for an image, or an image header (metadata) file.
424424
If `filename` points to an image data file, and the image type has
425425
a separate "header" file, we work out the name of the header file,
@@ -466,7 +466,7 @@ def path_maybe_image(klass, filename, sniff=None, sniff_max=1024):
466466
467467
Parameters
468468
----------
469-
filename : str
469+
filename : str or os.PathLike
470470
Filename for an image, or an image header (metadata) file.
471471
If `filename` points to an image data file, and the image type has
472472
a separate "header" file, we work out the name of the header file,

nibabel/filename_parser.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def _stringify_path(filepath_or_buffer):
2121
2222
Parameters
2323
----------
24-
filepath_or_buffer : object to be converted
24+
filepath_or_buffer : str or os.PathLike
2525
Returns
2626
-------
2727
str_filepath_or_buffer : maybe a string version of the object
@@ -56,7 +56,7 @@ def types_filenames(template_fname, types_exts,
5656
5757
Parameters
5858
----------
59-
template_fname : str
59+
template_fname : str or os.PathLike
6060
template filename from which to construct output dict of
6161
filenames, with given `types_exts` type to extension mapping. If
6262
``self.enforce_extensions`` is True, then filename must have one
@@ -177,7 +177,7 @@ def parse_filename(filename,
177177
178178
Parameters
179179
----------
180-
filename : str
180+
filename : str or os.PathLike
181181
filename in which to search for type extensions
182182
types_exts : sequence of sequences
183183
sequence of (name, extension) str sequences defining type to
@@ -260,7 +260,7 @@ def splitext_addext(filename,
260260
261261
Parameters
262262
----------
263-
filename : str
263+
filename : str or os.PathLike
264264
filename that may end in any or none of `addexts`
265265
match_case : bool, optional
266266
If True, match case of `addexts` and `filename`, otherwise do

0 commit comments

Comments
 (0)