NineSec Team Shell
Server IP : 184.107.3.203  /  Your IP : 216.73.216.51
Web Server : Apache
System : Linux dedicated2.avenfashion.com.ph 4.18.0-553.40.1.el8_10.x86_64 #1 SMP Mon Feb 10 12:11:18 EST 2025 x86_64
User : adminteladeoro ( 1015)
PHP Version : 8.2.28
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/lib/python3.6/site-packages/sos/__pycache__/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/lib/python3.6/site-packages/sos/__pycache__/options.cpython-36.pyc
3

~�g�2�@sXddlmZddlmZdd�Zdd�ZGdd�d�ZGd	d
�d
e�ZGdd�d�Zd
S)�)�Action)�ConfigParsercCst|�}|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_seq
sr
cCs$|j�}|d	krdS|d
kr dSdS)N�true�on�yesT�false�off�noF)rrr
)rrr)�lower)rZ_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)rrrr	�_unset sz%SoSOptions._merge_opt.<locals>._unset)�hasattr�getattr�_nondefaultr
�setattr�discard�add)�self�opt�src�
is_defaultrZnewvalueZoldvaluerrr	�
_merge_opts


zSoSOptions._merge_optcCs4t|t�st|�}x|jD]}|j|||�qWdS)N)�
isinstance�dict�vars�	arg_namesr )rrr�argrrr	�_merge_opts7s
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>Lsz$SoSOptions.__str.<locals>.<listcomp>cSs"g|]}t|�rdj|�n|�qS)�,)r
�join)r(�vrrr	r)OscSs&g|]}t|t�rd|�d�n|�qS)�')r!�str)r(r,rrr	r)Rs)r$�stripr)	r�quote�sep�prefix�suffix�argsZarg_fmtr%�valsr)rr	Z__str=s	
zSoSOptions.__strcCs|j�S)N)�_SoSOptions__str)rrrr	�__str__VszSoSOptions.__str__cCs|jddddd�S)NTz, zSoSOptions(�))r0r1r2r3)r6)rrrr	�__repr__Ys
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�items�append)rr:�kwargsr%Zkwargrrr	�__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&)�clsr4r:Zoptsrrr	�	from_argsus	zSoSOptions.from_argscsRd}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--csg|]}d����qS)z--r)r(�d)rrr	r)�sz+SoSOptions._opt_to_args.<locals>.<listcomp>r�=)rCrDrErFrGrHrIrJrKrLrMrNrOrP)rQ)�range�int)rArrZno_value�countr)rr	�_opt_to_args�szSoSOptions._opt_to_argscCs�t|j|t|��r|St|j|t�r6t|jd��St|j|t�rpt|�}|dkrltd|�d|�d���|St|j|t�r�t|�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
        r*Nz
Value of 'z' in z# must be True or False or analagous)	r!r:rr�split�boolr�	ExceptionrU)r�keyrZconfrrr	�_convert_to_type�s
zSoSOptions._convert_to_typec	s���fdd�}t�}y(t�dd��}|j|��WdQRXWn<tk
rx}z td��d|jd���WYdd}~XnX|d	|�|||�|jd
�r�t�d�r�t�d�r�x>|jd
�D]0\}}|j	d
�d�j
kr��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|�|||<qLWxn|j�D]b\}}t|t	�r�|d	kr�|jd
d�}|�j
kr�td|�d
|�d��q��j||��}t
�||�q�WdS)NrQ�	verbosityZlabel�plugoptsZprofiles)�nameZ
plugin_optionZprofile�-�_�keywordsr'rzUnknown option 'z' in section 'r-)�has_sectionr"r=r;rU�popr�replacer!r.r:�printr\r)Zsection�config�odictZrename_optsr[r)�config_filerrr	�_update_from_section�s(

z9SoSOptions.update_from_conf.<locals>._update_from_sectionzutf-8)�encodingNz+WARNING: Unable to read configuration file z : ��globalZplugin_optionsr^�skip_plugins�.rrS)
r�openZ	read_file�OSErrorrfr4rcrr=rXrnr^r>)	rriZ	componentrjrg�f�er[rr)rirr	�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 )rrZ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)rvrwrxry)r$r)rZ
preset_filterrhr%�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 ``sos report`` 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~rr�)r:r.)r_rzZnull_values)rrr	�	has_values
z%SoSOptions.to_args.<locals>.has_valuecs*|dkrdS|dkr |d	kr d
S�||�S)
z8 Filter out preset and null-valued options.
            rvrwrxryF�log_size�plugin_timeout�cmd_timeoutrT)rvrwrxry)r�r�r�r)r_rz)r�rr	�
filter_opt!sz&SoSOptions.to_args.<locals>.filter_optcSs||jd�rdt|�d}|S|jdd�}t|�r<dj|�n|}|dk	rX|�d|��}n|}t|�dkrpd	|nd|}|S)
zD Convert sos option notation to command line arguments.
            r]r`r,rar*Tr'rlz--)�
startswithrUrer
r+�len)r_rzr%rrrr	�argify,s
z"SoSOptions.to_args.<locals>.argifycSs|dS)Nrr)�xrrr	�<lambda>@sz$SoSOptions.to_args.<locals>.<lambda>)r[cs$g|]\}}�||�r�||��qSrr)r(�nr,)r�r�rr	r)Asz&SoSOptions.to_args.<locals>.<listcomp>)�sortedr"r=)rZ	opt_itemsr)r�r�r�rr	�to_argss
	
zSoSOptions.to_argsN)Fr'rr)T)T)�__name__�
__module__�__qualname__r r&r6r7r9r@�classmethodrBrWr\rtrur"r�rrrr	rs
>

rc@seZdZdZddd�ZdS)�
SosListOptionz0Allow to specify comma delimited list of pluginsNcCs<t|jd��}t||j�r*|t||j�7}t||j|�dS)Nr*)rrXr�destr)r�parser�	namespace�valuesZ
option_stringr=rrr	�__call__HszSosListOption.__call__)N)r�r�r��__doc__r�rrrr	r�Dsr�c@seZdZdZddd�ZdS)�
ClusterOptionz6Used to store/manipulate options for cluster profiles.NcCs"||_||_||_||_||_dS)N)r_rz�opt_type�cluster�description)rr_rzr�r�r�rrr	r@Rs
zClusterOption.__init__)N)r�r�r�r�r@rrrr	r�Osr�N)	�argparserZconfigparserrr
rrr�r�rrrr	�<module>	s	)

NineSec Team - 2022