@@ -339,18 +339,19 @@ def histogramdd(sample, bins=10, range=None, normed=False, weights=None):
339
339
for i in arange (D ):
340
340
if isscalar (bins [i ]):
341
341
if bins [i ] < 1 :
342
- raise ValueError ("Element at index %s in `bins` should be "
343
- "a positive integer." % i )
342
+ raise ValueError (
343
+ "Element at index %s in `bins` should be a positive "
344
+ "integer." % i )
344
345
nbin [i ] = bins [i ] + 2 # +2 for outlier bins
345
346
edges [i ] = linspace (smin [i ], smax [i ], nbin [i ]- 1 )
346
347
else :
347
348
edges [i ] = asarray (bins [i ], float )
348
349
nbin [i ] = len (edges [i ]) + 1 # +1 for outlier bins
349
350
dedges [i ] = diff (edges [i ])
350
351
if np .any (np .asarray (dedges [i ]) <= 0 ):
351
- raise ValueError ("""
352
- Found bin edge of size <= 0. Did you specify `bins` with
353
- non-monotonic sequence?"" " )
352
+ raise ValueError (
353
+ " Found bin edge of size <= 0. Did you specify `bins` with"
354
+ " non-monotonic sequence?" )
354
355
355
356
nbin = asarray (nbin )
356
357
@@ -700,7 +701,8 @@ def piecewise(x, condlist, funclist, *args, **kw):
700
701
condlist .append (~ totlist )
701
702
n += 1
702
703
if (n != n2 ):
703
- raise ValueError ("function list and condition list must be the same" )
704
+ raise ValueError (
705
+ "function list and condition list must be the same" )
704
706
zerod = False
705
707
# This is a hack to work around problems with NumPy's
706
708
# handling of 0-d arrays and boolean indexing with
@@ -771,8 +773,8 @@ def select(condlist, choicelist, default=0):
771
773
n = len (condlist )
772
774
n2 = len (choicelist )
773
775
if n2 != n :
774
- raise ValueError ("list of cases must be same length as list of "
775
- " conditions" )
776
+ raise ValueError (
777
+ "list of cases must be same length as list of conditions" )
776
778
choicelist = [default ] + choicelist
777
779
S = 0
778
780
pfac = 1
@@ -1600,11 +1602,13 @@ def __init__(self, pyfunc, otypes='', doc=None, excluded=None,
1600
1602
self .otypes = otypes
1601
1603
for char in self .otypes :
1602
1604
if char not in typecodes ['All' ]:
1603
- raise ValueError ("Invalid otype specified: %s" % (char ,))
1605
+ raise ValueError (
1606
+ "Invalid otype specified: %s" % (char ,))
1604
1607
elif iterable (otypes ):
1605
1608
self .otypes = '' .join ([_nx .dtype (x ).char for x in otypes ])
1606
1609
else :
1607
- raise ValueError ("Invalid otype specification" )
1610
+ raise ValueError (
1611
+ "Invalid otype specification" )
1608
1612
1609
1613
# Excluded variable support
1610
1614
if excluded is None :
@@ -2938,8 +2942,9 @@ def percentile(a, q, interpolation='linear', axis=None, out=None,
2938
2942
elif interpolation == 'linear' :
2939
2943
pass # keep index as fraction and interpolate
2940
2944
else :
2941
- raise ValueError ("interpolation can only be 'linear', 'lower' "
2942
- "'higher', 'midpoint', or 'nearest'" )
2945
+ raise ValueError (
2946
+ "interpolation can only be 'linear', 'lower' 'higher', "
2947
+ "'midpoint', or 'nearest'" )
2943
2948
2944
2949
if indices .dtype == intp : # take the points along axis
2945
2950
ap .partition (indices , axis = axis )
@@ -3182,8 +3187,9 @@ def meshgrid(*xi, **kwargs):
3182
3187
3183
3188
"""
3184
3189
if len (xi ) < 2 :
3185
- raise ValueError ('meshgrid() takes 2 or more arguments'
3186
- ' (%d given)' % int (len (xi ) > 0 ))
3190
+ raise ValueError (
3191
+ 'meshgrid() takes 2 or more arguments '
3192
+ '(%d given)' % int (len (xi ) > 0 ))
3187
3193
3188
3194
args = np .atleast_1d (* xi )
3189
3195
ndim = len (args )
@@ -3192,7 +3198,8 @@ def meshgrid(*xi, **kwargs):
3192
3198
sparse = kwargs .get ('sparse' , False )
3193
3199
indexing = kwargs .get ('indexing' , 'xy' )
3194
3200
if not indexing in ['xy' , 'ij' ]:
3195
- raise ValueError ("Valid values for `indexing` are 'xy' and 'ij'." )
3201
+ raise ValueError (
3202
+ "Valid values for `indexing` are 'xy' and 'ij'." )
3196
3203
3197
3204
s0 = (1 ,) * ndim
3198
3205
output = [x .reshape (s0 [:i ] + (- 1 ,) + s0 [i + 1 ::])
@@ -3290,9 +3297,9 @@ def delete(arr, obj, axis=None):
3290
3297
ndim = arr .ndim
3291
3298
axis = ndim - 1
3292
3299
if ndim == 0 :
3293
- warnings .warn ("in the future the special handling of scalars "
3294
- " will be removed from delete and raise an error" ,
3295
- DeprecationWarning )
3300
+ warnings .warn (
3301
+ "in the future the special handling of scalars will be removed "
3302
+ "from delete and raise an error" , DeprecationWarning )
3296
3303
if wrap :
3297
3304
return wrap (arr )
3298
3305
else :
0 commit comments