Current File : //lib/python2.7/site-packages/sos/__init__.pyc
�
u��ec.@s�dZddlZddlZddlmZejrVddlmZmZm	Z	nddlmZmZm	Z	dZ
dZdZej
ee�d�ZeZd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6g.Zid7d6d7d6d8d6d7d(6d9d56d7d46Zd:�Zd;efd<��YZdS(=su
This module houses the i18n setup and message function. The default is to use
gettext to internationalize messages.
i����N(tArgumentParser(tConfigParsertParsingErrortErrors3.9s/usr/share/localetsoscCstjt|�S(N(tgettexttdgettexttgettext_app(tmsg((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt_default$st
add_presett
alloptionstallow_system_changestall_logstbatchtbuildtcase_idtchroottcompression_typetconfig_filetdesctdebugt
del_presettdry_runt
enablepluginstencrypt_keytencrypt_passtexperimentaltlabeltlist_pluginstlist_presetst
list_profilestlog_sizet	nopluginstnoreporttno_env_varstno_postproctnotetonlypluginstplugin_timeouttplugoptstpresettprofilestquiettsincetsysroottthreadsttmp_dirtuploadt
upload_urltupload_directorytupload_usertupload_passtupload_protocolt	verbositytverifytautoiicCs"t|�}|tkp!|tkS(s@Return true if val is an instance of a known sequence type.
    (ttypetlistttuple(tvaltval_type((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt_is_seqMst
SoSOptionscBs�eZd�Zd�Zedddd�Zd�Zd�Zd�Ze	d��Z
e	d	��Ze	ed
��Z
ed�Zd�Zd
�ZRS(c	Cs�d�}t||�r�t||�}t||�}||�rO||�sq|sq||jkr�t|�r�t|||�|r�|jj|�q�|jj|�q�t|�r�t||||�q�ndS(NcSs|dkp|dkS(Nt(tNone(R<((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt_unsetWs(thasattrtgetattrt_nondefaultR>tsetattrtdiscardtadd(tselftopttsrct
is_defaultRBtnewvaluetoldvalue((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt
_merge_optVs	cCs(x!tD]}|j|||�qWdS(N(t
_arg_namesRO(RIRKRLtarg((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt_merge_optsns
t R@cCs�|}d}x tD]}||||7}qW|j|�gtD]}t||�^qC}|s�g|D]'}	t|	�r�dj|	�n|	^qk}n8d�}
g|D]"}	|
|	�r�d|	n|	^q�}|t|�j|�|S(sIFormat a SoSOptions object as a human or machine readable string.

            :param quote: quote option values
            :param sep: list separator string
            :param prefix: arbitrary prefix string
            :param suffix: arbitrary suffix string
            :param literal: print values as Python literals
        s=%st,cSst|tj�S(N(t
isinstancetsixtstring_types(R<((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt	is_string�ss'%s'(RPtstripRDR>tjoinR;(RItquotetseptprefixtsuffixtargstarg_fmtRQtvalstvRX((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt__strrs	

"7	/cCs
|j�S(N(t_SoSOptions__str(RI((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt__str__�sc	Cs"|jdtdddddd�S(NR[R\s, R]sSoSOptions(R^t)(RdtTrue(RI((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt__repr__�scKsd|_t|_t|_d|_t|_t|_d|_t	d|_
t	d|_d|_t|_
d|_d|_t|_g|_d|_d|_t|_d|_t|_t|_t|_t	d|_g|_t|_t|_t|_t|_d|_g|_ d|_!g|_"t	d|_#g|_$t|_%d|_&d|_'d|_(t|_)d|_*d|_+d|_,d|_-d|_.t	d|_/t	d	|_0t|_1t2�|_3xG|j4�D]9}|t5kr�t6d
|��nt7||||�q�WdS(s�Initialise a new ``SoSOptions`` object from keyword arguments.

            Initialises the new object with values taken from keyword
            arguments matching the names of ``SoSOptions`` attributes.

            A ``ValueError`` is raised is any of the supplied keyword
            arguments does not correspond to a known ``SoSOptions`
            attribute name.

            :param *kwargs: a list of ``SoSOptions`` keyword args.
            :returns: the new ``SoSOptions`` object.
        R@RRR R)iR8R5R6s Unknown SoSOptions attribute: %sN(8R
tFalseRR
RAR,RRRt
_arg_defaultsRRRRRRRRRRRRRRRR R!R"RR#R$R%R&R'R(R)R*R+R-R.R/R0R1R2R3R4t
upload_methodR5R6R7tsetREtkeysRPt
ValueErrorRF(RItkwargsRQ((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt__init__�sh
							

													
									
											

	cCst�}|j|t�|S(sInitialise a new SoSOptions object from a ``Namespace``
            obtained by parsing command line arguments.

            :param args: parsed command line arguments
            :returns: an initialised SoSOptions object
            :returntype: SoSOptions
        (R?RRRg(tclsR_topts((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt	from_args�s		cCsld}d}||kr#d|gS||krYgtdt|��D]}d|^qESd|d|gS(s�Convert a named option and optional value to command line
            argument notation, correctly handling options that take
            no value or that have special representations (e.g. verify
            and verbose).
        Rsallow-system-changessall-logsRRRRslist-pluginsslist-presetss
list-profiless	no-reportsno-env-varsR+R7tverboses--%sis--t=(s
alloptionssallow-system-changessall-logssbatchsbuildsdebugsexperimentalslist-pluginsslist-presetss
list-profiless	no-reportsno-env-varssquietsverify(sverbose(trangetint(RqRJR<tno_valuetcounttd((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt_opt_to_args�s*cCs9t�}t�}yVy&t|��}|j|�WdQXWn)ttfk
rf}td|��nXWn6ttfk
r�}td||j	df��nX|j
d�rg}x6|jd�D]%\}	}
|jtj
|	|
��q�W|j|j|�|�ng|_|jdd�rg|jjg|jdd�jd�D]}|j�^qK�n|jdd�r�g|_|jjg|jdd�jd�D]}|j�^q��n|j
d	�r5g|_xW|jd	�D]C\}	}
|	jd
�d|jkr�|jj|	d|
�q�q�Wn|S(
Ns%Failed to parse configuration file %ss)Unable to read configuration file %s : %sitgeneraltpluginstdisableRTtenablettunablest.iRu(R?RtopentreadfpRRtexittOSErrortIOErrorR_thas_sectiontitemstextendR{RRt
parse_argsR!t
has_optiontgettsplitRYRR(tappend(Rqt	argparserRRLRrtconfigtftetoptlistRJR<tplugin((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt	from_file�s@			5		5	"cCs\xUtD]M}t||�s"qnt||�dk	s>|r|j||t�qqWdS(sNMerge another set of ``SoSOptions`` into this object.

            Merge two ``SoSOptions`` objects by setting unset or default
            values to their value in the ``src`` object.

            :param src: the ``SoSOptions`` object to copy from
            :param is_default: ``True`` if new default values are to be set.
        N(RPRCRDRARORi(RIRKtskip_defaultRQ((s0/usr/lib/python2.7/site-packages/sos/__init__.pytmerges
	
cCsIi}x<tD]4}t||�}|dkr7d}n|||<q
W|S(s�Return this ``SoSOptions`` option values as a dictionary of
            argument name to value mappings.

            :returns: a name:value dictionary of option values.
        R
RRR%(s
add_presets
del_presetsdescsnoteN(RPRDRA(RItodictRQtvalue((s0/usr/lib/python2.7/site-packages/sos/__init__.pytdict-s
	cswd���fd�}d�}t|j�j�dd��}g|D]*\}}|||�rI|||�^qIS(s�Return command arguments for this object.

            Return a list of the non-default options of this ``SoSOptions``
            object in ``sosreport`` command line argument notation:

                ``["--all-logs", "-vvv"]``

        cSsPd}|s||krtS|tkrLt|�tt|�krLtSntS(s. Test for non-null option values.
            RiRAs[]s""s''t0(sFalsesNones[]s""s''R�(RiRjtstrRg(tnameR�tnull_values((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt	has_valueEscs|dkrtS�||�S(s8 Filter out preset and null-valued options.
            R
RRR%(s
add_presets
del_presetsdescsnote(Ri(R�R�(R�(s0/usr/lib/python2.7/site-packages/sos/__init__.pyt
filter_optPscSs�|jd�r'dt|�d}|S|jdd�}t|�rTdj|�n|}|tk	ryd||f}n|}t|�dkr�d|nd|}|S(	sD Convert sos option notation to command line arguments.
            R6t-Rbt_RTs%s %sis--(t
startswithRwtreplaceR>RZRgtlen(R�R�RQRJ((s0/usr/lib/python2.7/site-packages/sos/__init__.pytargifyWs!&tkeycSs|dS(Ni((tx((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt<lambda>ks(tsortedR�R�(RIR�R�t	opt_itemstnRb((R�s0/usr/lib/python2.7/site-packages/sos/__init__.pytto_args<s
			!(t__name__t
__module__RORRRiRdReRhRptclassmethodRsR{RgR�R�R�R�(((s0/usr/lib/python2.7/site-packages/sos/__init__.pyR?Ts					B
'	(t__doc__RRVtargparseRtPY3tconfigparserRRRt__version__tgettext_dirRtbindtextdomainR	t_sosRPRjR>tobjectR?(((s0/usr/lib/python2.7/site-packages/sos/__init__.pyt<module>s<