summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2009-03-02 21:11:31 +0000
committerStefan van der Walt <stefan@sun.ac.za>2009-03-02 21:11:31 +0000
commit7170d0a8b85ee38da227c2db26f470750b6e1509 (patch)
tree0b11d022213b76cfcc16e7f10184c3727b7c8dea /numpy
parent553a30079c37ebecf8a37b9ee1fbf219d1d09053 (diff)
downloadnumpy-7170d0a8b85ee38da227c2db26f470750b6e1509.tar.gz
Python 3000 fixes for 2to3 [patch by James Watson].
Diffstat (limited to 'numpy')
-rw-r--r--numpy/distutils/command/build_src.py7
-rw-r--r--numpy/distutils/misc_util.py8
-rwxr-xr-xnumpy/f2py/crackfortran.py21
-rw-r--r--numpy/lib/function_base.py2
-rwxr-xr-xnumpy/linalg/lapack_lite/make_lite.py2
5 files changed, 27 insertions, 13 deletions
diff --git a/numpy/distutils/command/build_src.py b/numpy/distutils/command/build_src.py
index f0d0a3b57..4ba3f0a9a 100644
--- a/numpy/distutils/command/build_src.py
+++ b/numpy/distutils/command/build_src.py
@@ -465,7 +465,8 @@ class build_src(build_ext.build_ext):
if not (f2py_sources or f_sources):
return new_sources
- map(self.mkpath, target_dirs)
+ for d in target_dirs:
+ self.mkpath(d)
f2py_options = extension.f2py_options + self.f2py_opts
@@ -632,7 +633,9 @@ class build_src(build_ext.build_ext):
if skip_swig:
return new_sources + py_files
- map(self.mkpath, target_dirs)
+ for d in target_dirs:
+ self.mkpath(d)
+
swig = self.swig or self.find_swig()
swig_cmd = [swig, "-python"]
if is_cpp:
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index 1ba44d89f..d57b144c6 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -204,7 +204,7 @@ def _fix_paths(paths,local_path,include_non_existing):
new_paths.extend(_fix_paths(n,local_path,include_non_existing))
else:
new_paths.append(n)
- return map(minrelpath,new_paths)
+ return [minrelpath(p) for p in new_paths]
def gpaths(paths, local_path='', include_non_existing=True):
"""Apply glob to paths and prepend local_path if needed.
@@ -954,7 +954,8 @@ class Configuration(object):
for p,files in self.data_files:
if p not in data_dict:
data_dict[p] = set()
- map(data_dict[p].add,files)
+ for f in files:
+ data_dict[p].add(f)
self.data_files[:] = [(p,list(files)) for p,files in data_dict.items()]
def add_data_files(self,*files):
@@ -980,7 +981,8 @@ class Configuration(object):
"""
if len(files)>1:
- map(self.add_data_files, files)
+ for f in files:
+ self.add_data_files(f)
return
assert len(files)==1
if is_sequence(files[0]):
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py
index 449db33a3..2b49b8e1a 100755
--- a/numpy/f2py/crackfortran.py
+++ b/numpy/f2py/crackfortran.py
@@ -341,7 +341,9 @@ def readfortrancode(ffile,dowithline=show,istop=1):
elif strictf77:
if len(l)>72: l=l[:72]
if not (l[0] in spacedigits):
- raise 'readfortrancode: Found non-(space,digit) char in the first column.\n\tAre you sure that this code is in fix form?\n\tline=%s'%`l`
+ raise Exception('readfortrancode: Found non-(space,digit) char '
+ 'in the first column.\n\tAre you sure that '
+ 'this code is in fix form?\n\tline=%s' % `l`)
if (not cont or strictf77) and (len(l)>5 and not l[5]==' '):
# Continuation of a previous line
@@ -596,11 +598,16 @@ def crackline(line,reset=0):
groupcounter=groupcounter-1
if skipblocksuntil<=groupcounter: return
if groupcounter<=0:
- raise 'crackline: groupcounter(=%s) is nonpositive. Check the blocks.'\
- % (groupcounter)
+ raise Exception('crackline: groupcounter(=%s) is nonpositive. '
+ 'Check the blocks.' \
+ % (groupcounter))
m1 = beginpattern[0].match((line))
if (m1) and (not m1.group('this')==groupname[groupcounter]):
- raise 'crackline: End group %s does not match with previous Begin group %s\n\t%s'%(`m1.group('this')`,`groupname[groupcounter]`,filepositiontext)
+ raise Exception('crackline: End group %s does not match with '
+ 'previous Begin group %s\n\t%s' % \
+ (`m1.group('this')`, `groupname[groupcounter]`,
+ filepositiontext)
+ )
if skipblocksuntil==groupcounter:
skipblocksuntil=-1
grouplist[groupcounter-1].append(groupcache[groupcounter])
@@ -683,7 +690,8 @@ def appenddecl(decl,decl2,force=1):
elif k in ['intent','check','dimension','optional','required']:
errmess('appenddecl: "%s" not implemented.\n'%k)
else:
- raise 'appenddecl: Unknown variable definition key:', k
+ raise Exception('appenddecl: Unknown variable definition key:' + \
+ str(k))
return decl
selectpattern=re.compile(r'\s*(?P<this>(@\(@.*?@\)@|[*][\d*]+|[*]\s*@\(@.*?@\)@|))(?P<after>.*)\Z',re.I)
@@ -1542,7 +1550,8 @@ def postcrack(block,args=None,tab=''):
return uret+gret
setmesstext(block)
if (not type(block)==types.DictType) and 'block' not in block:
- raise 'postcrack: Expected block dictionary instead of ',block
+ raise Exception('postcrack: Expected block dictionary instead of ' + \
+ str(block))
if 'name' in block and not block['name']=='unknown_interface':
outmess('%sBlock: %s\n'%(tab,block['name']),0)
blocktype=block['block']
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 283e3faff..c6731a945 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -546,7 +546,7 @@ def histogramdd(sample, bins=10, range=None, normed=False, weights=None):
hist /= s
if (hist.shape != nbin-2).any():
- raise 'Internal Shape Error'
+ raise RuntimeError('Internal Shape Error')
return hist, edges
diff --git a/numpy/linalg/lapack_lite/make_lite.py b/numpy/linalg/lapack_lite/make_lite.py
index ebd450023..1687cfd82 100755
--- a/numpy/linalg/lapack_lite/make_lite.py
+++ b/numpy/linalg/lapack_lite/make_lite.py
@@ -141,7 +141,7 @@ class FortranLibrary:
class LapackLibrary(FortranLibrary):
def _newFortranRoutine(self, rname, filename):
routine = FortranLibrary._newFortranRoutine(self, rname, filename)
- if 'BLAS' in filename
+ if 'BLAS' in filename:
routine.type = 'blas'
elif rname.startswith('z'):
routine.type = 'zlapack'