
    ,hE              	         d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl	m
Z
 ddlmZmZ dZ ej                  d	e d
      Z ej                  de de d      Zej'                  dd      Z G d d      ZddZej.                  D  ci c]  }  e|       d c} Zd Zd Z G d d      Zedk(  r:dZdD ]2  Z e de         e djC                   eee                    e         4 yyc c} w )a6  distutils.fancy_getopt

Wrapper around the standard getopt module that provides the following
additional features:
  * short and long options are tied together
  * options have help strings, so fancy_getopt could potentially
    create a complete usage summary
  * options set attributes of a passed-in object
    )annotationsN)Sequence)Any   )DistutilsArgErrorDistutilsGetoptErrorz[a-zA-Z](?:[a-zA-Z0-9-]*)^$z^(z)=!(z)$-_c                  p    e Zd ZdZddZd Zd ZddZd Zd Z	d	 Z
d
 Zd Zd ZdddZd ZddZddZy)FancyGetopta  Wrapper around the standard 'getopt()' module that provides some
    handy extra functionality:
      * short and long options are tied together
      * options have help strings, and help text can be assembled
        from them
      * options set attributes of a passed-in object
      * boolean options can have "negative aliases" -- eg. if
        --quiet is the "negative alias" of --verbose, then "--quiet"
        on the command line sets 'verbose' to false
    Nc                    || _         i | _        | j                   r| j                          i | _        i | _        g | _        g | _        i | _        i | _        i | _	        g | _
        y N)option_tableoption_index_build_indexaliasnegative_alias
short_opts	long_opts
short2long	attr_name	takes_argoption_orderselfr   s     d/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/setuptools/_distutils/fancy_getopt.py__init__zFancyGetopt.__init__1   sm     )  
 ! 
     c                ~    | j                   j                          | j                  D ]  }|| j                   |d   <    y )Nr   )r   clearr   )r   options     r   r   zFancyGetopt._build_indexY   s=    !'' 	2F+1DfQi(	2r    c                2    || _         | j                          y r   )r   r   r   s     r   set_option_tablezFancyGetopt.set_option_table^   s    (r    c                    || j                   v rt        d| d      |||f}| j                  j                  |       || j                   |<   y )Nz$option conflict: already an option '')r   r   r   append)r   long_optionshort_optionhelp_stringr#   s        r   
add_optionzFancyGetopt.add_optionb   s[    $+++&6{m1E  "<=F$$V,-3Dk*r    c                    || j                   v S )zcReturn true if the option table for this parser has an
        option with long name 'long_option'.)r   r   r)   s     r   
has_optionzFancyGetopt.has_optionl   s     d////r    c                ,    |j                  t              S )zTranslate long option name 'long_option' to the form it
        has as an attribute of some object: ie., translate hyphens
        to underscores.	translatelongopt_xlater.   s     r   get_attr_namezFancyGetopt.get_attr_nameq   s     $$]33r    c           
         t        |t              sJ |j                         D ]K  \  }}|| j                  vrt	        d| d| d| d      || j                  vs8t	        d| d| d| d       y )Nzinvalid z 'z': option 'z' not defined': aliased option ')
isinstancedictitemsr   r   )r   aliaseswhatr   opts        r   _check_alias_dictzFancyGetopt._check_alias_dictw   s    '4((!--/ 	JE3D---*tfBug[}M  $+++*tfBug-@]S 	r    c                6    | j                  |d       || _        y)z'Set the aliases for this option parser.r   N)r=   r   )r   r   s     r   set_aliaseszFancyGetopt.set_aliases   s    ug.
r    c                6    | j                  |d       || _        y)zSet the negative aliases for this option parser.
        'negative_alias' should be a dictionary mapping option names to
        option names, both the key and value must already be defined
        in the option table.znegative aliasN)r=   r   )r   r   s     r   set_negative_aliasesz FancyGetopt.set_negative_aliases   s    
 	~/?@,r    c                   g | _         g | _        | j                  j                          i | _        | j
                  D ]  }t        |      dk(  r	|\  }}}d}n$t        |      dk(  r|\  }}}}nt        d|      t        |t              rt        |      dk  rt        d| d      |-t        |t              rt        |      d	k(  st        d
| d      || j                  |<   | j                   j                  |       |d   dk(  r|r|dz   }|dd }d| j                  |<   n\| j                  j                  |      }|0| j                  |   rt        d| d| d      || j                   d<   d| j                  |<   | j                  j                  |      }|1| j                  |   | j                  |   k7  rt        d| d| d      t         j#                  |      st        d| d      | j%                  |      | j&                  |<   |s| j                  j                  |       || j                  |d   <    y)zPopulate the various data structures that keep tabs on the
        option table.  Called by 'getopt()' before it can do anything
        worthwhile.
           r      zinvalid option tuple:    zinvalid long option 'z"': must be a string of length >= 2Nr   zinvalid short option 'z"': must a single character or None=:Tzinvalid negative alias 'r6   z' takes a valueFzinvalid alias 'z%': inconsistent with aliased option 'z/' (one of them takes a value, the other doesn'tzinvalid long option name 'z)' (must be letters, numbers, hyphens only)r   r   r   r"   repeatr   len
ValueErrorr7   strr   r(   r   r   getr   
longopt_rematchr4   r   )r   r#   longshorthelprI   alias_tos          r   _grok_option_tablezFancyGetopt._grok_option_table   s~   
 '' D	1F6{a$*!eTV!,2)eT6 !#9&!DEE dC(CIM*+D61ST  ]
5#(>3u:QR?*,UG3UV  !'DKKNN!!$'Bx3!CKEAbz'+t$  ..2248'~~h/26tf =//7jI 
 *.DNN2&',t$ zz~~d+H#>>$'4>>(+CC.)$ 0++3* 5,,  ##D)*0 7> > 
 $(#5#5d#;DNN4 &&u-,0a)ID	1r    c                v   |t         j                  dd }|t               }d}nd}| j                          dj	                  | j
                        }	 t        j                  ||| j                        \  }}|D ]  \  }}t        |      dk(  r|d   dk(  r| j                  |d      }nt        |      dkD  r|dd d	k(  sJ |dd }| j                  j                  |      }	|	r|	}| j                  |   s0|d
k(  sJ d       | j                  j                  |      }	|	r|	}d}nd}| j                   |   }
|r+| j"                  j                  |
      t%        ||
d      dz   }t'        ||
|       | j(                  j+                  ||f        |r||fS |S # t        j                  $ r}t        |      d}~ww xY w)a  Parse command-line options in args. Store as attributes on object.

        If 'args' is None or not supplied, uses 'sys.argv[1:]'.  If
        'object' is None or not supplied, creates a new OptionDummy
        object, stores option values there, and returns a tuple (args,
        object).  If 'object' is supplied, it is modified in place and
        'getopt()' just returns 'args'; in both cases, the returned
        'args' is a modified copy of the passed-in 'args' list, which
        is left untouched.
        Nr   TF rE   r   r   z-- zboolean option can't have value)sysargvOptionDummyrT   joinr   getoptr   errorr   rJ   r   r   rM   r   r   r   rI   getattrsetattrr   r(   )r   argsobjectcreated_objectr   optsmsgr<   valr   attrs              r   r\   zFancyGetopt.getopt   s    <88AB<D> ]F!N"N!XXdoo.
	)tZHJD$  	1HC3x1}Q3ooc!f-3x!|BQ47!"gJJNN3'E>>#&byC"CC++//4CCC>>#&D t{{t,8fdA.2FD#&$$c3Z05	1: <KG || 	)#C((	)s   $F F8(F33F8c                H    | j                   t        d      | j                   S )zReturns the list of (option, value) tuples processed by the
        previous run of 'getopt()'.  Raises RuntimeError if
        'getopt()' hasn't been called yet.
        z!'getopt()' hasn't been called yet)r   RuntimeError)r   s    r   get_option_orderzFancyGetopt.get_option_order  s(    
 $BCC$$$r    c                r   d}| j                   D ]3  }|d   }|d   }t        |      }|d   dk(  r|dz
  }||dz   }||kD  s2|}5 |dz   dz   dz   }d}||z
  }	d	|z  }
|r|g}nd
g}| j                   D ]  }|dd \  }}}t        ||	      }|d   dk(  r|dd }|<|r |j                  d|d| dd|d           n]|j                  d|d| d       nC| d| d}|r |j                  d|d| dd|d           n|j                  d|d| d       |dd D ]  }|j                  |
|z            |S )zGenerate help text (a list of strings, one per suggested line of
        output) from the option table for this FancyGetopt object.
        r   r   rF   rG   N   rE   N   rV   zOption summary:rC   z  --<rW   z  z (-))r   rJ   	wrap_textr(   )r   headermax_optr#   rP   rQ   ell	opt_width
line_width
text_width
big_indentlinesrR   text	opt_namess                  r   generate_helpzFancyGetopt.generate_help'  s    '' 		F!9D1IEd)CBx3Ag AgW}		 aK!Oa'	0 
)+
9_
HE&'E'' 	/F &r
D%T:.DBx3Abz }LL4QwipK'847)!DELL4QwipK'8!9:
  $fCwa0	LL4	!G9@'=RQy!IJLL4	!G9@'=!>?ABx /Z#-./-	/0 r    c                |    |t         j                  }| j                  |      D ]  }|j                  |dz           y )N
)rX   stdoutrz   write)r   rp   filelines       r   
print_helpzFancyGetopt.print_helpu  s:    <::D&&v. 	$DJJtd{#	$r    r   )NNr`   zSequence[str] | None)__name__
__module____qualname____doc__r   r   r%   r,   r/   r4   r=   r?   rA   rT   r\   ri   rz   r    r    r   r   r   %   sS    	&P2
40
4

-N1`;z%L\$r    r   c                ^    t        |       }|j                  |       |j                  ||      S r   )r   rA   r\   )optionsnegative_optra   r`   parsers        r   fancy_getoptr   |  s+    !F
-==v&&r    rV   c                *   | g S t        |       |k  r| gS | j                         } | j                  t              } t	        j
                  d|       }|D cg c]  }|s|	 }}g }|rg }d}|rGt        |d         }||z   |k  r|j                  |d          |d= ||z   }n|r|d   d   dk(  r|d= n|rG|r5|dk(  r"|j                  |d   d|        |d   |d |d<   |d   d   dk(  r|d= |j                  dj                  |             |r|S c c}w )zwrap_text(text : string, width : int) -> [string]

    Split 'text' into multiple lines of no more than 'width' characters
    each, and return the list of strings that results.
    Nz( +|-+)r   rF   rV   rW   )rJ   
expandtabsr2   WS_TRANSresplitr(   r[   )rx   widthchunkschrw   cur_linecur_lenrr   s           r   ro   ro     sN    |	
4yEv??D>>(#DXXj$'F!(RRb(F(E
fQi.C}%q	*1I!C- Q3 6    !|q	!E 23"1Ief-q	
 ay|s"1I 	RWWX&'A D LK )s   DDc                ,    | j                  t              S )zXConvert a long option name to a valid Python identifier by
    changing "-" to "_".
    r1   )r<   s    r   translate_longoptr     s     ==''r    c                      e Zd ZdZg fddZy)rZ   z_Dummy class just used as a place to hold command-line option
    values as instance attributes.c                ,    |D ]  }t        | |d        y)zkCreate a new OptionDummy instance.  The attributes listed in
        'options' will be initialized to None.N)r_   )r   r   r<   s      r   r   zOptionDummy.__init__  s      	%CD#t$	%r    N)r   zSequence[Any])r   r   r   r   r   r   r    r   rZ   rZ     s    & 13 %r    rZ   __main__zTra-la-la, supercalifragilisticexpialidocious.
How *do* you spell that odd word, anyways?
(Someone ask Mary -- she'll know [or she'll
say, "How should I know?"].))
         (   zwidth: r|   r   )"r   
__future__r   r\   r   stringrX   collections.abcr   typingr   errorsr   r   longopt_patcompilerN   neg_alias_rerL   	maketransr3   r   r   
whitespaceordr   ro   r   rZ   r   rx   wprintr[   )_wschars   0r   <module>r      s   #  	  
 $  ; +RZZ1[M+,
 rzzB{m4}B?@ c3'T$ T$n
' .4->->?'CL#?3l(% % z D  smdii	$*+, W @s   C/