diff options
Diffstat (limited to 'numpy/oldnumeric/compat.py')
-rw-r--r-- | numpy/oldnumeric/compat.py | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/numpy/oldnumeric/compat.py b/numpy/oldnumeric/compat.py index 083a1fa15..841052656 100644 --- a/numpy/oldnumeric/compat.py +++ b/numpy/oldnumeric/compat.py @@ -1,4 +1,18 @@ -# Compatibility module containing deprecated names +"""Compatibility module containing deprecated names. + +""" +from __future__ import division, absolute_import, print_function + +import sys +import copy +import pickle +from pickle import dump, dumps + +import numpy.core.multiarray as multiarray +import numpy.core.umath as um +from numpy.core.numeric import array +from . import functions + __all__ = ['NewAxis', 'UFuncType', 'UfuncType', 'ArrayType', 'arraytype', @@ -10,13 +24,6 @@ __all__ = ['NewAxis', 'Unpickler', 'Pickler' ] -import numpy.core.multiarray as multiarray -import numpy.core.umath as um -from numpy.core.numeric import array -import functions -import sys - -from cPickle import dump, dumps mu = multiarray @@ -44,8 +51,7 @@ def DumpArray(m, fp): m.dump(fp) def LoadArray(fp): - import cPickle - return cPickle.load(fp) + return pickle.load(fp) def array_constructor(shape, typecode, thestr, Endian=LittleEndian): if typecode == "O": @@ -67,15 +73,14 @@ def pickle_array(a): (a.shape, a.dtype.char, a.tostring(), LittleEndian)) def loads(astr): - import cPickle - arr = cPickle.loads(astr.replace('Numeric', 'numpy.oldnumeric')) + arr = pickle.loads(astr.replace('Numeric', 'numpy.oldnumeric')) return arr def load(fp): return loads(fp.read()) def _LoadArray(fp): - import typeconv + from . import typeconv ln = fp.readline().split() if ln[0][0] == 'A': ln[0] = ln[0][1:] typecode = ln[0][0] @@ -94,7 +99,6 @@ def _LoadArray(fp): else: return m -import pickle, copy if sys.version_info[0] >= 3: class Unpickler(pickle.Unpickler): # XXX: should we implement this? It's not completely straightforward |