diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-14 07:29:22 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-14 07:29:22 -0700 |
commit | ff464ef985cb4d3bca82cc0e7867e02ca47482dc (patch) | |
tree | 215fa2823516fe3d3dce6e4cf46b0dd37c8f9acc /numpy/oldnumeric/ma.py | |
parent | f62bc39d25eb827b4245ddfeb25b2ff6afbb838d (diff) | |
parent | ffdad17d0db1d55d39911d637c650ea0acada78b (diff) | |
download | numpy-ff464ef985cb4d3bca82cc0e7867e02ca47482dc.tar.gz |
Merge pull request #3238 from charris/2to3-apply-renames-fixer
2to3: Apply renames fixer.
Diffstat (limited to 'numpy/oldnumeric/ma.py')
-rw-r--r-- | numpy/oldnumeric/ma.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/numpy/oldnumeric/ma.py b/numpy/oldnumeric/ma.py index cdec74cab..05a4480af 100644 --- a/numpy/oldnumeric/ma.py +++ b/numpy/oldnumeric/ma.py @@ -11,7 +11,10 @@ Adapted for numpy_core 2005 by Travis Oliphant and """ from __future__ import division, absolute_import, print_function -import types, sys +import sys +import types +import warnings +from functools import reduce import numpy.core.umath as umath import numpy.core.fromnumeric as fromnumeric @@ -19,8 +22,13 @@ from numpy.core.numeric import newaxis, ndarray, inf from numpy.core.fromnumeric import amax, amin from numpy.core.numerictypes import bool_, typecodes import numpy.core.numeric as numeric -import warnings -from functools import reduce + +if sys.version_info[0] >= 3: + _MAXINT = sys.maxsize + _MININT = -sys.maxsize - 1 +else: + _MAXINT = sys.maxint + _MININT = -sys.maxint - 1 # Ufunc domain lookup for __array_wrap__ @@ -114,15 +122,15 @@ def minimum_fill_value (obj): if isinstance(obj, types.FloatType): return numeric.inf elif isinstance(obj, types.IntType) or isinstance(obj, types.LongType): - return sys.maxint + return _MAXINT elif isinstance(obj, MaskedArray) or isinstance(obj, ndarray): x = obj.dtype.char if x in typecodes['Float']: return numeric.inf if x in typecodes['Integer']: - return sys.maxint + return _MAXINT if x in typecodes['UnsignedInteger']: - return sys.maxint + return _MAXINT else: raise TypeError('Unsuitable type for calculating minimum.') @@ -131,13 +139,13 @@ def maximum_fill_value (obj): if isinstance(obj, types.FloatType): return -inf elif isinstance(obj, types.IntType) or isinstance(obj, types.LongType): - return -sys.maxint + return -_MAXINT elif isinstance(obj, MaskedArray) or isinstance(obj, ndarray): x = obj.dtype.char if x in typecodes['Float']: return -inf if x in typecodes['Integer']: - return -sys.maxint + return -_MAXINT if x in typecodes['UnsignedInteger']: return 0 else: |