summaryrefslogtreecommitdiff
path: root/numpy/lib/_iotools.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-01-23 16:10:37 -0700
committerCharles Harris <charlesr.harris@gmail.com>2015-01-23 16:21:15 -0700
commit6bb48b0639322a0f5908996f33c98db62304b839 (patch)
tree52293d48bfda4401e47219844a401f7f1935f436 /numpy/lib/_iotools.py
parent4b1aab31cc66d4a5abd3d2d6b40e461cadd79d2a (diff)
downloadnumpy-6bb48b0639322a0f5908996f33c98db62304b839.tar.gz
MAINT: Make argument determination in NameValidator more precise.
The function was useing `'u' in case_sensitive` to detect `upper`. Make that more precise with `case_sensitive.startswith('u'). Raise ValueError if case_sensitive has unrecognized value.
Diffstat (limited to 'numpy/lib/_iotools.py')
-rw-r--r--numpy/lib/_iotools.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py
index f2adcda10..316704b42 100644
--- a/numpy/lib/_iotools.py
+++ b/numpy/lib/_iotools.py
@@ -320,12 +320,13 @@ class NameValidator(object):
# Process the case option .....
if (case_sensitive is None) or (case_sensitive is True):
self.case_converter = lambda x: x
- elif (case_sensitive is False) or ('u' in case_sensitive):
+ elif (case_sensitive is False) or case_sensitive.startswith('u'):
self.case_converter = lambda x: x.upper()
- elif 'l' in case_sensitive:
+ elif case_sensitive.startswith('l'):
self.case_converter = lambda x: x.lower()
else:
- self.case_converter = lambda x: x
+ msg = 'unrecognized case_sensitive value %s.' % case_sensitive
+ raise ValueError(msg)
#
self.replace_space = replace_space