Viewing File: /opt/alt/python35/lib64/python3.5/distutils/__pycache__/fancy_getopt.cpython-35.opt-2.pyc



й¼]xEã@sBddlZddlZddlZddlZddlTdZejdeƒZejdeefƒZe	j
ddƒZGdd	„d	ƒZd
d„Z
dd
„ejDƒZdd„Zdd„ZGdd„dƒZedkr>dZxKddddfD]7ZedeƒedjeeeƒƒƒeƒqWdS)éN)Ú*z[a-zA-Z](?:[a-zA-Z0-9-]*)z^%s$z^(%s)=!(%s)$ú-Ú_c@sÐeZdZddd„Zdd„Zdd„Zdddd	„Zd
d„Zdd
„Zdd„Z	dd„Z
dd„Zdd„Zdddd„Z
dd„Zddd„Zdddd„ZdS)ÚFancyGetoptNcCsq||_i|_|jr%|jƒ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ú1/opt/alt/python35/lib64/python3.5/fancy_getopt.pyÚ__init__)s				
							zFancyGetopt.__init__cCs6|jjƒx"|jD]}||j|d<qWdS)Nr)rÚclearr)rÚoptionrrrrQs
zFancyGetopt._build_indexcCs||_|jƒdS)N)rr)rrrrrÚset_option_tableVs	zFancyGetopt.set_option_tablecCsR||jkr"td|ƒ‚n,|||f}|jj|ƒ||j|<dS)Nz'option conflict: already an option '%s')rÚDistutilsGetoptErrorrÚappend)rÚlong_optionZshort_optionZhelp_stringrrrrÚ
add_optionZszFancyGetopt.add_optioncCs
||jkS)N)r)rrrrrÚ
has_optioncszFancyGetopt.has_optioncCs
|jtƒS)N)Ú	translateÚ
longopt_xlate)rrrrrÚ
get_attr_namehszFancyGetopt.get_attr_namecCsqxj|jƒD]\\}}||jkrAtd|||fƒ‚||jkr
td|||fƒ‚q
WdS)Nz(invalid %s '%s': option '%s' not definedz0invalid %s '%s': aliased option '%s' not defined)Úitemsrr)rÚaliasesZwhatr	ÚoptrrrÚ_check_alias_dictnszFancyGetopt._check_alias_dictcCs|j|dƒ||_dS)Nr	)r#r	)rr	rrrÚset_aliasesxszFancyGetopt.set_aliasescCs|j|dƒ||_dS)Nznegative alias)r#r
)rr
rrrÚset_negative_aliases}sz FancyGetopt.set_negative_aliasescCsug|_g|_|jjƒi|_xF|jD];}t|ƒdkrb|\}}}d}n:t|ƒdkr‰|\}}}}ntd|fƒ‚t|t	ƒs¾t|ƒdkrÎt
d|ƒ‚|dkpøt|t	ƒoøt|ƒdkst
d|ƒ‚||j|<|jj|ƒ|dd	krh|rH|d
}|dd…}d|j|<n[|j
j|ƒ}|dk	r¶|j|r©t
d||fƒ‚||jd<d|j|<|jj|ƒ}|dk	r|j||j|krt
d||fƒ‚tj|ƒs0t
d
|ƒ‚|j|ƒ|j|<|r2|jj|ƒ||j|d<q2WdS)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,)rrr
rÚrepeatrÚlenÚ
ValueErrorÚ
isinstanceÚstrrrrr
Úgetr	Ú
longopt_reÚmatchrr)rrÚlongÚshortÚhelpr-Zalias_torrrÚ_grok_option_table…s^		
		"
!






zFancyGetopt._grok_option_tablecCsì|dkrtjdd…}|dkr=tƒ}d}nd}|jƒdj|jƒ}y"tj|||jƒ\}}Wn4tjk
r·}zt	|ƒ‚WYdd}~XnXx|D]\}}t
|ƒdkr|ddkr|j|d}n|dd…}|jj
|ƒ}	|	r/|	}|j|si|jj
|ƒ}	|	rc|	}d}nd}|j|}
|rª|jj
|
ƒdk	rªt||
dƒd}t||
|ƒ|jj||fƒq¿W|rä||fS|SdS)Nr)TFú r(rr)ÚsysÚargvÚOptionDummyr8ÚjoinrÚgetoptrÚerrorZDistutilsArgErrorr.r
r	r2rr
rr-ÚgetattrÚsetattrrr)rÚargsÚobjectZcreated_objectrZoptsÚmsgr"Úvalr	Úattrrrrr>ÒsB		
""
	

zFancyGetopt.getoptcCs)|jdkrtdƒ‚n|jSdS)Nz!'getopt()' hasn't been called yet)rÚRuntimeError)rrrrÚget_option_orderszFancyGetopt.get_option_ordercCsäd}xs|jD]h}|d}|d}t|ƒ}|ddkrP|d}|dk	rf|d}||kr|}qW|ddd}d}||}	d|}
|rº|g}n	dg}x|jD]}|dd	…\}}}t||	ƒ}
|ddkr|dd…}|dkrh|
rN|jd
|||
dfƒq°|jd||fƒnHd||f}|
rŸ|jd
|||
dfƒn|jd
|ƒx)|
dd…D]}|j|
|ƒqÁWqÍW|S)Nrr)r*ér(éNr9zOption summary:r&z  --%-*s  %sz
  --%-*s  z%s (-%s)z  --%-*sr,r,r,)rr.Ú	wrap_textr)rÚheaderZmax_optrr5r6ÚlZ	opt_widthZ
line_widthÚ
text_widthZ
big_indentÚlinesr7ÚtextZ	opt_namesrrrÚ
generate_helpsF






	!	zFancyGetopt.generate_helpcCsD|dkrtj}x(|j|ƒD]}|j|dƒq%WdS)NÚ
)r:ÚstdoutrQÚwrite)rrLÚfileÚlinerrrÚ
print_helphs	zFancyGetopt.print_help)Ú__name__Ú
__module__Ú__qualname__rrrrrrr#r$r%r8r>rHrQrWrrrrrs(	
M=
OrcCs)t|ƒ}|j|ƒ|j||ƒS)N)rr%r>)ÚoptionsZnegative_optrCrBÚparserrrrÚfancy_getoptos
r]cCsi|]}dt|ƒ“qS)r9)Úord)Ú.0Z_wscharrrrú
<dictcomp>us	r`cCsv|dkrgSt|ƒ|kr)|gS|jƒ}|jtƒ}tjd|ƒ}dd„|Dƒ}g}x|rqg}d}xq|r÷t|dƒ}|||krÒ|j|dƒ|d=||}q‡|ró|dddkró|d	=Pq‡W|rX|dkr=|j|dd|…ƒ|d|d…|d<|dddkrX|d=|jdj|ƒƒqrW|S)
Nz( +|-+)cSsg|]}|r|‘qSrr)r_Zchrrrú
<listcomp>…s	zwrap_text.<locals>.<listcomp>rr)r9Úr,r,)r.Ú
expandtabsrÚWS_TRANSÚreÚsplitrr=)rPÚwidthÚchunksrOÚcur_lineÚcur_lenrMrrrrKws:		
rKcCs
|jtƒS)N)rr)r"rrrÚtranslate_longopt­srkc@seZdZgdd„ZdS)r<cCs%x|D]}t||dƒqWdS)N)rA)rr[r"rrrr¸s
zOptionDummy.__init__N)rXrYrZrrrrrr<´sr<Ú__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: %drR)r:Ústringrer>Zdistutils.errorsZlongopt_patÚcompiler3Zneg_alias_rer1Ú	maketransrrr]Ú
whitespacerdrKrkr<rXrPÚwÚprintr=rrrrÚ<module>s&$
ÿS6
Back to Directory File Manager