ó \ÐKc@sºdZgZddlZejdƒddlZddlZddlZd„Zd„Zd„Z d„Z ej j d„Z d „Zej j d „Zed kr¶e ejƒndS( s` This module converts code written for numpy.numarray to work with numpy FIXME: finish this. iÿÿÿÿNs.numpy.numarray.alter_code2 is not working yet.cCs*t|dƒ}|j|ƒ|jƒdS(Ntw(tfiletwritetclose(tnametfilestrtfid((s>/usr/lib/python2.7/site-packages/numpy/numarray/alter_code2.pyt makenewfiles cCsOt|ƒ}|jƒ}|jƒtjj|ƒ\}}t|d|ƒ|S(Ns.orig(RtreadRtostpathtsplitextR(RRRtbasetext((s>/usr/lib/python2.7/site-packages/numpy/numarray/alter_code2.pyt getandcopys    cCs)t|ƒ}t|ƒ}t||ƒdS(sŸ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 N(RtfromstrR(tfilenameR((s>/usr/lib/python2.7/site-packages/numpy/numarray/alter_code2.pyt convertfiles  cCs|d}t|ƒdS(Ni(R(targsR((s>/usr/lib/python2.7/site-packages/numpy/numarray/alter_code2.pytfromargs)s cCs=tjtjj|dƒƒ}x|D]}t|ƒq%WdS(sòConvert all .py files to use NumPy (from Numeric) in the directory given For each file, a backup of .py is made as .py.orig. A new file named .py is then written with the updated code. s*.pyN(tglobR R tjoinR(tdirectfilestafile((s>/usr/lib/python2.7/site-packages/numpy/numarray/alter_code2.pyt convertall-s cCst|ƒdS(N(R(targtdirnametfnames((s>/usr/lib/python2.7/site-packages/numpy/numarray/alter_code2.pyt_func8scCstjj|tdƒdS(s-Convert all .py files in the tree given N(R R twalkRtNone(R((s>/usr/lib/python2.7/site-packages/numpy/numarray/alter_code2.pyt converttree;st__main__(t__doc__t__all__twarningstwarntsysR RRRRRR tcurdirRRR t__name__targv(((s>/usr/lib/python2.7/site-packages/numpy/numarray/alter_code2.pyts