404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.133.136.95: ~ $
3

�f,5�@sdddlmZddlmZmZmZmZdd�Zdd�ZGdd�d�Z	Gd	d
�d
e�Z
Gdd�d�Zd
S)�)�Action)�ConfigParser�ParsingError�Error�DuplicateOptionErrorcCst|�}|tkp|tkS)z@Return true if val is an instance of a known sequence type.
    )�type�list�tuple)�valZval_type�r�/usr/lib/python3.6/options.py�_is_seqsr
cCs(|j�}|d	krdS|d
kr dSdSdS)N�true�on�yesT�false�off�noF)rrr)rrr)�lower)r
Z_valrrr�str_to_boolsrc@s�eZdZdd�Zdd�Zd dd	�Zd
d�Zdd
�Zifdd�Ze	ifdd��Z
e	dd��Zdd�Zdd�Z
d!dd�Zd"dd�Zdd�ZdS)#�
SoSOptionscCs�dd�}t||�r�t||�}t||�}||�r8||�sP|sP||jkr|t|�r|t|||�|rn|jj|�q�|jj|�nt|�r�t||||�dS)NcSs|dkp|dkS)N�r)r
rrr�_unset"sz%SoSOptions._merge_opt.<locals>._unset)�hasattr�getattr�_nondefaultr
�setattr�discard�add)�self�opt�src�
is_defaultrZnewvalueZoldvaluerrr�
_merge_opt!s


zSoSOptions._merge_optcCs4t|t�st|�}x|jD]}|j|||�qWdS)N)�
isinstance�dict�vars�	arg_namesr#)rr!r"�argrrr�_merge_opts9s
zSoSOptions._merge_optsF� rc	s~|}d}x�jD]}||||7}qW|j|��fdd��jD�}|sZdd�|D�}ndd�|D�}|t|�j|�|S)aIFormat 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
        z=%scsg|]}t�|��qSr)r)�.0r()rrr�
<listcomp>Nsz$SoSOptions.__str.<locals>.<listcomp>cSs"g|]}t|�rdj|�n|�qS)�,)r
�join)r+�vrrrr,QscSs"g|]}t|t�rd|n|�qS)z'%s')r$�str)r+r/rrrr,Ts)r'�stripr	)	r�quote�sep�prefix�suffix�argsZarg_fmtr(�valsr)rrZ__str?s	
zSoSOptions.__strcCs|j�S)N)�_SoSOptions__str)rrrr�__str__XszSoSOptions.__str__cCs|jddddd�S)NTz, zSoSOptions(�))r2r3r4r5)r8)rrrr�__repr__[s
zSoSOptions.__repr__cKsp||_t|j��|_t�|_x |jD]}t|||j|�q$Wx,|j�D] }|jj|�t||||�qHWdS)a�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.
        N)�arg_defaultsr�keysr'�setrr�append)rr<�kwargsr(rrr�__init___s
zSoSOptions.__init__cCs&tft|�d|i��}|j|d�|S)aInitialise 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<T)rr&r))�clsr6r<Zoptsrrr�	from_argsws	zSoSOptions.from_argscsPd}d}�|krd�gS�|kr>�fdd�tdt|��D�Sd�d|gS)z�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).
        �
alloptions�allow-system-changes�all-logs�batch�build�debug�experimental�list-plugins�list-presets�
list-profiles�	no-report�no-env-vars�quiet�verify�verbosez--%scsg|]}d��qS)z--%sr)r+�d)r rrr,�sz+SoSOptions._opt_to_args.<locals>.<listcomp>rz--�=)rDrErFrGrHrIrJrKrLrMrNrOrPrQ)rR)�range�int)rBr r
Zno_value�countr)r r�_opt_to_args�s
zSoSOptions._opt_to_argscCs�t|j|t|��r|St|j|t�r<dd�|jd�D�St|j|t�rrt|�}|dkrntd||f��n|St|j|t�r�yt|�St	k
r�td||f��YnX|S)a�Ensure that the value read from a config file is the proper type
        for consumption by the component, as defined by arg_defaults.

        Params:
            :param key:         The key in arg_defaults we need to match the
                                type of
            :param val:         The value to be converted to a particular type
            :param conf:        File values are being loaded from
        cSsg|]}|�qSrr)r+r/rrrr,�sz/SoSOptions._convert_to_type.<locals>.<listcomp>r-Nz6Value of '%s' in %s must be True or False or analagousz#Value of '%s' in %s must be integer)
r$r<rr�split�boolr�	ExceptionrV�
ValueError)r�keyr
Zconfrrr�_convert_to_type�s$
zSoSOptions._convert_to_typec
sH��fdd�}t�}y�y$t���}|j|��WdQRXWnZtk
rr}ztd|j|j�f��WYdd}~Xn$ttfk
r�td���YnXWn<t	t
fk
r�}ztd�|jdf�WYdd}~XnX|d|�|||�|j
d	�o�t�d
��rDxB|jd	�D]4\}}	|jd�d�jk�r�jj|d
|	��qWdS)z�Read the provided config_file and update options from that.

        Positional arguments:

            :param config_file:             Filepath to the config file
            :param component:               Which component (section) to load
        cs�|j|�r�t|j|��}d|j�kr6t|jd��|d<dddd�}xHt|�D]<}d|krn|j|�||jdd�<||krL|j|�|||<qLWxh|j�D]\\}}t|t	�r�|d	kr�|jd
d�}|�j
kr�td||f�q��j||��}t
�||�q�WdS)
NrR�	verbosityZlabel�plugoptsZprofiles)�nameZ
plugin_optionZprofile�-�_�keywordsr*rz#Unknown option '%s' in section '%s')�has_sectionr%�itemsr=rV�popr�replacer$r0r<�printr^r)�section�config�odictZrename_optsr]r
)�config_filerrr�_update_from_section�s*

z9SoSOptions.update_from_conf.<locals>._update_from_sectionNz0Duplicate option '%s' in section '%s' in file %sz%Failed to parse configuration file %sz2WARNING: Unable to read configuration file %s : %s��globalZplugin_optionsr`�.rrT)r�openZ	read_filer�exitZoptionrjrr�OSError�IOErrorrir6rerrfrYZskip_pluginsr`r?)
rrmZ	componentrnrk�f�err�er]r
r)rmrr�update_from_conf�s,	#
"$

zSoSOptions.update_from_confTcCsBx<|jD]2}t||�sqt||�dk	s,|r|j||d�qWdS)aNMerge 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.
        NF)r'rrr#)rr!Zskip_defaultr(rrr�merge�s
	
zSoSOptions.mergecCs:i}x0|jD]&}t||�}|r*|dkr*d}|||<qW|S)z�Return this ``SoSOptions`` option values as a dictionary of
            argument name to value mappings.

            :returns: a name:value dictionary of option values.
        �
add_preset�
del_preset�desc�noteN)r{r|r}r~)r'r)rZ
preset_filterrlr(�valuerrrr%s
zSoSOptions.dictcsL�fdd���fdd��dd��t�j�j�dd�d	�}��fd
d�|D�S)z�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"]``

        csNd
}|s||krdS|dkr&|r&d	S|�jkrJt|�t�j|�krJdSd	S)z. Test for non-null option values.
            �False�None�[]�""�''�0Fr`T)r�r�r�r�r�r�)r<r0)rarZnull_values)rrr�	has_value!s
z%SoSOptions.to_args.<locals>.has_valuecs*|dkrdS|dkr |d	kr d
S�||�S)
z8 Filter out preset and null-valued options.
            r{r|r}r~F�log_size�plugin_timeout�cmd_timeoutrT)r{r|r}r~)r�r�r�r)rar)r�rr�
filter_opt.sz&SoSOptions.to_args.<locals>.filter_optcSsz|jd�rdt|�d}|S|jdd�}t|�r<dj|�n|}|dk	rVd||f}n|}t|�dkrnd	|nd|}|S)
zD Convert sos option notation to command line arguments.
            r_rbr/rcr-Tz%s %sroz--)�
startswithrVrhr
r.�len)rarr(r rrr�argify9s
z"SoSOptions.to_args.<locals>.argifycSs|dS)Nrr)�xrrr�<lambda>Msz$SoSOptions.to_args.<locals>.<lambda>)r]cs$g|]\}}�||�r�||��qSrr)r+�nr/)r�r�rrr,Nsz&SoSOptions.to_args.<locals>.<listcomp>)�sortedr%rf)rZ	opt_itemsr)r�r�r�rr�to_argss
	
zSoSOptions.to_argsN)Fr*rr)T)T)�__name__�
__module__�__qualname__r#r)r8r9r;rA�classmethodrCrXr^ryrzr%r�rrrrrs
D

rc@seZdZdZddd�ZdS)�
SosListOptionz0Allow to specify comma delimited list of pluginsNcCsBdd�|jd�D�}t||j�r0|t||j�7}t||j|�dS)NcSsg|]}|�qSrr)r+r rrrr,Vsz*SosListOption.__call__.<locals>.<listcomp>r-)rYr�destr)r�parser�	namespace�valuesZ
option_stringrfrrr�__call__UszSosListOption.__call__)N)r�r�r��__doc__r�rrrrr�Qsr�c@seZdZdZddd�ZdS)�
ClusterOptionz6Used to store/manipulate options for cluster profiles.NcCs"||_||_||_||_||_dS)N)rar�opt_type�cluster�description)rrarr�r�r�rrrrA_s
zClusterOption.__init__)N)r�r�r�r�rArrrrr�\sr�N)�argparserZconfigparserrrrrr
rrr�r�rrrr�<module>	s
4

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 5.04 KB 0644
__init__.cpython-36.pyc File 5.04 KB 0644
archive.cpython-36.opt-1.pyc File 22.42 KB 0644
archive.cpython-36.pyc File 22.42 KB 0644
component.cpython-36.opt-1.pyc File 14.84 KB 0644
component.cpython-36.pyc File 14.84 KB 0644
missing.cpython-36.opt-1.pyc File 2.68 KB 0644
missing.cpython-36.pyc File 2.68 KB 0644
options.cpython-36.opt-1.pyc File 11.79 KB 0644
options.cpython-36.pyc File 11.79 KB 0644
utilities.cpython-36.opt-1.pyc File 18.3 KB 0644
utilities.cpython-36.pyc File 18.3 KB 0644