diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-13 12:21:42 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-14 08:57:45 -0600 |
commit | c879ad8a39f2b74edcdaa05a2f2f854fb235537d (patch) | |
tree | 378c562ff234193cc7391a0f89095b693f42a42e /numpy/f2py/rules.py | |
parent | 3f2c789ffd0d2e05596b15ea6cd644262f96200e (diff) | |
download | numpy-c879ad8a39f2b74edcdaa05a2f2f854fb235537d.tar.gz |
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.
Diffstat (limited to 'numpy/f2py/rules.py')
-rw-r--r-- | numpy/f2py/rules.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py index 250caf55f..a76401ac9 100644 --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -60,11 +60,7 @@ f2py_version = __version__.version import pprint import sys import time -import types import copy -errmess=sys.stderr.write -outmess=sys.stdout.write -show=pprint.pprint from .auxfuncs import * from . import capi_maps @@ -74,8 +70,12 @@ from . import common_rules from . import use_rules from . import f90mod_rules from . import func2subr -options={} +errmess = sys.stderr.write +outmess = sys.stdout.write +show = pprint.pprint + +options={} sepdict={} #for k in ['need_cfuncs']: sepdict[k]=',' for k in ['decl', @@ -1388,9 +1388,9 @@ def buildapi(rout): vrd['check']=c ar=applyrules(check_rules,vrd,var[a]) rd=dictappend(rd,ar) - if type(rd['cleanupfrompyobj']) is types.ListType: + if type(rd['cleanupfrompyobj']) is list: rd['cleanupfrompyobj'].reverse() - if type(rd['closepyobjfrom']) is types.ListType: + if type(rd['closepyobjfrom']) is list: rd['closepyobjfrom'].reverse() rd['docsignature']=stripcomma(replace('#docsign##docsignopt##docsignxa#', {'docsign':rd['docsign'], @@ -1415,15 +1415,15 @@ def buildapi(rout): else: rd['callcompaqfortran']=cfs rd['callfortran']=cfs - if type(rd['docreturn'])==types.ListType: + if type(rd['docreturn'])==list: rd['docreturn']=stripcomma(replace('#docreturn#',{'docreturn':rd['docreturn']}))+' = ' rd['docstrsigns']=[] rd['latexdocstrsigns']=[] for k in ['docstrreq','docstropt','docstrout','docstrcbs']: - if k in rd and type(rd[k])==types.ListType: + if k in rd and type(rd[k])==list: rd['docstrsigns']=rd['docstrsigns']+rd[k] k='latex'+k - if k in rd and type(rd[k])==types.ListType: + if k in rd and type(rd[k])==list: rd['latexdocstrsigns']=rd['latexdocstrsigns']+rd[k][0:1]+\ ['\\begin{description}']+rd[k][1:]+\ ['\\end{description}'] |