
    vKgE              	          S r SSKrSSKrSSKrSSKrSSKJrJr  SSKJ	r	J
r
  Sr\R                  " S\ S35      r\R                  " S	\ S
\ S35      r\R!                  SS5      r " S S5      rS r\R(                   V s0 sH  n \" U 5      S_M     sn rS rS r " S S5      r\S:X  a<  SrS H3  r\" S\-  5        \" SR=                  \" \\5      5      5        \" 5         M5     ggs  sn f )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
    N)AnySequence   )DistutilsArgErrorDistutilsGetoptErrorz[a-zA-Z](?:[a-zA-Z0-9-]*)^$z^(z)=!(z)$-_c                       \ rS rSrSrSS jrS rS rSS jrS r	S	 r
S
 rS rS rS rSS jrS rSS jrSS jrSrg)FancyGetopt"   a  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                     Xl         0 U l        U R                   (       a  U R                  5         0 U l        0 U l        / U l        / U l        0 U l        0 U l        0 U l	        / U l
        g N)option_tableoption_index_build_indexaliasnegative_alias
short_opts	long_opts
short2long	attr_name	takes_argoption_orderselfr   s     b/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/setuptools/_distutils/fancy_getopt.py__init__FancyGetopt.__init__.   sk     )  
 ! 
     c                     U R                   R                  5         U R                   H  nXR                   US   '   M     g )Nr   )r   clearr   )r   options     r   r   FancyGetopt._build_indexV   s6    !''F+1fQi( (r!   c                 0    Xl         U R                  5         g r   )r   r   r   s     r   set_option_tableFancyGetopt.set_option_table[   s    (r!   c                     XR                   ;   a  [        SU S35      eXU4nU R                  R                  U5        X@R                   U'   g )Nz$option conflict: already an option '')r   r   r   append)r   long_optionshort_optionhelp_stringr$   s        r   
add_optionFancyGetopt.add_option_   sU    +++&6{m1E  "=F$$V,-3k*r!   c                     XR                   ;   $ )z[Return true if the option table for this parser has an
option with long name 'long_option'.)r   r   r,   s     r   
has_optionFancyGetopt.has_optioni   s     ////r!   c                 ,    UR                  [        5      $ )zTranslate long option name 'long_option' to the form it
has as an attribute of some object: ie., translate hyphens
to underscores.	translatelongopt_xlater2   s     r   get_attr_nameFancyGetopt.get_attr_namen   s     $$]33r!   c           
          [        U[        5      (       d   eUR                  5        HM  u  p4X0R                  ;  a  [	        SU SU SU S35      eX@R                  ;  d  M:  [	        SU SU SU S35      e   g )Nzinvalid z 'z': option 'z' not defined': aliased option ')
isinstancedictitemsr   r   )r   aliaseswhatr   opts        r   _check_alias_dictFancyGetopt._check_alias_dictt   s    '4((((!--/JE---*tfBug[}M  +++*tfBug-@]S  *r!   c                 4    U R                  US5        Xl        g)z'Set the aliases for this option parser.r   N)rC   r   )r   r   s     r   set_aliasesFancyGetopt.set_aliases   s    ug.
r!   c                 4    U R                  US5        Xl        g)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)rC   r   )r   r   s     r   set_negative_aliases FancyGetopt.set_negative_aliases   s    
 	~/?@,r!   c                    / U l         / U l        U R                  R                  5         0 U l        U R
                   GH)  n[        U5      S:X  a  Uu  p#nSnO$[        U5      S:X  a  Uu  p#pEO[        SU< 35      e[        U[        5      (       a  [        U5      S:  a  [        SU S35      eUb3  [        U[        5      (       a  [        U5      S	:X  d  [        S
U S35      eXPR                  U'   U R                   R                  U5        US   S:X  a!  U(       a  US-   nUSS nSU R                  U'   OaU R                  R                  U5      nUb4  U R                  U   (       a  [        SU SU S35      eX R                   S'   SU R                  U'   U R                  R                  U5      nUb2  U R                  U   U R                  U   :w  a  [        SU SU S35      e[         R#                  U5      (       d  [        SU S35      eU R%                  U5      U R&                  U'   U(       d  GM  U R                  R                  U5        X R                  US   '   GM,     g)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 'r<   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
ValueErrorr=   strr   r+   r   r   getr   
longopt_rematchr9   r   )r   r$   longshorthelprR   alias_tos          r   _grok_option_tableFancyGetopt._grok_option_table   s|   
 ''F6{a$*!TV!,2)T6 !#9&!DEE dC((CIM*+D61ST  ]
5#(>(>3u:QR?*,UG 46 6 
 !'KKNN!!$'Bx3!CKEAbz'+t$  ..2248'~~h/26tf =//7jI 
 *.NN2&',t$ zz~~d+H#>>$'4>>(+CC.)$ 0++3* 5,,  ##D))*0 7> > 
 $(#5#5d#;DNN4 u&&u-,0a)K (r!   c                    Uc  [         R                  SS nUc  [        5       nSnOSnU R                  5         SR	                  U R
                  5      n [        R                  " XU R                  5      u  pQU GH'  u  px[        U5      S:X  a  US   S:X  a  U R                  US      nO[        U5      S:  a	  USS S	:X  d   eUSS nU R                  R                  U5      n	U	(       a  U	nU R                  U   (       d6  US
:X  d   S5       eU R                  R                  U5      n	U	(       a  U	nSnOSnU R                   U   n
U(       a+  U R"                  R                  U
5      b  [%        X*S5      S-   n['        X*U5        U R(                  R+                  Xx45        GM*     U(       a  X4$ U$ ! [        R                   a  n[        U5      eSnAff = f)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 rN   r   r
   z-- zboolean option can't have value)sysargvOptionDummyr]   joinr   getoptr   errorr   rS   r   r   rV   r   r   r   rR   getattrsetattrr   r+   )r   argsobjectcreated_objectr   optsmsgrB   valr   attrs              r   rf   FancyGetopt.getopt   s    <88AB<D> ]F!N"N!XXdoo.
	)tHJD HC3x1}Q3ooc!f-3x!|BQ477!"gJJNN3'E>>#&byC"CCy++//4CCC>>#&D t{{t,8fA.2F#&$$cZ05 : <KG || 	)#C((	)s   #F2 2GGGc                 J    U R                   c  [        S5      eU R                   $ )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_orderFancyGetopt.get_option_order  s(    
 $BCC$$$r!   c                 t   SnU R                    H7  nUS   nUS   n[        U5      nUS   S:X  a  US-
  nUb  US-   nXb:  d  M5  UnM9     US-   S-   S-   nSnX-
  n	S	U-  n
U(       a  U/nOS
/nU R                    H  nUSS u  pEn[        X5      nUS   S:X  a  USS nUc7  U(       a  UR                  SX$US   4-  5        OSUR                  SX$4-  5        O=U SU S3nU(       a  UR                  SX.US   4-  5        OUR                  SU-  5        USS  H  nUR                  X-   5        M     M     U$ )z|Generate help text (a list of strings, one per suggested line of
output) from the option table for this FancyGetopt object.
r   r   rO   rP   N   rN   N   r`   zOption summary:rL   z  --%-*s  %sz
  --%-*s  z (-)z  --%-*s)r   rS   	wrap_textr+   )r   headermax_optr$   rY   rZ   ell	opt_width
line_width
text_width
big_indentlinesr[   text	opt_namess                  r   generate_helpFancyGetopt.generate_help%  s~    ''F!9D1IEd)CBx3Ag Ag} ( aK!Oa'	0 
+
9_
HE&'E''F &r
DT.DBx3Abz }LL7$q'2J!JKLL!?@
  $fCwa0	LL7tAw2O!OPLLi!78ABxZ-.  - (0 r!   c                     Uc  [         R                  nU R                  U5       H  nUR                  US-   5        M     g )N
)rb   stdoutr   write)r   r{   filelines       r   
print_helpFancyGetopt.print_helps  s5    <::D&&v.DJJtd{# /r!   )r   r   r   r   r   r   r   rR   r   r   r   r   )NN)__name__
__module____qualname____firstlineno____doc__r   r   r'   r/   r3   r9   rC   rF   rI   r]   rf   rt   r   r   __static_attributes__ r!   r   r   r   "   sS    	&P2
40
4

-O1b;z%L\$r!   r   c                 \    [        U 5      nUR                  U5        UR                  X25      $ r   )r   rI   rf   )optionsnegative_optrk   rj   parsers        r   fancy_getoptr   z  s)    !F
-==&&r!   r`   c                    U c  / $ [        U 5      U::  a  U /$ U R                  5       n U R                  [        5      n [        R
                  " SU 5      nU Vs/ sH  o3(       d  M  UPM     nn/ nU(       a  / nSnU(       aR  [        US   5      nXg-   U::  a  UR                  US   5        US	 Xg-   nOU(       a  US   S   S:X  a  US	 O	U(       a  MR  U(       a7  US:X  a"  UR                  US   SU 5        US   US US'   US   S   S:X  a  US	 UR                  SR                  U5      5        U(       a  M  U$ s  snf )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   rO   r`   ra   )rS   
expandtabsr7   WS_TRANSresplitr+   re   )r   widthchunkschr   cur_linecur_lenr}   s           r   rz   rz     sO    |	
4yEv??D>>(#DXXj$'F!(6RRb6F(E
fQi.C}%q	*1I!- Q3 6  f  !|q	!E 23"1Ief-q	
 ay|s"1I 	RWWX&'A &D LK )s   	D<%D<c                 ,    U R                  [        5      $ )zPConvert a long option name to a valid Python identifier by
changing "-" to "_".
r6   )rB   s    r   translate_longoptr     s     ==''r!   c                   2    \ rS rSrSr/ 4S\\   4S jjrSrg)rd   i  z[Dummy class just used as a place to hold command-line option
values as instance attributes.r   c                 .    U H  n[        XS5        M     g)zcCreate a new OptionDummy instance.  The attributes listed in
'options' will be initialized to None.N)ri   )r   r   rB   s      r   r   OptionDummy.__init__  s     CDt$ r!   r   N)	r   r   r   r   r   r   r   r   r   r   r!   r   rd   rd     s!    & 13 % % %r!   rd   __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: %dr   )r   rf   r   stringrb   typingr   r   errorsr   r   longopt_patcompilerW   neg_alias_rerU   	maketransr8   r   r   
whitespaceordr   rz   r   rd   r   r   wprintre   )_wschars   0r   <module>r      s    	  
   ; +ZZ1[M+,
 zzB{m4}B?@ c3'U$ U$p
' .4->->?->'CL#->?3l(% % z D kAodii	$*+,  W @s   C)