7Re c @ sΐ d d l Z d d l Z d d l m Z m Z m Z m Z d d l m Z m Z m
Z
d d l m Z d Z e d k r e Z n d d Z Gd d d e Z Gd
d d e Z d S( i Ni ( u AnsiForeu AnsiBacku AnsiStyleu Style( u WinTermu WinColoru WinStyle( u windllc C s t | d o | j S( Nu isatty( u hasattru isatty( u stream( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu is_a_tty s u is_a_ttyc B s> | Ee Z d Z d Z d d Z d d Z d d Z d S( u
StreamWrapperu΄
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.
c C s | | _ | | _ d S( N( u _StreamWrapper__wrappedu _StreamWrapper__convertor( u selfu wrappedu converter( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu __init__ s u StreamWrapper.__init__c C s t | j | S( N( u getattru _StreamWrapper__wrapped( u selfu name( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu __getattr__ s u StreamWrapper.__getattr__c C s | j j | d S( N( u _StreamWrapper__convertoru write( u selfu text( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu write" s u StreamWrapper.writeN( u __name__u
__module__u __qualname__u __doc__u __init__u __getattr__u write( u
__locals__( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu
StreamWrapper s u
StreamWrapperc B sͺ | Ee Z d Z d Z e j d Z d d d d d Z d d Z
d d Z d d
Z d d Z
d
d Z d d Z d d Z d d Z d d Z d S( u AnsiToWin32uΎ
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.
u \[((?:\d|;)*)([a-zA-Z])c C s¦ | | _ | | _ t | | | _ t j j d } | d k rK | } n | | _ | d k ru | oo t | } n | | _
| j | _ | j t j
k | _ d S( Nu win( u wrappedu autoresetu
StreamWrapperu streamu sysu platformu
startswithu Noneu stripu is_a_ttyu convertu get_win32_callsu win32_callsu stderru on_stderr( u selfu wrappedu convertu stripu autoresetu
on_windows( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu __init__. s u AnsiToWin32.__init__c C s | j p | j p | j S( uj
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()
( u convertu stripu autoreset( u self( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu should_wrapK s u AnsiToWin32.should_wrapc C sι | j rεt rεi t j f t j 6t j t j f t j 6t j t j f t j 6t j t j f t j 6t j
t j f t
j 6t j
t j f t
j 6t j
t j f t
j 6t j
t j f t
j 6t j
t j f t
j 6t j
t j f t
j 6t j
t j f t
j 6t j
t j f t
j 6t j
f t
j 6t j t j f t j 6t j t j f t j 6t j t j f t j 6t j t j f t j 6t j t j f t j 6t j t j f t j 6t j t j f t j 6t j t j f t j 6t j f t j 6Sd S( N( u convertu wintermu reset_allu AnsiStyleu RESET_ALLu styleu WinStyleu BRIGHTu NORMALu DIMu foreu WinColoru BLACKu AnsiForeu REDu GREENu YELLOWu BLUEu MAGENTAu CYANu GREYu WHITEu RESETu backu AnsiBack( u self( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu get_win32_callsV s0 u AnsiToWin32.get_win32_callsc C sY | j s | j r" | j | n | j j | | j j | j rU | j n d S( N( u stripu convertu write_and_convertu wrappedu writeu flushu autoresetu reset_all( u selfu text( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu writer s
u AnsiToWin32.writec C sR | j r | j d d n2 | j j rN t | j rN | j j t j n d S( Nu mi ( i ( u convertu
call_win32u wrappedu closedu is_a_ttyu writeu Styleu RESET_ALL( u self( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu reset_all| s u AnsiToWin32.reset_allc C s~ d } xX | j j | D]D } | j \ } } | j | | | | j | j | } q W| j | | t | d S( uͺ
Write the given text to our wrapped stream, stripping any ANSI
sequences from the text, and optionally converting them into win32
calls.
i N( u ANSI_REu finditeru spanu write_plain_textu convert_ansiu groupsu len( u selfu textu cursoru matchu startu end( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu write_and_convert s
u AnsiToWin32.write_and_convertc C s: | | k r6 | j j | | |
| j j n d S( N( u wrappedu writeu flush( u selfu textu startu end( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu write_plain_text s u AnsiToWin32.write_plain_textc C s/ | j r+ | j | } | j | | n d S( N( u convertu extract_paramsu
call_win32( u selfu paramstringu commandu params( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu convert_ansi s u AnsiToWin32.convert_ansic C s d d } t | | S( Nc s s8 x1 | j d D] } | d k r t | Vq q Wd S( Nu ;u ( u splitu int( u paramstringu p( ( u9 /tmp/pip-zej_zi-build/pip/_vendor/colorama/ansitowin32.pyu split s u) AnsiToWin32.extract_params.