https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
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

-�_g�2�@sXddlmZddlmZdd�Zdd�ZGdd�d�ZGd	d
�d
e�ZGdd�d�Zd
S)�)�Action)�ConfigParsercCst|�}|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_seq
srcCs$|��}|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	)rr	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_opts 


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


�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*�rr	r
�
<listcomp>L�z$SoSOptions.__str.<locals>.<listcomp>cSs"g|]
}t|�r
d�|�n|�qS)�,)r�join�r-�vr	r	r
r/Os"cSs&g|]}t|t�rd|�d�n|�qS)�')r&�strr3r	r	r
r/Rs&)r)�stripr)	r�quote�sep�prefix�suffix�args�arg_fmtr*�valsr	r.r
�__str=s	

zSoSOptions.__strcCs|��Sr%��_SoSOptions__strr.r	r	r
�__str__VszSoSOptions.__str__cCs|jddddd�S)NTz, zSoSOptions(�))r8r9r:r;r@r.r	r	r
�__repr__Ys
�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�items�append)rrE�kwargsr*�kwargr	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
        rETNr	)rr(r+)�clsr<rE�optsr	r	r
�	from_argsus	zSoSOptions.from_argscsRd}d}�|vrd���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�--csg|]}d����qS)rXr	)r-�d�rr	r
r/�r0z+SoSOptions._opt_to_args.<locals>.<listcomp>r�=)�range�int)rMrr�no_value�countr	rZr
�_opt_to_args�szSoSOptions._opt_to_argscCs�t|j|t|��r|St|j|t�rt|�d��St|j|t�r8t|�}|dur6td|�d|�d���|St|j|t�rDt|�S|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
        r1Nz
Value of 'z' in z# must be True or False or analagous)	r&rErr�split�boolr�	Exceptionr])r�keyr�confr	r	r
�_convert_to_type�s
�zSoSOptions._convert_to_typec	
s��fdd�}t�}zt�dd��}|�|��Wd�n1s"wYWntyG}ztd��d|jd���WYd}~nd}~ww|d	|�|||�|�d
�rzt�d�r||�d
�D]\}}|�	d�d
�j
vry�j�|d|�qadSdSdS)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�|�|�rzt|�|��}d|��vrt|�d��|d<dddd�}t|�D]}d|vr6|�|�||�dd�<||vrC|�|�|||<q%|��D]3\}}t|t	�r[|d	kr[|�d
d�}|�j
vrltd|�d
|�d��qH��||��}t
�||�qHdSdS)NrW�	verbosity�label�plugopts�profiles)�name�
plugin_option�profile�-�_�keywordsr,rzUnknown option 'z' in section 'r5)�has_sectionr'rHrFr]�popr�replacer&r6rE�printrfr)�section�config�odict�rename_optsrdr��config_filerr	r
�_update_from_section�s0
��
�z9SoSOptions.update_from_conf.<locals>._update_from_sectionzutf-8)�encodingNz+WARNING: Unable to read configuration file z : ��global�plugin_optionsri�.rr[)
r�open�	read_file�OSErrorrtr<rqrrHra�skip_pluginsrirI)	rrz�	componentr{rv�f�erdrr	ryr
�update_from_conf�s0	"������

��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$)rr �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_filterrwr*�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 ``sos report`` 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''�0FriT)rEr6)rkr��null_valuesr.r	r
�	has_values
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	)rkr�)r�r	r
�
filter_opt s
z&SoSOptions.to_args.<locals>.filter_optcSs�|�d�rdt|�d}|S|�dd�}t|�rd�|�n|}|dur,|�d|��}n|}t|�dkr:d	|}|Sd|}|S)
zD Convert sos option notation to command line arguments.
            rgrnr4ror1Tr,r}rX)�
startswithr]rsrr2�len)rkr�r*rr	r	r
�argify+s
�z"SoSOptions.to_args.<locals>.argifycSs|dS)Nrr	)�xr	r	r
�<lambda>?sz$SoSOptions.to_args.<locals>.<lambda>)rdcs$g|]\}}�||�r�||��qSr	r	)r-�nr4)r�r�r	r
r/@s$z&SoSOptions.to_args.<locals>.<listcomp>)�sortedr'rH)r�	opt_itemsr	)r�r�r�rr
�to_args
s
	
zSoSOptions.to_argsN)Fr,rr)T)�__name__�
__module__�__qualname__r$r+rArBrDrL�classmethodrOr`rfr�r�r'r�r	r	r	r
rs 


=
rc@�eZdZdZddd�ZdS)�
SosListOptionz0Allow to specify comma delimited list of pluginsNcCs<t|�d��}t||j�r|t||j�7}t||j|�dS)Nr1)rrar�destr)r�parser�	namespace�values�
option_stringrHr	r	r
�__call__GszSosListOption.__call__r%)r�r�r��__doc__r�r	r	r	r
r�Csr�c@r�)�
ClusterOptionz6Used to store/manipulate options for cluster profiles.NcCs"||_||_||_||_||_dSr%)rkr��opt_type�cluster�description)rrkr�r�r�r�r	r	r
rLQs

zClusterOption.__init__r%)r�r�r�r�rLr	r	r	r
r�Nsr�N)	�argparser�configparserrrrrr�r�r	r	r	r
�<module>s	(

https://t.me/RX1948 - 2025