Current File : //proc/self/root/proc/self/root/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pyc
�
E�`Qc@s�dZdddgZddlZddlZddlZddlZdddgZd	d
ddd
dddgZddddddddddddddgZeeZ	iZ
x+e	D]#ZdeZej
e�e
e<q�WddlZdejejejZd�Zd�Zed �Zd!�Zd"�Zd#�Zed$�Zd%�Zejjed&�Zd'�Zejjed(�Z e!d)kr�eej"�ndS(*s�
This module adds the default axis argument to code which did not specify it
for the functions where the default was changed in NumPy.

The functions changed are

add -1  ( all second argument)
======
nansum
nanmax
nanmin
nanargmax
nanargmin
argmax
argmin
compress 3


add 0
======
take     3
repeat   3
sum         # might cause problems with builtin.
product
sometrue
alltrue
cumsum
cumproduct
average
ptp
cumprod
prod
std
mean
tconvertfilet
convertalltconverttreei����Ntcompressttaketrepeattnansumtnanmaxtnanmint	nanargmaxt	nanargmintargmaxtargmintsumtproducttsometruetalltruetcumsumt
cumproducttaveragetptptcumprodtprodtstdtmeans%s\s*[(]t_c
Cs�d}|tkrd}nd}d}d}xjt|j|�D]U}d}|j�\}	}
||	dtkryqAn||	ddkr||	d|	d!dkr||	d|	d!dkr||	d	|	d!d
kr||	d|	d!dkr||	d|	d!d
krqAn||	ddkr�|	d}x||dkrX|d8}q;W||d|d!dksA||d|d!dkr�qAq�n|
}d}d}
t|�}x�|r[||kr�d}Pn||dkr�|d8}n\||dkr|d7}n?|dkrN||dkrN|
d7}
|
|krNd}PqNn|d7}q�W|rhqAn|d7}d||||d!|f}|}qAW|s�|}nd|||f}||fS(Niitt.itnumpyitNi	tnumarrayitnumerixtNumerics	t tdefitclasst)t(t,s%s%s,%s)s%s%s(s	R!(s	R!(t_args3tfunc_retfinditertspant
disallowedtlen(tfstrtnametrepltaltert
allowed_commatnewcodetlasttobjtnochangetstarttendtktstacktncommasR((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pyt	_add_axis>sh	
		




	cCs�d}d}|j|�}|dkr�d}x:|D]2}|jd||�}|dkr4d}Pq4q4W|r�d|| d||t|�f}|d7}q�ntjd�}|j|�}	t|	�dkr�x�|	D]�}
d}x=|D]5}|jd|
|f�}|dkr�d}Pq�q�W|r�d	|
}|j|�}d|| d
|
||t|�f}|d7}q�q�Wnd}|j|�}|dkr3d}xJ|D]B}|j||�}|dkr�||dtkr�d}Pq�q�W|r3d|| d||t|�f}|d7}q3nd}d
}t|�}x�|j||�}|dkrpPn||7}|d}d}
xN|
r�||dkr�|
d7}
n||dkr�|
d8}
n|d7}q�W|||!}d}|jdd�}|jdd�}g|jd�D]}|j�^q"}g}x7|D]/}||krG|j	|�|j
|�qGqGWt|�dkrNd|| ddj|�ddj|�||f}|d7}qNqN||fS(Nisimport numpysnumpy.%sis%s%s%ss import numpy.oldnumeric as numpysimport numpy as ([A-Za-z0-9_]+)s%s.%ssimport numpy as %ssimport numpy.oldnumeric as %ssfrom numpy import *sfrom numpy.oldnumeric import *sfrom numpy imports\s
R!RR&s
%s%s
%s
%ssfrom numpy import %ss, sfrom numpy.oldnumeric import %s(tfindR,tretcompiletfindallR+treplacetsplittstriptremovetappendtjoin(R-tnamestnumt	importstrtindtfoundR.tind2timportretmodulestmoduleRtptrR9tsubstrtxtimportnamestaddnames((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pyt_import_changevs�






 


	


(



cCs�d}|s|x0tD](}t||d�\}}||7}qWx0tD](}t||d�\}}||7}qFW||fSt|tt�\}}||fSdS(Nisaxis=-1saxis=0(t_funcm1R;t_func0RT(R-t
import_changettotalR.RG((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pytadd_axis�s


cCs*t|d�}|j|�|j�dS(Ntw(tfiletwritetclose(R.tfilestrtfid((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pytmakenewfile�s
cCs&t|�}|j�}|j�|S(N(R[treadR](R.R_R^((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pytgetfile�s
cCs-tjj|�\}}t|d|�dS(Ns.orig(tostpathtsplitextR`(R.R-tbasetext((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pytcopyfile�scCsdt|�}t||�\}}|dkr`dG|GHt||�t||�tjj�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
    is	Changing N(RbRYRhR`tsyststdouttflush(tfilenameRWR^tnewstrRX((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pyR�s	

cCs|d}t|�dS(Ni(R(targsRl((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pytfromargs
s
cCs@tjtjj|d��}x|D]}t||�q%WdS(s�Convert all .py files in the directory given

    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.
    s*.pyN(tglobRcRdRER(tdirecRWtfilestafile((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pyRs
cCst|d|�dS(NRW(R(targtdirnametfnames((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pyt_funcscCstjj|t|�dS(s-Convert all .py files in the tree given

    N(RcRdtwalkRw(RqRW((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pyRst__main__(#t__doc__t__all__RiRcR=RpR'RURVt_allR(R.t_astrR>tstringt	uppercaset	lowercasetdigitsR+R;RTtFalseRYR`RbRhRRoRdtcurdirRRwRt__name__targv(((sG/usr/lib64/python2.7/site-packages/numpy/oldnumeric/fix_default_axis.pyt<module>#s>


	8	g