ó Kc @sØdZddddgZddlZddlZddlZddlZddgZd gZd d d d ddddddg Zidd6dd6dd6dd6Z iZ iZ x1eD])Z de Z eje ejƒe e isinstance(..., ) t convertfilet convertallt converttreet convertsrciÿÿÿÿNteyettritastypetonestzerostidentityt fromstringtindicestemptytarraytasarraytarangetarray_constructortbt1thtstHtwtItus.(%s\s*[(][^,]*?[,][^'"]*?['"])b(['"][^)]*?[)])s@(%s\s*[(][^,]*?[,][^,]*?[,][^,]*?[,][^'"]*?['"])b(['"][^)]*?[)])s&(.%s\s*[(][^'"]*?['"])b(['"][^)]*?[)])s+(.astype\s*[(][^'"]*?['"])%s(['"][^)]*?[)])cCshx,tttD]}t|jd|ƒ}qWx2tjƒD]$}t|jdt||ƒ}q<W|S(Ns\1B\2s\1%s\2(t_func2t_func4t_meth1tfunc_retsubt_charstkeystmeth_re(tfstrtnametchar((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyt fixtypecharsAs "s([.]flat(\s*?[[=]))c Csd|}d|}d|}d}tjd|d||f|ƒ}|j|d|ƒ}|j|d||fƒ}d}t|ƒ}td|ƒ} xn|j||ƒ} | dkrÀPn| |}||dkràqžnd || |||f}|| |7}qž||fS( Ns import %ss import %s as sfrom %s import is(import\s+[^,\n\r]+,\s*)(%s)s \1%s as %ssimport %s as %st*s%sfrom %s import %s(treRtreplacetlentfind( R!R"tnewnamet importstrt importasstrtfromstrtfromalltindtNlentNlen2tfound((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyt changeimportsJs*       tfloattinttcomplext ArrayTypet FloatTypetIntTypet ComplexTypes*type\s*[(]([^)]*)[)]\s+(?:is|==)\s+(.*?%s)cCs+x$tD]}t|jd|ƒ}qW|S(Nsisinstance(\1, \2)(t_typest istest_reR(tastrR"((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyt fixistestingis cCs”|jddƒ}|jddƒ}|jddƒ}|jddƒ}|jd d ƒ}tjd |ƒ}|jd d ƒ}|jdd ƒ}|S(Ns .typecode()s .dtype.chars.iscontiguous()s.flags.contiguouss.byteswapped()s .byteswap()s .toscalar()s.item()s .itemsize()s .itemsizes@@@@\2s.flats.ravel()s@@@@(R't flatindex_reR(R=ttmpstr((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyt replaceattrnss([^,(\s]+[.]spacesaver[(][)])s(\S+[.]savespace[(].*[)])cCs(tjd|ƒ}tjd|ƒ}|S(NtTrues pass ## \1(tsvspc2Rtsvspc3(R=((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyt replaceotherscCs1|}t|ƒ}t|ƒ}t|ddƒ\}}t|ddƒ\}}t|ddƒ\}}t|ddƒ\}}t|ddƒ\}}t|d d ƒ\}}t|d dƒ\}}t|d dƒ\}}t|d dƒ\}}t|ddƒ\}}t|ddƒ\}}t|ddƒ\}}t|ddƒ\}}t|ddƒ\}}t|ddƒ\}}t|ddƒ\}}|p®|p®|}t|ƒ}t|ƒ}||kr'tjjƒjdƒ}t j j t j dƒd}d |||f}|d!fS|dfS("NtNumericsnumpy.oldnumerict multiarraytumatht Precisionsnumpy.oldnumeric.precisiont UserArraysnumpy.oldnumeric.user_arrayt ArrayPrintersnumpy.oldnumeric.array_printertnumerixt scipy_basetMatrixsnumpy.oldnumeric.matrixtMLabsnumpy.oldnumeric.mlabt LinearAlgebrasnumpy.oldnumeric.linear_algebratRNGsnumpy.oldnumeric.rngsRNG.Statisticssnumpy.oldnumeric.rng_statst RandomArraysnumpy.oldnumeric.random_arraytFFTsnumpy.oldnumeric.ffttMAsnumpy.oldnumeric.mas %b %d, %Yiiÿÿÿÿs:## Automatically adapted for numpy.oldnumeric %s by %s %si(R$R>R3RAREtdatetimetdatettodaytstrftimetostpathtsplittsystargv(tfilestrtsavestrtfromall1tfromall2tfromall3R.RWR"((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyR-†s:      cCs*t|dƒ}|j|ƒ|jƒdS(NR(tfiletwritetclose(R"R^tfid((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyt makenewfile¥s icCst|ƒ}|jƒ}|jƒt|ƒ\}}|rŒ|rotjj|ƒ\}}tj||dƒn tj|ƒt ||ƒndS(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 s.origN( topentreadReR-RYRZtsplitexttrenametremoveRg(tfilenametorigRfR^tchangedtbasetext((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyRªs    cCs|d}t|ƒdS(Ni(R(targsRm((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pytfromargs¼s cCsVtjtjj|dƒƒ}x1|D])}|ddkrAq%nt||ƒq%WdS(sConvert all .py files to use numpy.oldnumeric (from Numeric) in the directory given For each changed file, a backup of .py is made as .py.orig. A new file named .py is then written with the updated code. s*.pyiøÿÿÿssetup.pyN(tglobRYRZtjoinR(tdirecRntfilestafile((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyRÀs  s(Numeric/arrayobject.h)c Cs|dkr-tjtjj|dƒƒ}n@g}x7|D]/}|jtjtjj|d|ƒƒƒq:Wx¦|D]ž}t|ƒ}|jƒ}|jƒt j d|ƒ\}}|dkrt|rõtjj |ƒ\} }tj || dƒn tj |ƒt||ƒqtqtWdS(sªReplace Numeric/arrayobject.h with numpy/oldnumeric.h in all files in the directory with extension give by list ext (if ext is None, then all files are replaced).R%s*.%ssnumpy/oldnumeric.his.origN(tNoneRtRYRZRutextendRhRiRet header_retsubnRjRkRlRg( RvRqRnRwtaextRxRfR!tnRp((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyRÎs  ! -      cCs0t|ddƒt|dddgddƒdS(NRniRqRtc(RR(targtdirnametfnames((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyt_funcåscCstjj|tdƒdS(sBConvert all .py files and source code files in the tree given N(RYRZtwalkRƒRy(Rv((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pyRést__main__(+t__doc__t__all__R\RYR&RtRRRRRR R"t_astrtcompiletDOTALLRR#R$R?R3R<R;R>RARCRDRERUR-RgRRsRZtcurdirRR{RyRRƒRt__name__R](((s@/usr/lib/python2.7/site-packages/numpy/oldnumeric/alter_code1.pytsd      "