diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2011-04-05 17:10:31 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2011-04-05 17:38:00 -0600 |
commit | fd2630366581049af6c9acc4b41315363b47b55a (patch) | |
tree | 8e17cdee3bfb7c9f1c30d793d1ce0267f1016e22 /numpy/core | |
parent | b2793ea74ea05bc64288287dd2efbe0dcae99534 (diff) | |
download | numpy-fd2630366581049af6c9acc4b41315363b47b55a.tar.gz |
STY: Fix up some remaining old-style exceptions.
I think that is the end of it.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/_mx_datetime_parser.py | 14 | ||||
-rw-r--r-- | numpy/core/getlimits.py | 2 | ||||
-rw-r--r-- | numpy/core/machar.py | 16 | ||||
-rw-r--r-- | numpy/core/numeric.py | 4 |
4 files changed, 18 insertions, 18 deletions
diff --git a/numpy/core/_mx_datetime_parser.py b/numpy/core/_mx_datetime_parser.py index dd950c01f..d8db18793 100644 --- a/numpy/core/_mx_datetime_parser.py +++ b/numpy/core/_mx_datetime_parser.py @@ -1,5 +1,5 @@ #-*- coding: latin-1 -*- -""" +""" Date/Time string parsing module. This code is a slightly modified version of Parser.py found in mx.DateTime @@ -540,8 +540,8 @@ def _parse_date(text): try: month = litmonthtable[litmonth] except KeyError: - raise ValueError,\ - 'wrong month name: "%s"' % litmonth + raise ValueError( + 'wrong month name: "%s"' % litmonth) elif month: month = int(month) else: @@ -726,8 +726,8 @@ def datetime_from_string(text): return dt.datetime(year,month,day,hour,minute,second, microsecond) - \ dt.timedelta(minutes=offset) except ValueError, why: - raise RangeError,\ - 'Failed to parse "%s": %s' % (origtext, why) + raise RangeError( + 'Failed to parse "%s": %s' % (origtext, why)) def date_from_string(text): @@ -745,8 +745,8 @@ def date_from_string(text): try: return dt.datetime(year,month,day) except ValueError, why: - raise RangeError,\ - 'Failed to parse "%s": %s' % (text, why) + raise RangeError( + 'Failed to parse "%s": %s' % (text, why)) def validateDateTimeString(text): diff --git a/numpy/core/getlimits.py b/numpy/core/getlimits.py index 518067a3c..0cb1fd7f4 100644 --- a/numpy/core/getlimits.py +++ b/numpy/core/getlimits.py @@ -140,7 +140,7 @@ class finfo(object): fmt = '%12.5e' precname = 'half' else: - raise ValueError, repr(dtype) + raise ValueError(repr(dtype)) machar = MachAr(lambda v:array([v], dtype), lambda v:_frz(v.astype(itype))[0], diff --git a/numpy/core/machar.py b/numpy/core/machar.py index 08ea2ae61..ea9174017 100644 --- a/numpy/core/machar.py +++ b/numpy/core/machar.py @@ -128,7 +128,7 @@ class MachAr(object): if any(temp1 - one != zero): break else: - raise RuntimeError, msg % (_, one.dtype) + raise RuntimeError(msg % (_, one.dtype)) b = one for _ in xrange(max_iterN): b = b + b @@ -137,7 +137,7 @@ class MachAr(object): if any(itemp != 0): break else: - raise RuntimeError, msg % (_, one.dtype) + raise RuntimeError(msg % (_, one.dtype)) ibeta = itemp beta = float_conv(ibeta) @@ -152,7 +152,7 @@ class MachAr(object): if any(temp1 - one != zero): break else: - raise RuntimeError, msg % (_, one.dtype) + raise RuntimeError(msg % (_, one.dtype)) betah = beta / two a = one @@ -163,7 +163,7 @@ class MachAr(object): if any(temp1 - one != zero): break else: - raise RuntimeError, msg % (_, one.dtype) + raise RuntimeError(msg % (_, one.dtype)) temp = a + betah irnd = 0 if any(temp-a != zero): @@ -191,7 +191,7 @@ class MachAr(object): raise RuntimeError("could not determine machine tolerance " "for 'negep', locals() -> %s" % (locals())) else: - raise RuntimeError, msg % (_, one.dtype) + raise RuntimeError(msg % (_, one.dtype)) negep = -negep epsneg = a @@ -206,7 +206,7 @@ class MachAr(object): a = a * beta machep = machep + 1 else: - raise RuntimeError, msg % (_, one.dtype) + raise RuntimeError(msg % (_, one.dtype)) eps = a # Determine ngrd @@ -234,7 +234,7 @@ class MachAr(object): i = i + 1 k = k + k else: - raise RuntimeError, msg % (_, one.dtype) + raise RuntimeError(msg % (_, one.dtype)) if ibeta != 10: iexp = i + 1 mx = k + k @@ -262,7 +262,7 @@ class MachAr(object): else: break else: - raise RuntimeError, msg % (_, one.dtype) + raise RuntimeError(msg % (_, one.dtype)) minexp = -k # Determine maxexp, xmax diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 28c3cffd7..55ab74168 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1109,9 +1109,9 @@ def rollaxis(a, axis, start=0): start += n msg = 'rollaxis: %s (%d) must be >=0 and < %d' if not (0 <= axis < n): - raise ValueError, msg % ('axis', axis, n) + raise ValueError(msg % ('axis', axis, n)) if not (0 <= start < n+1): - raise ValueError, msg % ('start', start, n+1) + raise ValueError(msg % ('start', start, n+1)) if (axis < start): # it's been removed start -= 1 if axis==start: |