
    Id                         d  Z  e          e e       j                               D ]%  Zej                         sefdZe e       dez  <   ' [[d Zd ZddZ	dddZ
ddd	Zy
)c                      t               } t        d      D ].  \  }}d|z  | |<   d|z  | d|z   <   d|z  | d|z   <   d|z  | d|z   <   0 t        | d	<   t        | d
<   d| d<   d| d<   y )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 : ; 04!#$'!O'D.(1,&4- +a+
0 AhKAfI AjM AkN    c                 0    t               |   | t        S )N)r   r   )sr   s     r   _fr   B   s    &y8<<r   zc_%sc                      t               } t        | j                               D ]>  \  }}|j                         st	        |t
              s(|j                  d      s:d| |<   @ y)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   sL    	AQWWY 199;:a-!,,v2FAaDr   c                      t                y)z%Regenerate all the ANSI colour codes.N)r    r   r   switch_colour_onr-   Q   s    r   c                 <    |rdnd}|rdnd}d||t        |       fz  S )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                     | dv ry| dv ry| dvrt        d      ddlm} |j                  d	      ry|D ];  }t	        |t
              r|d
k7  r yddl}|j                  }|j                         r; y y)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!   z5unexpected colour hint: {hint}; 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 1 2 	2 {{: fc" }ZZF}} r   c                 L    t        |d| i}|rt                |S t                |S )Nr9   )rN   r-   r*   )r9   rL   wanteds      r   colour_if_wantedrQ      s.    w2T2F M 	Mr   N)FF)r   r"   r   keys_kr$   r   r*   r-   r7   rN   rQ   r,   r   r   <module>rT      s}   :(   wy~~
  $B	zz| 	=!#	&2+	$ 
8 %+ )X %+ r   