usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyc000064400000022211147205623210021331 0ustar00 abc@sddlZddlZddlZddlmZmZmZmZddlm Z m Z m Z ddl m Z mZdZe dk re ZndZdZdefd YZd efd YZdS( iNi(tAnsiForetAnsiBackt AnsiStyletStyle(tWinTermtWinColortWinStyle(twindllt winapi_testcCst|d p|jS(Ntclosed(thasattrR (tstream((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pytis_stream_closedscCst|do|jS(Ntisatty(R R (R ((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pytis_a_ttyst StreamWrappercBs)eZdZdZdZdZRS(s Wraps a stream (such as stdout), acting as a transparent proxy for all attribute access apart from method 'write()', which is delegated to our Converter instance. cCs||_||_dS(N(t_StreamWrapper__wrappedt_StreamWrapper__convertor(tselftwrappedt converter((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyt__init__s cCst|j|S(N(tgetattrR(Rtname((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyt __getattr__$scCs|jj|dS(N(Rtwrite(Rttext((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR's(t__name__t __module__t__doc__RRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRs  t AnsiToWin32cBseZdZejdZejdZddedZ dZ dZ dZ dZ dZd Zd Zd Zd Zd ZRS(s Implements a 'write()' method which, on Windows, will strip ANSI character sequences from the text, and if outputting to a tty, will convert them into win32 function calls. s?\[((?:\d|;)*)([a-zA-Z])?s?\]((?:.|;)*?)()?cCs||_||_t|||_tjdk}|o?t}|dkrq|pkt| okt | }n||_ |dkr|ot| ot |}n||_ |j |_ |jtjk|_dS(Ntnt(Rt autoresetRR tosRRtNoneR Rtstriptconverttget_win32_callst win32_callstsyststderrt on_stderr(RRR$R#R t on_windowstconversion_supported((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR4s   #  " cCs|jp|jp|jS(sj True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been requested using kwargs to init() (R$R#R (R((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyt should_wrapUscCs||jrutrui&tjftj6tjtjftj6tjtjftj 6tjtjftj6tj t j ft j 6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj t jft j6tj ft j6tj t j tft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t jtft j6tj t j ft!j 6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj t jft!j6tj ft!j6tj t j tft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6tj t jtft!j6St"S(N(#R$twintermt reset_allRt RESET_ALLtstyleRtBRIGHTtNORMALtDIMtforeRtBLACKRtREDtGREENtYELLOWtBLUEtMAGENTAtCYANtGREYtWHITEtRESETtTruet LIGHTBLACK_EXt LIGHTRED_EXt LIGHTGREEN_EXtLIGHTYELLOW_EXt LIGHTBLUE_EXtLIGHTMAGENTA_EXt LIGHTCYAN_EXt LIGHTWHITE_EXtbackRtdict(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR%_sRcCsY|js|jr"|j|n|jj||jj|jrU|jndS(N(R#R$twrite_and_convertRRtflushR R.(RR((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRs   cCsP|jr|jddn0|j rLt|j rL|jjtjndS(Ntmi(i(R$t call_win32R#R RRRR/(R((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR.s cCsd}|j|}xX|jj|D]D}|j\}}|j||||j|j|}q(W|j||t|dS(s Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls. iN(t convert_osct ANSI_CSI_REtfinditertspantwrite_plain_textt convert_ansitgroupstlen(RRtcursortmatchtstarttend((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRJs cCs7||kr3|jj|||!|jjndS(N(RRRK(RRRXRY((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRRs cCs2|jr.|j||}|j||ndS(N(R$textract_paramsRM(Rt paramstringtcommandtparams((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRSs cCs|dkrQtd|jdD}xt|dkrM|d }q.Wn^td|jdD}t|dkr|dkrd }q|d krd }qn|S( NtHfcss3|])}t|dkr't|ndVqdS(iiN(RUtint(t.0tp((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pys st;iicss-|]#}t|dkrt|VqdS(iN(RUR_(R`Ra((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pys sitJKmtABCD(i(i(i(ttupletsplitRU(RR\R[R]((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRZs     c Cse|dkrrxR|D]X}||jkr|j|}|d}|d}td|j}|||qqWn|dkrtj|dd|jn|dkrtj|dd|jn|dkrtj|d|jnx|dkra|d}id| fd 6d|fd 6|dfd 6| dfd 6|\} } tj| | d|jndS( NRLiiR)tJtKR^RdtAtBtCtD(R&RIR)R-t erase_screent erase_linetset_cursor_positiont cursor_adjust( RR\R]tparamt func_argstfunctargstkwargstntxty((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRMs$          FcCsx|jj|D]~}|j\}}|| ||}|j\}}|dkr|jd}|ddkrtj|dqqqW|S(NsRbit02i(t ANSI_OSC_RERPRQRTRfR-t set_title(RRRWRXRYR[R\R]((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyRNs N(RRRtretcompileRORzR"tFalseRR,R%RR.RJRRRSRZRMRN(((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyR+s! ,      (R|R'R!tansiRRRRR-RRRtwin32RRR"R RtobjectRR(((sD/usr/lib/python2.7/site-packages/pip/_vendor/colorama/ansitowin32.pyts   "