Skip to content

Commit

Permalink
MAINT: Use new-style classes on 2.7
Browse files Browse the repository at this point in the history
Deliberately avoids tests, to prevent introducing a failure on old-style classes later.
  • Loading branch information
eric-wieser committed Jul 24, 2017
1 parent 6958be1 commit 7748f26
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion numpy/_globals.py
Expand Up @@ -53,7 +53,7 @@ class VisibleDeprecationWarning(UserWarning):
pass


class _NoValue:
class _NoValue(object):
"""Special keyword value.
This class may be used as the default value assigned to a deprecated
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/code_generators/genapi.py
Expand Up @@ -72,7 +72,7 @@ def _repl(str):
return str.replace('Bool', 'npy_bool')


class StealRef:
class StealRef(object):
def __init__(self, arg):
self.arg = arg # counting from 1

Expand All @@ -83,7 +83,7 @@ def __str__(self):
return 'NPY_STEALS_REF_TO_ARG(%d)' % self.arg


class NonNull:
class NonNull(object):
def __init__(self, arg):
self.arg = arg # counting from 1

Expand Down
2 changes: 1 addition & 1 deletion numpy/core/records.py
Expand Up @@ -80,7 +80,7 @@ def find_duplicate(list):
dup.append(list[i])
return dup

class format_parser:
class format_parser(object):
"""
Class to convert formats, names, titles description to a dtype.
Expand Down
2 changes: 1 addition & 1 deletion numpy/f2py/auxfuncs.py
Expand Up @@ -552,7 +552,7 @@ class F2PYError(Exception):
pass


class throw_error:
class throw_error(object):

def __init__(self, mess):
self.mess = mess
Expand Down
22 changes: 11 additions & 11 deletions numpy/ma/core.py
Expand Up @@ -784,7 +784,7 @@ def fix_invalid(a, mask=nomask, copy=True, fill_value=None):
ufunc_fills = {}


class _DomainCheckInterval:
class _DomainCheckInterval(object):
"""
Define a valid interval, so that :
Expand All @@ -809,7 +809,7 @@ def __call__(self, x):
umath.less(x, self.a))


class _DomainTan:
class _DomainTan(object):
"""
Define a valid interval for the `tan` function, so that:
Expand All @@ -827,7 +827,7 @@ def __call__(self, x):
return umath.less(umath.absolute(umath.cos(x)), self.eps)


class _DomainSafeDivide:
class _DomainSafeDivide(object):
"""
Define a domain for safe division.
Expand All @@ -848,7 +848,7 @@ def __call__(self, a, b):
return umath.absolute(a) * self.tolerance >= umath.absolute(b)


class _DomainGreater:
class _DomainGreater(object):
"""
DomainGreater(v)(x) is True where x <= v.
Expand All @@ -864,7 +864,7 @@ def __call__(self, x):
return umath.less_equal(x, self.critical_value)


class _DomainGreaterEqual:
class _DomainGreaterEqual(object):
"""
DomainGreaterEqual(v)(x) is True where x < v.
Expand All @@ -880,7 +880,7 @@ def __call__(self, x):
return umath.less(x, self.critical_value)


class _MaskedUnaryOperation:
class _MaskedUnaryOperation(object):
"""
Defines masked version of unary operations, where invalid values are
pre-masked.
Expand Down Expand Up @@ -959,7 +959,7 @@ def __str__(self):
return "Masked version of %s. [Invalid values are masked]" % str(self.f)


class _MaskedBinaryOperation:
class _MaskedBinaryOperation(object):
"""
Define masked version of binary operations, where invalid
values are pre-masked.
Expand Down Expand Up @@ -1111,7 +1111,7 @@ def __str__(self):
return "Masked version of " + str(self.f)


class _DomainedBinaryOperation:
class _DomainedBinaryOperation(object):
"""
Define binary operations that have a domain, like divide.
Expand Down Expand Up @@ -2358,7 +2358,7 @@ def masked_invalid(a, copy=True):
###############################################################################


class _MaskedPrintOption:
class _MaskedPrintOption(object):
"""
Handle the string used to represent missing data in a masked array.
Expand Down Expand Up @@ -6417,7 +6417,7 @@ def ptp(obj, axis=None, out=None, fill_value=None):
##############################################################################


class _frommethod:
class _frommethod(object):
"""
Define functions from existing MaskedArray methods.
Expand Down Expand Up @@ -7895,7 +7895,7 @@ def fromflex(fxarray):
return masked_array(fxarray['_data'], mask=fxarray['_mask'])


class _convert2ma:
class _convert2ma(object):

"""
Convert functions from numpy to numpy.ma.
Expand Down
2 changes: 1 addition & 1 deletion numpy/ma/extras.py
Expand Up @@ -215,7 +215,7 @@ def masked_all_like(arr):
#####--------------------------------------------------------------------------
#---- --- Standard functions ---
#####--------------------------------------------------------------------------
class _fromnxfunction:
class _fromnxfunction(object):
"""
Defines a wrapper to adapt NumPy functions to masked arrays.
Expand Down

0 comments on commit 7748f26

Please sign in to comment.