summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
authorDmytro <dmytropolitov@gmail.com>2017-06-27 19:43:12 -0400
committerStefan van der Walt <stefanv@berkeley.edu>2019-10-15 09:45:09 -0700
commit38a2456ffa0089c32553ac38c05373d82ab66f07 (patch)
tree57b85ecdb83e1b5ee443e95f348c382d01d9bdfb /numpy/lib/npyio.py
parent2c0b42b9193ce4e201cc4fa77ff188600b06e15f (diff)
downloadnumpy-38a2456ffa0089c32553ac38c05373d82ab66f07.tar.gz
DOC: edited numpy.savez docstring note to be more specific
Note states that dictionary keys are stored as file names and may undergo unintended changes when they are not recognized as valid file names. In such cases the keys must be properly encapsulated and escaped to avoid being changed.
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index 0d09fe66f..92cb3c964 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -611,10 +611,19 @@ def savez(file, *args, **kwds):
its list of arrays (with the ``.files`` attribute), and for the arrays
themselves.
- When saving dictionaries, avoid using keys that begin with "/", as the
- first slash will be removed by the python archive function. If they
- must be used, prepend another character ahead of the slash to ensure
- that the "/" will not be removed.
+ When saving dictionaries, the dictionary keys themselves are stored
+ as zip files under the zip directory. Therefore to avoid unintended
+ changes to the keys, one should avoid using key strings that are not
+ valid file names.
+
+ Examples include strings that begin with "/", or contain ".." or
+ "./", such as '/test/tmp.txt', './test/tmp.txt', or
+ 'test/../tmp.txt'
+
+ Should keys that include such patterns be required, they must be
+ properly encapsulated and or escaped using either double quotes or
+ backslashes where necessary. Note that backslashes will be
+ doubled in the returned keys.
Examples
--------