Your IP : 3.145.35.234


Current Path : /usr/lib64/python2.7/Demo/pdist/
Upload File :
Current File : //usr/lib64/python2.7/Demo/pdist/FSProxy.pyc

�
��^c@s�dZddlZddlZddlZddlZddlZddlTddlZddlZdZej	ej
fZdd
d��YZdeej
fd��YZd	ejfd
��YZd�Zedkr�e�ndS(s�File System Proxy.

Provide an OS-neutral view on a file system, locally or remotely.
The functionality is geared towards implementing some sort of
rdist-like utility between a Mac and a UNIX system.

The module defines three classes:

FSProxyLocal  -- used for local access
FSProxyServer -- used on the server side of remote access
FSProxyClient -- used on the client side of remote access

The remote classes are instantiated with an IP address and an optional
verbosity flag.
i����N(t*i�tFSProxyLocalcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd+d�Zd+d�Zd+d
�Zd+d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd+d�Zd+d�Zd+d�Zd+d�Zd+d�Z d�Z!d+d�Z"d+d �Z#d+d!�Z$d+d"�Z%d+d#�Z&d$d%d&�Z'd'�Z(d$d(�Z)d)�Z*d*�Z+RS(,cCs#g|_dg|j�|_dS(Ns*.pyc(t	_dirstackt_readignoret_ignore(tself((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt__init__!s	cCsx|jr|j�qWdS(N(Rtback(R((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt_close%scCs�|jd�}yt|�}WnEtk
rf|jd�}yt|�}Wqgtk
rbgSXnXg}xD|j�}|s�Pn|ddkr�|d }n|j|�qpW|j�|S(Ntignoressynctree.ignorefilesi����s
(t_hidetopentIOErrortreadlinetappendtclose(RtfiletfR	tline((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR)s&

	

cCs|ddkS(Nit.((Rtname((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt_hidden<scCsd|S(Ns.%s((RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR
?scCs�t|�tkrdS|ddkr*dS|tkr:dS|j|�rMdStjj|�\}}|sr|rvdStjj|�r�dSdt|d�j	d�kr�dSx'|j
D]}tj||�r�dSq�WdS(Nii����t~strbii(tlent
maxnamelent	skipnamesRtostpathtsplittislinkRtreadRtfnmatch(RRtheadttailtign((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytvisibleBs&
cCs,|j|�s(tjdt|��ndS(Nsprotected name %s(R$Rterrortrepr(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytcheckOscCs<|j|�tjj|�s8tjdt|��ndS(Nsnot a plain file %s(R'RRtisfileR%R&(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt	checkfileSs
cCs
tj�S(N(Rtgetcwd(R((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytpwdXscCsY|j|�tj�|jf}tj|�|jj|�|j|j�|_dS(N(R'RR*RtchdirRRR(RRtsave((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytcd[s


cCsO|jstjd�n|jd\}}tj|�|jd=||_dS(Nsempty directory stacki����(RRR%R,R(RtdirR	((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRbs	

cCsD|r$|d�}t||�}nt|j|�}|j�|S(NcSstj||�S(N(R (Rtpat((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytkeepls(tfilterR$tsort(RtfilesR0R1((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt_filterjs
cCs"tjtj�}|j||�S(N(RtlistdirtcurdirR5(RR0R4((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytlistsscCs7tjtj�}ttjj|�}|j||�S(N(RR6R7R2RR(R5(RR0R4((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt	listfileswscCs7tjtj�}ttjj|�}|j||�S(N(RR6R7R2RtisdirR5(RR0R4((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytlistsubdirs|scCs|j|�otjj|�S(N(R$RRtexists(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR<�scCs|j|�otjj|�S(N(R$RRR:(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR:�scCs|j|�otjj|�S(N(R$RRR(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR�scCs|j|�otjj|�S(N(R$RRR((RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR(�scCsb|j|�d}t|�}tj�}x*|j|�}|sGPn|j|�q.W|j�S(Niii (R)Rtmd5tnewRtupdatetdigest(RRt
BUFFERSIZERtsumtbuffer((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRB�s
cCs|j|�tj|�tS(N(R)RtstattST_SIZE(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytsize�s
cCs'|j|�tjtj|�t�S(N(R)ttimet	localtimeRRDtST_MTIME(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytmtime�s
cCsF|j|�tj|�t}tjtj|�t�}||fS(N(R)RRDRERGRHRI(RRRFRJ((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRD�s
cCsK|j|�}tj|�t}tjtj|�t�}|||fS(N(RBRRDRERGRHRI(RRRBRFRJ((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytinfo�scCs�|dkr|j�}ng}x[|D]S}y|j|||�f�Wq(tjtfk
rz|j|df�q(Xq(W|S(N(tNoneR9RRR%R(RtfunctionR8tresR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt_list�s
cCs|j|j|�S(N(RORB(RR8((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytsumlist�scCs|j|j|�S(N(RORD(RR8((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytstatlist�scCs|j|j|�S(N(RORJ(RR8((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt	mtimelist�scCs|j|j|�S(N(RORF(RR8((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytsizelist�scCs|j|j|�S(N(RORK(RR8((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytinfolist�scCsg|dkr|j�}ni}x?|D]7}y||�||<Wq(tjtfk
r^q(Xq(W|S(N(RLR9RR%R(RRMR8tdictR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt_dict�s
cCs|j|j|�S(N(RURB(RR8((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytsumdict�scCs|j|j|�S(N(RURF(RR8((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytsizedict�scCs|j|j|�S(N(RURJ(RR8((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt	mtimedict�scCs|j|j|�S(N(RURD(RR8((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytstatdict�scCs|j|j|�S(N(RVRK(RR8((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytinfodict�sii����cCss|j|�t|�}|j|�|dkr;d}n*|dkrV|j�}n|j|�}|j�|S(Nit(R)RtseekRR(RRtoffsettlengthRtdata((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR�s

	
cCs�|j|�tjj|�rq|j|�|d}ytj|�Wntjk
r]nXtj||�nt|d�}|j	�dS(NRtw(
R'RRR<R)tunlinkR%trenameRR(RRtbnameR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytcreate�s


cCsD|j|�t|d�}|j|�|j|�|j�dS(Nsr+(R)RR]twriteR(RRR`R^R((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRf�s



cCs!|j|�tj|d�dS(Ni�(R'Rtmkdir(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRgs
cCs|j|�tj|�dS(N(R'Rtrmdir(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRhs
N(,t__name__t
__module__RRRRR
R$R'R)R+R.RRLR5R8R9R;R<R:RR(RBRFRJRDRKRORPRQRRRSRTRVRWRXRYRZR[RReRfRgRh(((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRsR						
																	
	
	t
FSProxyServercBs)eZejd�Zd�Zd�ZRS(cCs'tj|�tjj|||�dS(N(RRtservertServer(Rtaddresstverbose((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR
s
cCs!tjj|�tj|�dS(N(RlRmRR(R((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRscCs.tjj|�x|jr)|j�qWdS(N(RlRmt_serveRR(R((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRps(RiRjRltVERBOSERRRp(((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRks	t
FSProxyClientcBseZejd�ZRS(cCstjj|||�dS(N(tclienttClientR(RRnRo((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRs(RiRjRsRqR(((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRrscCsdddl}ddl}|jdr>|j|jd�}nd}td|f�}|j�dS(Ni����iiR\(tstringtsystargvtatoiRkt_serverloop(RuRvtporttproxy((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyttest!s
t__main__((t__doc__RlRsR=RR RDRGRR7tpardirRRRmRkRtRrR|Ri(((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt<module>s 
�	

?>