diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-01-05 00:53:30 -0500 |
---|---|---|
committer | Warren Weckesser <warren.weckesser@gmail.com> | 2020-01-05 00:53:30 -0500 |
commit | c31cc36a8a814ed4844a2a553454185601914a5a (patch) | |
tree | adb28a762dc0985eed669db75b564b3f5c3bfbcc /numpy/core/arrayprint.py | |
parent | c1f1bc9ce8e4e2936e80d9bfafc3d8e03237a84b (diff) | |
download | numpy-c31cc36a8a814ed4844a2a553454185601914a5a.tar.gz |
MAINT: Remove implicit inheritance from object class (#15236)
Inheriting from object was necessary for Python 2 compatibility to use
new-style classes. In Python 3, this is unnecessary as there are no
old-style classes.
Dropping the object is more idiomatic Python.
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r-- | numpy/core/arrayprint.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index 696f64c6a..136b9ecff 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -849,7 +849,7 @@ def _none_or_positive_arg(x, name): raise ValueError("{} must be >= 0".format(name)) return x -class FloatingFormat(object): +class FloatingFormat: """ Formatter for subtypes of np.floating """ def __init__(self, data, precision, floatmode, suppress_small, sign=False, **kwarg): @@ -1138,7 +1138,7 @@ def format_float_positional(x, precision=None, unique=True, pad_right=pad_right) -class IntegerFormat(object): +class IntegerFormat: def __init__(self, data): if data.size > 0: max_str_len = max(len(str(np.max(data))), @@ -1151,7 +1151,7 @@ class IntegerFormat(object): return self.format % x -class BoolFormat(object): +class BoolFormat: def __init__(self, data, **kwargs): # add an extra space so " True" and "False" have the same length and # array elements align nicely when printed, except in 0d arrays @@ -1161,7 +1161,7 @@ class BoolFormat(object): return self.truestr if x else "False" -class ComplexFloatingFormat(object): +class ComplexFloatingFormat: """ Formatter for subtypes of np.complexfloating """ def __init__(self, x, precision, floatmode, suppress_small, sign=False, **kwarg): @@ -1190,7 +1190,7 @@ class ComplexFloatingFormat(object): return r + i -class _TimelikeFormat(object): +class _TimelikeFormat: def __init__(self, data): non_nat = data[~isnat(data)] if len(non_nat) > 0: @@ -1253,7 +1253,7 @@ class TimedeltaFormat(_TimelikeFormat): return str(x.astype('i8')) -class SubArrayFormat(object): +class SubArrayFormat: def __init__(self, format_function): self.format_function = format_function @@ -1263,7 +1263,7 @@ class SubArrayFormat(object): return "[" + ", ".join(self.__call__(a) for a in arr) + "]" -class StructuredVoidFormat(object): +class StructuredVoidFormat: """ Formatter for structured np.void objects. |