summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-06-14 23:47:48 -0700
committerEric Wieser <wieser.eric@gmail.com>2018-06-14 23:47:48 -0700
commit776a1850942a65576b72d2cf30ed677dbcf4108c (patch)
treef6f32bb49a9e3dceb7ccde405f90aaf707e4fd5b /numpy/core
parenta9ac83cffc5096a0157b9c0ac9795bf7f0a9670b (diff)
downloadnumpy-776a1850942a65576b72d2cf30ed677dbcf4108c.tar.gz
MAINT: Replace ifs with assertions, since those conditions are never hit
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/numerictypes.py50
1 files changed, 26 insertions, 24 deletions
diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py
index 7cd80f432..1ac9b02af 100644
--- a/numpy/core/numerictypes.py
+++ b/numpy/core/numerictypes.py
@@ -323,31 +323,33 @@ def _add_aliases():
# insert bit-width version for this class (if relevant)
base, bit, char = bitname(info.type)
- if base != '':
- myname = "%s%d" % (base, bit)
- if (name not in ('longdouble', 'clongdouble') or
- myname not in allTypes):
- base_capitalize = english_capitalize(base)
- if base == 'complex':
- na_name = '%s%d' % (base_capitalize, bit//2)
- elif base == 'bool':
- na_name = base_capitalize
- else:
- na_name = "%s%d" % (base_capitalize, bit)
-
- allTypes[myname] = info.type
-
- # add mapping for both the bit name and the numarray name
- sctypeDict[myname] = info.type
- sctypeDict[na_name] = info.type
- # add forward, reverse, and string mapping to numarray
- sctypeNA[na_name] = info.type
- sctypeNA[info.type] = na_name
- sctypeNA[info.char] = na_name
- if char != '':
- sctypeDict[char] = info.type
- sctypeNA[char] = na_name
+ assert base != ''
+ myname = "%s%d" % (base, bit)
+ if (name not in ('longdouble', 'clongdouble') or
+ myname not in allTypes):
+ base_capitalize = english_capitalize(base)
+ if base == 'complex':
+ na_name = '%s%d' % (base_capitalize, bit//2)
+ elif base == 'bool':
+ na_name = base_capitalize
+ else:
+ na_name = "%s%d" % (base_capitalize, bit)
+
+ allTypes[myname] = info.type
+
+ # add mapping for both the bit name and the numarray name
+ sctypeDict[myname] = info.type
+ sctypeDict[na_name] = info.type
+
+ # add forward, reverse, and string mapping to numarray
+ sctypeNA[na_name] = info.type
+ sctypeNA[info.type] = na_name
+ sctypeNA[info.char] = na_name
+
+ assert char != ''
+ sctypeDict[char] = info.type
+ sctypeNA[char] = na_name
_add_aliases()
def _add_integer_aliases():