ó =OXc@s’dZddlZddlZddlZddlmZd„Zdefd„ƒYZdefd„ƒYZ d efd „ƒYZ d „Z dS( s Abstraction of a one-way pipe where the read end can be used in `select.select`. Normally this is trivial, but Windows makes it nearly impossible. The pipe acts like an Event, which can be set or cleared. When set, the pipe will trigger as readable in `select `. iÿÿÿÿN(tbcCs,tjd dkrtƒ}n tƒ}|S(Nitwin(tsystplatformt PosixPipet WindowsPipe(tp((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyt make_pipe"s  RcBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs7tjƒ\|_|_t|_t|_t|_dS(N(tostpipet_rfdt_wfdtFalset_sett_forevert_closed(tself((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyt__init__+s  cCs-tj|jƒtj|jƒt|_dS(N(RtcloseR R tTrueR(R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyR1scCs|jS(N(R (R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pytfileno7scCs7|j s|jrdStj|jdƒt|_dS(Ni(R RRtreadR R (R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pytclear:scCs6|js|jrdSt|_tj|jdƒdS(Nt*(R RRRtwriteR (R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pytset@s cCst|_|jƒdS(N(RRR(R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyt set_foreverFs (t__name__t __module__RRRRRR(((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyR*s      RcBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(s‡ On Windows, only an OS-level "WinSock" may be used in select(), but reads and writes must be to the actual socket object. cCs«tjtjtjƒ}|jdƒ|jdƒtjtjtjƒ|_|jjd|jƒdfƒ|jƒ\|_ }|j ƒt |_ t |_ t |_dS(Ns 127.0.0.1ii(s 127.0.0.1i(tsockettAF_INETt SOCK_STREAMtbindtlistent_rsocktconnectt getsocknametacceptt_wsockRR R RR(Rtservtaddr((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyRPs      cCs'|jjƒ|jjƒt|_dS(N(R"RR&RR(R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyR_s  cCs |jjƒS(N(R"R(R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyRescCs4|j s|jrdS|jjdƒt|_dS(Ni(R RR"trecvR (R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyRhscCs3|js|jrdSt|_|jjdƒdS(NR(R RRR&tsend(R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyRns cCst|_|jƒdS(N(RRR(R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyRts ( RRt__doc__RRRRRR(((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyRKs     tOrPipecBs#eZd„Zd„Zd„ZRS(cCst|_d|_||_dS(N(R R tNonet_partnert_pipe(RR ((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyRzs  cCs)t|_|jjs%|jjƒndS(N(RR R.R/R(R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyRs  cCs)t|_|jjs%|jjƒndS(N(R R R.R/R(R((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyR„s  (RRRRR(((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyR,ys  cCs4t|ƒ}t|ƒ}||_||_||fS(sØ wraps a pipe into two pipe-like objects which are "or"d together to affect the real pipe. if either returned pipe is set, the wrapped pipe is set. when both are cleared, the wrapped pipe is cleared. (R,R.(R tp1tp2((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyt make_or_pipeŠs     ( R+RRRtparamiko.py3compatRRtobjectRRR,R2(((s1/usr/lib/python2.7/site-packages/paramiko/pipe.pyts    !.