Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/sos/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/sos/__pycache__/options.cpython-310.pyc
o

i��d,5�@sdddlmZddlmZmZmZmZdd�Zdd�ZGdd�d�Z	Gd	d
�d
e�Z
Gdd�d�Zd
S)�)�Action)�ConfigParser�ParsingError�Error�DuplicateOptionErrorcCst|�}|tup|tuS)z@Return true if val is an instance of a known sequence type.
    )�type�list�tuple)�val�val_type�r�-/usr/lib/python3/dist-packages/sos/options.py�_is_seqsrcCs$|��}|dvr
dS|dvrdSdS)N)�true�on�yesT)�false�off�noF)�lower)r
�_valrrr
�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||�rLt||�}t||�}||�r||�r&|s&||jvr>t|�s>t|||�|r6|j�|�dS|j�|�dSt|�rNt||||�dSdSdS)NcSs|dkp|duS)N�r)r
rrr
�_unset"sz%SoSOptions._merge_opt.<locals>._unset)�hasattr�getattr�_nondefaultr�setattr�discard�add)�self�opt�src�
is_defaultr�newvalue�oldvaluerrr
�
_merge_opt!s 


��zSoSOptions._merge_optcCs0t|t�s	t|�}|jD]	}|�|||�qdS�N)�
isinstance�dict�vars�	arg_namesr')r!r#r$�argrrr
�_merge_opts9s


�zSoSOptions._merge_optsF� rc	sz|}d}�jD]
}||||7}q|�|��fdd��jD�}|s+dd�|D�}ndd�|D�}|t|��|�|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-�r!rr
�
<listcomp>Nsz$SoSOptions.__str.<locals>.<listcomp>cSs"g|]
}t|�r
d�|�n|�qS)�,)r�join�r0�vrrr
r2Q�"cSs"g|]
}t|t�r
d|n|�qS)z'%s')r)�strr5rrr
r2Tr7)r,�stripr	)	r!�quote�sep�prefix�suffix�args�arg_fmtr-�valsrr1r
�__str?s	

zSoSOptions.__strcCs|��Sr(��_SoSOptions__strr1rrr
�__str__XszSoSOptions.__str__cCs|jddddd�S)NTz, zSoSOptions(�))r:r;r<r=rBr1rrr
�__repr__[s
�zSoSOptions.__repr__cKsh||_t|���|_t�|_|jD]}t|||j|�q|��D]}|j�|�t||||�q!dS)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)r!rG�kwargsr-rrr
�__init___s

�zSoSOptions.__init__cCs*tdit|��d|i��}|�|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
        rGTNr)rr+r.)�clsr>rG�optsrrr
�	from_argsws	zSoSOptions.from_argscsPd}d}�|vr
d�gS�|vr�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).
        )�
alloptionszallow-system-changeszall-logs�batch�build�debug�experimentalzlist-pluginszlist-presetsz
list-profilesz	no-reportzno-env-vars�quiet�verify)�verbose�--%scsg|]}d��qS)rXr)r0�d�r"rr
r2�sz+SoSOptions._opt_to_args.<locals>.<listcomp>r�--�=)�range�int)rMr"r
�no_value�countrrZr
�_opt_to_args�s
zSoSOptions._opt_to_argscCs�t|j|t|��r|St|j|t�rdd�|�d�D�St|j|t�r8t|�}|dur6td||f��|St|j|t�rUzt|�WSt	yTtd||f��w|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
        cS�g|]}|�qSrrr5rrr
r2��z/SoSOptions._convert_to_type.<locals>.<listcomp>r3Nz6Value of '%s' in %s must be True or False or analagousz#Value of '%s' in %s must be integer)
r)rGrr�split�boolr�	Exceptionr^�
ValueError)r!�keyr
�confrrr
�_convert_to_type�s,
��
��zSoSOptions._convert_to_typec

sL��fdd�}t�}zDzt���}|�|��Wd�n1s!wYWn%ty>}ztd|j|j�f��d}~wttfyLtd���wWnt	t
fym}ztd�|jdf�WYd}~nd}~ww|d|�|||�|�
d	�r�t�d
�r�|�d	�D]\}}	|�d�d�jvr��j�|d
|	�q�dSdSdS)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�|�|�rwt|�|��}d|��vrt|�d��|d<dddd�}t|�D]}d|vr6|�|�||�dd�<||vrC|�|�|||<q%|��D]0\}}t|t	�r[|d	kr[|�d
d�}|�j
vritd||f�qH��||��}t
�||�qHdSdS)
NrW�	verbosity�label�plugopts�profiles)�name�
plugin_option�profile�-�_�keywordsr/rz#Unknown option '%s' in section '%s')�has_sectionr*�itemsrHr^�popr�replacer)r8rG�printrjr)�section�config�odict�rename_optsrhr
��config_filer!rr
�_update_from_section�s4
��
��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��global�plugin_optionsrm�.rr\)r�open�	read_filer�exit�optionrzrr�OSError�IOErrorryr>rurrvrd�skip_pluginsrmrJ)
r!r�	componentr�r{�f�err�erhr
rr~r
�update_from_conf�sH	#
�����������

��zSoSOptions.update_from_confTcCs<|jD]}t||�sqt||�dus|s|�||d�qdS)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')r!r#�skip_defaultr-rrr
�merge�s
	
��zSoSOptions.mergecCs6i}|jD]}t||�}|r|dvrd}|||<q|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!�
preset_filterr|r-�valuerrr
r*s


zSoSOptions.dictcsL�fdd���fdd��dd��t�����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"]``

        csLd}|r||vr
dS|dkr|rdS|�jvr$t|�t�j|�kr$dSdS)z. Test for non-null option values.
            )�False�Nonez[]z""z''�0FrmT)rGr8)ror��null_valuesr1rr
�	has_value!s
z%SoSOptions.to_args.<locals>.has_valuecs*|dvrdS|dvr|dkrdS�||�S)z8 Filter out preset and null-valued options.
            r�F)�log_size�plugin_timeout�cmd_timeoutrTr)ror�)r�rr
�
filter_opt.s
z&SoSOptions.to_args.<locals>.filter_optcSs~|�d�rdt|�d}|S|�dd�}t|�rd�|�n|}|dur+d||f}n|}t|�dkr9d	|}|Sd|}|S)
zD Convert sos option notation to command line arguments.
            rkrrr6rsr3Tz%s %sr�r[)�
startswithr^rxrr4�len)ror�r-r"rrr
�argify9s
�z"SoSOptions.to_args.<locals>.argifycSs|dS)Nrr)�xrrr
�<lambda>Msz$SoSOptions.to_args.<locals>.<lambda>)rhcs$g|]\}}�||�r�||��qSrr)r0�nr6)r�r�rr
r2Ns$z&SoSOptions.to_args.<locals>.<listcomp>)�sortedr*rv)r!�	opt_itemsr)r�r�r�r!r
�to_argss
	
zSoSOptions.to_argsN)Fr/rr)T)�__name__�
__module__�__qualname__r'r.rCrDrFrL�classmethodrOrarjr�r�r*r�rrrr
rs 


D
rc@�eZdZdZddd�ZdS)�
SosListOptionz0Allow to specify comma delimited list of pluginsNcCsBdd�|�d�D�}t||j�r|t||j�7}t||j|�dS)NcSrbrr)r0r"rrr
r2Vrcz*SosListOption.__call__.<locals>.<listcomp>r3)rdr�destr)r!�parser�	namespace�values�
option_stringrvrrr
�__call__UszSosListOption.__call__r()r�r�r��__doc__r�rrrr
r�Qsr�c@r�)�
ClusterOptionz6Used to store/manipulate options for cluster profiles.NcCs"||_||_||_||_||_dSr()ror��opt_type�cluster�description)r!ror�r�r�r�rrr
rL_s

zClusterOption.__init__r()r�r�r�r�rLrrrr
r�\sr�N)�argparser�configparserrrrrrrrr�r�rrrr
�<module>s
4

Spamworldpro Mini