Your IP : 3.142.199.54


Current Path : /opt/alt/python310/lib64/python3.10/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/distutils/__pycache__/fancy_getopt.cpython-310.opt-2.pyc

o

6��fxE�@s�	ddlZddlZddlZddlZddlTdZe�de�Ze�deef�Ze	�
dd�ZGdd	�d	�Zd
d�Z
dd
�ejD�Zdd�Zdd�ZGdd�d�ZedkrmdZdD]Zede�ed�eee���e�qWdSdS)�N)�*z[a-zA-Z](?:[a-zA-Z0-9-]*)z^%s$z^(%s)=!(%s)$�-�_c@s�eZdZ	ddd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zddd�Z
dd�Zddd�Zddd�ZdS) �FancyGetoptNcCsN||_i|_|jr
|��i|_i|_g|_g|_i|_i|_i|_	g|_
dS�N)�option_table�option_index�_build_index�alias�negative_alias�
short_opts�	long_opts�
short2long�	attr_name�	takes_arg�option_order��selfr�r�=/opt/alt/python310/lib64/python3.10/distutils/fancy_getopt.py�__init__)s	
zFancyGetopt.__init__cCs(|j��|jD]	}||j|d<qdS)Nr)r�clearr)r�optionrrrr	Qs

�zFancyGetopt._build_indexcCs||_|��dSr)rr	rrrr�set_option_tableVszFancyGetopt.set_option_tablecCs:||jvrtd|��|||f}|j�|�||j|<dS)Nz'option conflict: already an option '%s')r�DistutilsGetoptErrorr�append)r�long_optionZshort_optionZhelp_stringrrrr�
add_optionZs
�
zFancyGetopt.add_optioncCs	||jvSr)r�rrrrr�
has_optioncs
zFancyGetopt.has_optioncCs	|�t�Sr��	translate�
longopt_xlaterrrr�
get_attr_nameh�
zFancyGetopt.get_attr_namecCsN|��D] \}}||jvrtd|||f��||jvr$td|||f��qdS)Nz(invalid %s '%s': option '%s' not definedz0invalid %s '%s': aliased option '%s' not defined)�itemsrr)r�aliasesZwhatr
�optrrr�_check_alias_dictns
�
���zFancyGetopt._check_alias_dictcC�	|�|d�||_dS)Nr
)r(r
)rr
rrr�set_aliasesxs
zFancyGetopt.set_aliasescCr))Nznegative alias)r(r)rrrrr�set_negative_aliases}s
z FancyGetopt.set_negative_aliasescCs�	g|_g|_|j��i|_|jD]�}t|�dkr"|\}}}d}nt|�dkr/|\}}}}ntd|f��t|t	�rAt|�dkrGt
d|��|dus\t|t	�rVt|�dks\t
d|��||j|<|j�|�|d	d
kr|rs|d}|dd	�}d|j|<n!|j
�|�}|dur�|j|r�t
d||f��||jd	<d|j|<|j�|�}|dur�|j||j|kr�t
d
||f��t�|�s�t
d|��|�|�|j|<|r�|j�|�||j|d<qdS)N�r�zinvalid option tuple: %r�z9invalid long option '%s': must be a string of length >= 2�z:invalid short option '%s': must a single character or None����=�:z>invalid negative alias '%s': aliased option '%s' takes a valuezginvalid alias '%s': inconsistent with aliased option '%s' (one of them takes a value, the other doesn'tzEinvalid long option name '%s' (must be letters, numbers, hyphens only)r
rrr�repeatr�len�
ValueError�
isinstance�strrrrr�getr
�
longopt_re�matchr#r)rr�long�short�helpr3Zalias_torrr�_grok_option_table�sv


���

��

��

����zFancyGetopt._grok_option_tablec
CsX	|durtjdd�}|durt�}d}nd}|��d�|j�}zt�|||j�\}}Wntjy?}zt	|��d}~ww|D]a\}}t
|�dkrZ|ddkrZ|j|d}n|dd�}|j�
|�}	|	rj|	}|j|s~|j�
|�}	|	r||	}d}nd}|j|}
|r�|j�
|
�dur�t||
d�d}t||
|�|j�||f�qB|r�||fS|S)Nr/TF� r.rr)�sys�argv�OptionDummyr>�joinr�getoptr
�errorZDistutilsArgErrorr4rr
r8rrrr3�getattr�setattrrr)r�args�objectZcreated_objectrZopts�msgr'�valr
�attrrrrrD�sH
��

zFancyGetopt.getoptcCs	|jdur
td��|jS)Nz!'getopt()' hasn't been called yet)r�RuntimeError)rrrr�get_option_orders
zFancyGetopt.get_option_ordercCsf	d}|jD]&}|d}|d}t|�}|ddkr|d}|dur&|d}||kr,|}q|ddd}d}||}	d|}
|rE|g}nd	g}|jD]e}|dd
�\}}}t||	�}
|ddkrg|dd�}|dur�|
rz|�d|||
df�n&|�d||f�nd
||f}|
r�|�d|||
df�n|�d|�|
dd�D]	}|�|
|�q�qK|S)Nrr/r0r1�r.�Nr?zOption summary:r,z  --%-*s  %sz
  --%-*s  z%s (-%s)z  --%-*s)rr4�	wrap_textr)r�headerZmax_optrr;r<�lZ	opt_widthZ
line_widthZ
text_widthZ
big_indent�linesr=�textZ	opt_namesrrr�
generate_helpsN
�

��zFancyGetopt.generate_helpcCs0|durtj}|�|�D]	}|�|d�qdS)N�
)r@�stdoutrV�write)rrR�file�linerrr�
print_helphs
�zFancyGetopt.print_helpr)NN)�__name__�
__module__�__qualname__rr	rrrr#r(r*r+r>rDrNrVr\rrrrrs 
(
	

M=

OrcCst|�}|�|�|�||�Sr)rr+rD)�optionsZnegative_optrIrH�parserrrr�fancy_getoptos
rbcCsi|]}t|�d�qS)r?)�ord)�.0Z_wscharrrr�
<dictcomp>usrecCs	|durgSt|�|kr|gS|��}|�t�}t�d|�}dd�|D�}g}|r�g}d}|r[t|d�}|||krK|�|d�|d=||}n|rX|dddkrX|d=n|s0|r�|dkrv|�|dd|��|d|d�|d<|dddkr�|d=|�d�|��|s*|S)Nz( +|-+)cSsg|]}|r|�qSrr)rdZchrrr�
<listcomp>�szwrap_text.<locals>.<listcomp>rr0r?�)r4�
expandtabsr!�WS_TRANS�re�splitrrC)rU�widthZchunksrTZcur_lineZcur_lenrSrrrrQws@

��"rQcCs	|�t�Srr )r'rrr�translate_longopt�r$rmc@seZdZ	gfdd�ZdS)rBcCs	|D]}t||d�qdSr)rG)rr`r'rrrr�s�zOptionDummy.__init__N)r]r^r_rrrrrrB�srB�__main__z�Tra-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: %drW)r@�stringrjrDZdistutils.errorsZlongopt_pat�compiler9Zneg_alias_rer7�	maketransr"rrbZ
whitespacerirQrmrBr]rU�w�printrCrrrr�<module>s0
T6�

?>