From c31cc36a8a814ed4844a2a553454185601914a5a Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 5 Jan 2020 00:53:30 -0500 Subject: 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. --- numpy/core/arrayprint.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'numpy/core/arrayprint.py') 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. -- cgit v1.2.1