summaryrefslogtreecommitdiff
path: root/numpy/core/getlimits.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-07-05 11:47:29 -0600
committerCharles Harris <charlesr.harris@gmail.com>2015-07-05 12:18:26 -0600
commit8b3e9ae5262c1da1118370cd6e83db9b2166952e (patch)
treead552d92d8f806db622da102707571a38faec7c2 /numpy/core/getlimits.py
parentc2ae6aa0103aecdb5e2a71504583451cada1bfbc (diff)
downloadnumpy-8b3e9ae5262c1da1118370cd6e83db9b2166952e.tar.gz
STY: PEP8 fixes for numpy/core/*.py
Diffstat (limited to 'numpy/core/getlimits.py')
-rw-r--r--numpy/core/getlimits.py48
1 files changed, 25 insertions, 23 deletions
diff --git a/numpy/core/getlimits.py b/numpy/core/getlimits.py
index bd1c4571b..2ea9c0e11 100644
--- a/numpy/core/getlimits.py
+++ b/numpy/core/getlimits.py
@@ -12,7 +12,8 @@ from .numeric import array
def _frz(a):
"""fix rank-0 --> rank-1"""
- if a.ndim == 0: a.shape = (1,)
+ if a.ndim == 0:
+ a.shape = (1,)
return a
_convert_to_float = {
@@ -170,25 +171,25 @@ class finfo(object):
return self
def __str__(self):
- return '''\
-Machine parameters for %(dtype)s
----------------------------------------------------------------------
-precision=%(precision)3s resolution= %(_str_resolution)s
-machep=%(machep)6s eps= %(_str_eps)s
-negep =%(negep)6s epsneg= %(_str_epsneg)s
-minexp=%(minexp)6s tiny= %(_str_tiny)s
-maxexp=%(maxexp)6s max= %(_str_max)s
-nexp =%(nexp)6s min= -max
----------------------------------------------------------------------
-''' % self.__dict__
+ fmt = (
+ 'Machine parameters for %(dtype)s\n'
+ '---------------------------------------------------------------\n'
+ 'precision=%(precision)3s resolution= %(_str_resolution)s\n'
+ 'machep=%(machep)6s eps= %(_str_eps)s\n'
+ 'negep =%(negep)6s epsneg= %(_str_epsneg)s\n'
+ 'minexp=%(minexp)6s tiny= %(_str_tiny)s\n'
+ 'maxexp=%(maxexp)6s max= %(_str_max)s\n'
+ 'nexp =%(nexp)6s min= -max\n'
+ '---------------------------------------------------------------\n'
+ )
+ return fmt % self.__dict__
def __repr__(self):
c = self.__class__.__name__
d = self.__dict__.copy()
d['klass'] = c
- return ("%(klass)s(resolution=%(resolution)s, min=-%(_str_max)s," \
- + " max=%(_str_max)s, dtype=%(dtype)s)") \
- % d
+ return (("%(klass)s(resolution=%(resolution)s, min=-%(_str_max)s,"
+ " max=%(_str_max)s, dtype=%(dtype)s)") % d)
class iinfo(object):
@@ -249,7 +250,7 @@ class iinfo(object):
self.kind = self.dtype.kind
self.bits = self.dtype.itemsize * 8
self.key = "%s%d" % (self.kind, self.bits)
- if not self.kind in 'iu':
+ if self.kind not in 'iu':
raise ValueError("Invalid integer data type.")
def min(self):
@@ -282,13 +283,14 @@ class iinfo(object):
def __str__(self):
"""String representation."""
- return '''\
-Machine parameters for %(dtype)s
----------------------------------------------------------------------
-min = %(min)s
-max = %(max)s
----------------------------------------------------------------------
-''' % {'dtype': self.dtype, 'min': self.min, 'max': self.max}
+ fmt = (
+ 'Machine parameters for %(dtype)s\n'
+ '---------------------------------------------------------------\n'
+ 'min = %(min)s\n'
+ 'max = %(max)s\n'
+ '---------------------------------------------------------------\n'
+ )
+ return fmt % {'dtype': self.dtype, 'min': self.min, 'max': self.max}
def __repr__(self):
return "%s(min=%s, max=%s, dtype=%s)" % (self.__class__.__name__,