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 | |
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.
-rw-r--r-- | numpy/core/arrayprint.py | 8 | ||||
-rw-r--r-- | numpy/oldnumeric/ma.py | 24 | ||||
-rwxr-xr-x | tools/py3tool.py | 2 |
3 files changed, 23 insertions, 11 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index 62d31b960..a0f2cfa63 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -22,6 +22,12 @@ from .umath import maximum, minimum, absolute, not_equal, isnan, isinf from .multiarray import format_longfloat, datetime_as_string, datetime_data from .fromnumeric import ravel +if sys.version_info[0] >= 3: + _MAXINT = sys.maxsize + _MININT = -sys.maxsize - 1 +else: + _MAXINT = sys.maxint + _MININT = -sys.maxint - 1 def product(x, y): return x*y @@ -633,8 +639,6 @@ def _digits(x, precision, format): return precision - len(s) + len(z) -_MAXINT = sys.maxint -_MININT = -sys.maxint-1 class IntegerFormat(object): def __init__(self, data): try: 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: diff --git a/tools/py3tool.py b/tools/py3tool.py index e73d7aadb..8b7c1b0a3 100755 --- a/tools/py3tool.py +++ b/tools/py3tool.py @@ -81,7 +81,7 @@ FIXES_TO_SKIP = [ 'raise', 'raw_input', 'reduce', -# 'renames', + 'renames', 'repr', 'setliteral', 'standarderror', |