Skip to content

Commit

Permalink
Merge pull request numpy#3753 from jarondl/fix-doc-savetxt
Browse files Browse the repository at this point in the history
DOC: Fixes in the npyio documentation
  • Loading branch information
charris committed Sep 21, 2013
2 parents fde3dee + 9b7beb6 commit 9073214
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions numpy/lib/npyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,19 @@ class NpzFile(object):
archive provided on construction.
`NpzFile` is used to load files in the NumPy ``.npz`` data archive
format. It assumes that files in the archive have a ".npy" extension,
format. It assumes that files in the archive have a ``.npy`` extension,
other files are ignored.
The arrays and file strings are lazily loaded on either
getitem access using ``obj['key']`` or attribute lookup using
``obj.f.key``. A list of all files (without ".npy" extensions) can
``obj.f.key``. A list of all files (without ``.npy`` extensions) can
be obtained with ``obj.files`` and the ZipFile object itself using
``obj.zip``.
Attributes
----------
files : list of str
List of all files in the archive with a ".npy" extension.
List of all files in the archive with a ``.npy`` extension.
zip : ZipFile instance
The ZipFile object initialized with the zipped archive.
f : BagObj instance
Expand Down Expand Up @@ -270,7 +270,7 @@ def iteritems(self):
yield (f, self[f])

def keys(self):
"""Return files in the archive with a ".npy" extension."""
"""Return files in the archive with a ``.npy`` extension."""
return self.files

def iterkeys(self):
Expand All @@ -283,7 +283,7 @@ def __contains__(self, key):

def load(file, mmap_mode=None):
"""
Load an array(s) or pickled objects from .npy, .npz, or pickled files.
Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files.
Parameters
----------
Expand All @@ -301,7 +301,7 @@ def load(file, mmap_mode=None):
Returns
-------
result : array, tuple, dict, etc.
Data stored in the file. For '.npz' files, the returned instance of
Data stored in the file. For ``.npz`` files, the returned instance of
NpzFile class must be closed to avoid leaking file descriptors.
Raises
Expand Down Expand Up @@ -457,9 +457,9 @@ def savez(file, *args, **kwds):
Save several arrays into a single file in uncompressed ``.npz`` format.
If arguments are passed in with no keywords, the corresponding variable
names, in the .npz file, are 'arr_0', 'arr_1', etc. If keyword arguments
are given, the corresponding variable names, in the ``.npz`` file will
match the keyword names.
names, in the ``.npz`` file, are 'arr_0', 'arr_1', etc. If keyword
arguments are given, the corresponding variable names, in the ``.npz``
file will match the keyword names.
Parameters
----------
Expand All @@ -484,7 +484,7 @@ def savez(file, *args, **kwds):
--------
save : Save a single array to a binary file in NumPy format.
savetxt : Save an array to a file as plain text.
savez_compressed : Save several arrays into a compressed .npz file format
savez_compressed : Save several arrays into a compressed ``.npz`` archive
Notes
-----
Expand Down Expand Up @@ -540,15 +540,15 @@ def savez_compressed(file, *args, **kwds):
Parameters
----------
file : str
File name of .npz file.
File name of ``.npz`` file.
args : Arguments
Function arguments.
kwds : Keyword arguments
Keywords.
See Also
--------
numpy.savez : Save several arrays into an uncompressed .npz file format
numpy.savez : Save several arrays into an uncompressed ``.npz`` file format
"""
_savez(file, args, kwds, True)
Expand Down Expand Up @@ -923,7 +923,8 @@ def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='',
See Also
--------
save : Save an array to a binary file in NumPy ``.npy`` format
savez : Save several arrays into a ``.npz`` compressed archive
savez : Save several arrays into an uncompressed ``.npz`` archive
savez_compressed : Save several arrays into a compressed ``.npz`` archive
Notes
-----
Expand Down

0 comments on commit 9073214

Please sign in to comment.