diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-01-15 08:09:50 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-15 08:09:50 +0000 |
commit | d868ba28c1d31faa1b0b1b6684e316ae329bc549 (patch) | |
tree | be55d577e9aeb697e2528eccab4b9c704209e3a7 /numpy/lib/convertcode.py | |
parent | 02f61f06d44bd8f118d9e9727910c77337857857 (diff) | |
download | numpy-d868ba28c1d31faa1b0b1b6684e316ae329bc549.tar.gz |
Made dtypedescr name attribute always report bit-width; fixed memmap slicing; Improved documentation of convertfile and convertall in convertcode.py
Diffstat (limited to 'numpy/lib/convertcode.py')
-rw-r--r-- | numpy/lib/convertcode.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/numpy/lib/convertcode.py b/numpy/lib/convertcode.py index 3e0a679f0..0c5a0833b 100644 --- a/numpy/lib/convertcode.py +++ b/numpy/lib/convertcode.py @@ -126,19 +126,30 @@ def getandcopy(name): makenewfile(base+'.orig', filestr) return filestr -def fromfile(filename): +def convertfile(filename): + """Convert the filename given from using Numeric to using NumPy + + Copies the file to filename.orig and then over-writes the file + with the updated code + """ filestr = getandcopy(filename) filestr = fromstr(filestr) makenewfile(filename, filestr) def fromargs(args): filename = args[1] - fromfile(filename) + convertfile(filename) + +def convertall(direc=os.path.curdir): + """Convert all .py files to use NumPy (from Numeric) in the directory given -def convertall(direc=''): + For each file, a backup of <usesnumeric>.py is made as + <usesnumeric>.py.orig. A new file named <usesnumeric>.py + is then written with the updated code. + """ files = glob.glob(os.path.join(direc,'*.py')) for afile in files: - fromfile(afile) + convertfile(afile) if __name__ == '__main__': fromargs(sys.argv) |