@@ -313,7 +313,7 @@ def scaling_needed(self):
313
313
data are within range of the output type, return False
314
314
* Otherwise return True
315
315
"""
316
- if not super (SlopeArrayWriter , self ).scaling_needed ():
316
+ if not super ().scaling_needed ():
317
317
return False
318
318
mn , mx = self .finite_range () # this is cached
319
319
# No finite data - no scaling needed
@@ -428,7 +428,7 @@ def _range_scale(self, in_min, in_max):
428
428
# not lose precision because min/max are of fp type.
429
429
out_min , out_max = np .array ((out_min , out_max ), dtype = big_float )
430
430
else : # (u)int
431
- out_min , out_max = [ int_to_float (v , big_float ) for v in (out_min , out_max )]
431
+ out_min , out_max = ( int_to_float (v , big_float ) for v in (out_min , out_max ))
432
432
if self ._out_dtype .kind == 'u' :
433
433
if in_min < 0 and in_max > 0 :
434
434
raise WriterError (
@@ -507,13 +507,11 @@ def __init__(self, array, out_dtype=None, calc_scale=True, scaler_dtype=np.float
507
507
>>> (aw.slope, aw.inter) == (1.0, 128)
508
508
True
509
509
"""
510
- super (SlopeInterArrayWriter , self ).__init__ (
511
- array , out_dtype , calc_scale , scaler_dtype , ** kwargs
512
- )
510
+ super ().__init__ (array , out_dtype , calc_scale , scaler_dtype , ** kwargs )
513
511
514
512
def reset (self ):
515
513
"""Set object to values before any scaling calculation"""
516
- super (SlopeInterArrayWriter , self ).reset ()
514
+ super ().reset ()
517
515
self .inter = 0.0
518
516
519
517
def _get_inter (self ):
@@ -549,14 +547,14 @@ def to_fileobj(self, fileobj, order='F'):
549
547
550
548
def _iu2iu (self ):
551
549
# (u)int to (u)int
552
- mn , mx = [ as_int (v ) for v in self .finite_range ()]
550
+ mn , mx = ( as_int (v ) for v in self .finite_range ())
553
551
# range may be greater than the largest integer for this type.
554
552
# as_int needed to work round numpy 1.4.1 int casting bug
555
553
out_dtype = self ._out_dtype
556
554
# Options in this method are scaling using intercept only. These will
557
555
# have to pass through ``self.scaler_dtype`` (because the intercept is
558
556
# in this type).
559
- o_min , o_max = [ as_int (v ) for v in shared_range (self .scaler_dtype , out_dtype )]
557
+ o_min , o_max = ( as_int (v ) for v in shared_range (self .scaler_dtype , out_dtype ))
560
558
type_range = o_max - o_min
561
559
mn2mx = mx - mn
562
560
if mn2mx <= type_range : # might offset be enough?
@@ -579,7 +577,7 @@ def _iu2iu(self):
579
577
self .inter = inter
580
578
return
581
579
# Try slope options (sign flip) and then range scaling
582
- super (SlopeInterArrayWriter , self )._iu2iu ()
580
+ super ()._iu2iu ()
583
581
584
582
def _range_scale (self , in_min , in_max ):
585
583
"""Calculate scaling, intercept based on data range and output type"""
@@ -604,7 +602,7 @@ def _range_scale(self, in_min, in_max):
604
602
in_min , in_max = as_int (in_min ), as_int (in_max )
605
603
in_range = int_to_float (in_max - in_min , big_float )
606
604
# Cast to float for later processing.
607
- in_min , in_max = [ int_to_float (v , big_float ) for v in (in_min , in_max )]
605
+ in_min , in_max = ( int_to_float (v , big_float ) for v in (in_min , in_max ))
608
606
if out_dtype .kind == 'f' :
609
607
# Type range, these are also floats
610
608
info = type_info (out_dtype )
0 commit comments