Skip to content

Commit 4bbc20a

Browse files
committed
DOC: Added pathlib.Path where applicable
1 parent 2e9479e commit 4bbc20a

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

numpy/lib/_datasource.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def open(path, mode='r', destpath=os.curdir, encoding=None, newline=None):
161161
162162
Parameters
163163
----------
164-
path : str
164+
path : str or pathlib.Path
165165
Local file path or URL to open.
166166
mode : str, optional
167167
Mode to open `path`. Mode 'r' for reading, 'w' for writing, 'a' to
@@ -382,7 +382,7 @@ def abspath(self, path):
382382
383383
Parameters
384384
----------
385-
path : str
385+
path : str or pathlib.Path
386386
Can be a local file or a remote URL.
387387
388388
Returns
@@ -442,7 +442,7 @@ def exists(self, path):
442442
443443
Parameters
444444
----------
445-
path : str
445+
path : str or pathlib.Path
446446
Can be a local file or a remote URL.
447447
448448
Returns
@@ -493,7 +493,7 @@ def open(self, path, mode='r', encoding=None, newline=None):
493493
494494
Parameters
495495
----------
496-
path : str
496+
path : str or pathlib.Path
497497
Local file path or URL to open.
498498
mode : {'r', 'w', 'a'}, optional
499499
Mode to open `path`. Mode 'r' for reading, 'w' for writing,
@@ -604,7 +604,7 @@ def abspath(self, path):
604604
605605
Parameters
606606
----------
607-
path : str
607+
path : str or pathlib.Path
608608
Can be a local file or a remote URL. This may, but does not
609609
have to, include the `baseurl` with which the `Repository` was
610610
initialized.
@@ -631,7 +631,7 @@ def exists(self, path):
631631
632632
Parameters
633633
----------
634-
path : str
634+
path : str or pathlib.Path
635635
Can be a local file or a remote URL. This may, but does not
636636
have to, include the `baseurl` with which the `Repository` was
637637
initialized.
@@ -660,7 +660,7 @@ def open(self, path, mode='r', encoding=None, newline=None):
660660
661661
Parameters
662662
----------
663-
path : str
663+
path : str or pathlib.Path
664664
Local file path or URL to open. This may, but does not have to,
665665
include the `baseurl` with which the `Repository` was
666666
initialized.
@@ -689,7 +689,7 @@ def listdir(self):
689689
690690
Returns
691691
-------
692-
files : list of str
692+
files : list of str or pathlib.Path
693693
List of file names (not containing a directory part).
694694
695695
Notes

numpy/lib/npyio.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class NpzFile(Mapping):
148148
149149
Parameters
150150
----------
151-
fid : file or str
151+
fid : file, str, or pathlib.Path
152152
The zipped archive to open. This is either a file-like object
153153
or a string containing the path to the archive.
154154
own_fid : bool, optional
@@ -564,7 +564,7 @@ def savez(file, *args, **kwds):
564564
565565
Parameters
566566
----------
567-
file : str or file
567+
file : file, str, or pathlib.Path
568568
Either the filename (string) or an open file (file-like object)
569569
where the data will be saved. If file is a string or a Path, the
570570
``.npz`` extension will be appended to the filename if it is not
@@ -657,7 +657,7 @@ def savez_compressed(file, *args, **kwds):
657657
658658
Parameters
659659
----------
660-
file : str or file
660+
file : file, str, or pathlib.Path
661661
Either the filename (string) or an open file (file-like object)
662662
where the data will be saved. If file is a string or a Path, the
663663
``.npz`` extension will be appended to the filename if it is not
@@ -824,7 +824,7 @@ def _read(fname, *, delimiter=',', comment='#', quote='"',
824824
825825
Parameters
826826
----------
827-
fname : str or file object
827+
fname : file, str, or pathlib.Path
828828
The filename or the file to be read.
829829
delimiter : str, optional
830830
Field delimiter of the fields in line of the file.
@@ -1395,7 +1395,7 @@ def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='',
13951395
13961396
Parameters
13971397
----------
1398-
fname : filename or file handle
1398+
fname : filename, file handle or pathlib.Path
13991399
If the filename ends in ``.gz``, the file is automatically saved in
14001400
compressed gzip format. `loadtxt` understands gzipped files
14011401
transparently.
@@ -1646,7 +1646,7 @@ def fromregex(file, regexp, dtype, encoding=None):
16461646
16471647
Parameters
16481648
----------
1649-
file : path or file
1649+
file : file, str, or pathlib.Path
16501650
Filename or file object to read.
16511651
16521652
.. versionchanged:: 1.22.0

0 commit comments

Comments
 (0)