
    g                         S  r \ " 5         \" \" 5       R                  5       5       H-  r\R                  5       (       d  M  \4S jr\\" 5       S\-  '   M/     CCS rS rSS jr	SS.S jr
SS.S	 jrS
 rg)c                      [        5       n [        S5       H-  u  pSU-  X'   SU-  U SU-   '   SU-  U SU-   '   SU-  U SU-   '   M/     [        U S	'   [        U S
'   SU S'   SU S'   g )N)BLACKREDGREENYELLOWBLUEMAGENTACYANWHITEz[1;3%dmz[3%dmDARK_z[1;4%dmREV_z[4%dm	REV_DARK_PURPLEGREYz[0mC_NORMALz[4m	UNDERLINE)globals	enumerateDARK_MAGENTA
DARK_WHITE)ginames      ./usr/lib/python3/dist-packages/samba/colour.py_gen_ansi_coloursr      s    	A : ;!#'!O'D.(1,&4- +a+
; AhKAfI AjM AkN    c                 6    [        5       U   < U < [        < 3$ )N)r   r   )sr   s     r   _fr   B   s    &y8<<r   zc_%sc                      [        5       n [        U R                  5       5       HO  u  pUR                  5       (       d  M  [	        U[
        5      (       d  M3  UR                  S5      (       d  MK  SX'   MQ     g)z5Convert all the ANSI colour codes into empty strings. N)r   listitemsisupper
isinstancestr
startswith)r   kvs      r   switch_colour_offr*   I   sK    	AQWWY99;;:a--!,,v2F2FAD  r   c                      [        5         g)z%Regenerate all the ANSI colour codes.N)r    r   r   switch_colour_onr-   Q   s    r   c                 N    U(       a  SOSnU(       a  SOSnSX4[        U 5      4-  $ )Nz01;r!   4838z[%s%s;5;%dm)int)nbgboldweighttargets        r   xterm_256_colourr7   V   s(    UFTTFA777r   auto)hintc                    U S;   a  gU S;   a  gU S;  a  [        SU  S35      eSS	KJn  UR                  S
5      (       a  gU HG  n[	        U[
        5      (       a  US:w  a    gSSKnUR                  nUR                  5       (       a  MG    g   g)a  The hint is presumably a --color argument.

The streams to be considered can be file objects or file names,
with '-' being a special filename indicating stdout.

We follow the behaviour of GNU `ls` in what we accept.
* `git` is stricter, accepting only {always,never,auto}.
* `grep` is looser, accepting mixed case variants.
* historically we have used {yes,no,auto}.
* {always,never,auto} appears the commonest convention.
* if the caller tries to opt out of choosing and sets hint to None
  or '', we assume 'auto'.
)nonevernoneF)yesalwaysforceT)r8   ttyzif-ttyNr!   zunexpected colour hint: z; try always|never|auto    )environNO_COLOR-N)	
ValueErrorosrC   getr%   r&   sysstdoutisatty)r9   streamsrC   streamrI   s        r   is_colour_wantedrN   ]   s     &&))663D6 :1 1 2 	2 {{:fc"" }ZZF}}  r   c                 V    [        USU 06nU(       a  [        5         U$ [        5         U$ )Nr9   )rN   r-   r*   )r9   rL   wanteds      r   colour_if_wantedrQ      s.    w2T2F M 	Mr   c                    SSK Jn  / n[        U [        5      (       a  U R	                  S5      n [        U[        5      (       a  UR	                  S5      nU R                  SS5      n UR                  SS5      nU" SX5      nUR                  5        H  u  pVpxn	US:X  a  UR                  XU 5        M"  US:X  a  UR                  [        XU 5      5        MF  US	:X  a  UR                  [        XU	 5      5        Mj  US
:X  a:  UR                  [        XU 5      5        UR                  [        XU	 5      5        M  UR                  SU S35        M     SR                  U5      $ )zGenerate a string comparing two strings or byte sequences, with
differences coloured to indicate what changed.

Byte sequences are printed as hex pairs separated by colons.
rB   )SequenceMatcher: u   ␠Nequaldeleteinsertreplacez --unknown diff op z!-- r!   )difflibrS   r%   byteshexrY   get_opcodesappendc_REDc_GREENjoin)
abrS   outr   opalarblbrs
             r   
colourdiffrj      s)    (
C!UEE#J!UEE#J			#uA			#uAa#Ammo=JJqRy!8^JJuQ2Y'(8^JJwqRy)*9_JJuQ2Y'(JJwqRy)*JJ,RD56 . 773<r   N)FF)r   r"   r   keys_kr$   r   r*   r-   r7   rN   rQ   rj   r,   r   r   <module>rm      s   :(   wy~~
 B	zz|| 	=!#	&2+	 ! 
8 %+ )X %+ r   