From c879ad8a39f2b74edcdaa05a2f2f854fb235537d Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sat, 13 Apr 2013 12:21:42 -0600 Subject: 2to3: Apply types fixer. Python 3 removes the builtin types from the types module. The types fixer replaces such references with the builtin types where possible and also takes care of some special cases: types.TypeNone <- type(None) types.NotImplementedType <- type(NotImplemented) types.EllipsisType <- type(Ellipsis) The only two tricky substitutions are types.StringType <- bytes types.LongType <- int These are fixed up to support both Python 3 and Python 2 code by importing the long and bytes types from numpy.compat. Closes #3240. --- numpy/core/fromnumeric.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'numpy/core/fromnumeric.py') diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index a301bb7e9..84e45a6a5 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -3,7 +3,16 @@ """ from __future__ import division, absolute_import, print_function -__docformat__ = "restructuredtext en" +import types + +from . import multiarray as mu +from . import umath as um +from . import numerictypes as nt +from .numeric import asarray, array, asanyarray, concatenate +from . import _methods + +_dt_ = nt.sctype2char + # functions that are now methods __all__ = ['take', 'reshape', 'choose', 'repeat', 'put', @@ -16,19 +25,11 @@ __all__ = ['take', 'reshape', 'choose', 'repeat', 'put', 'amax', 'amin', ] -from . import multiarray as mu -from . import umath as um -from . import numerictypes as nt -from .numeric import asarray, array, asanyarray, concatenate -from . import _methods -_dt_ = nt.sctype2char - -import types try: _gentype = types.GeneratorType except AttributeError: - _gentype = types.NoneType + _gentype = type(None) # save away Python sum _sum_ = sum -- cgit v1.2.1