HEX
Server: Apache
System: Linux nc-ph-4101.simplemoneygoals.com 5.14.0-503.21.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Jan 12 09:45:05 EST 2025 x86_64
User: dailygoldindex (1004)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/sos/__pycache__/options.cpython-39.pyc
a

\��h�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)�valZval_type�r�//usr/lib/python3.9/site-packages/sos/options.py�_is_seq
sr
cCs$|��}|dvrdS|dvr dSdS)N)�trueZonZyesT)ZfalseZoff�noF)�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||�}||�r6||�rL|sL||jvrxt|�sxt|||�|rj|j�|�q�|j�|�nt|�r�t||||�dS)NcSs|dkp|duS)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_optcCs0t|t�st|�}|jD]}|�|||�qdS�N)�
isinstance�dict�vars�	arg_namesr)rrr�argrrr	�_merge_opts7s

zSoSOptions._merge_optsF� rc	sz|}d}�jD]}||||7}q|�|��fdd��jD�}|sVdd�|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"�rrr	�
<listcomp>L�z$SoSOptions.__str.<locals>.<listcomp>cSs"g|]}t|�rd�|�n|�qS)�,)r
�join�r%�vrrr	r'Or(cSs&g|]}t|t�rd|�d�n|�qS)�')r�strr+rrr	r'Rr()r!�stripr)	r�quote�sep�prefix�suffix�argsZarg_fmtr"Zvalsrr&r	Z__str=s	

zSoSOptions.__strcCs|��Sr��_SoSOptions__strr&rrr	�__str__VszSoSOptions.__str__cCs|jddddd�S)NTz, zSoSOptions(�))r0r1r2r3r5r&rrr	�__repr__Ys
�zSoSOptions.__repr__cKsh||_t|���|_t�|_|jD]}t|||j|�q"|��D] \}}|j�|�t|||�qBdS)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"�kwargrrr	�__init__]s

zSoSOptions.__init__cCs*tfit|��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
        r:T)rr r#)�clsr4r:Zoptsrrr	�	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).
        )Z
alloptionszallow-system-changeszall-logsZbatchZbuild�debugZexperimentalzlist-pluginszlist-presetsz
list-profilesz	no-reportzno-env-vars�quietZverify)�verbose�--csg|]}d����qS)rGr)r%�d�rrr	r'�r(z+SoSOptions._opt_to_args.<locals>.<listcomp>r�=)�range�int)rBrrZno_value�countrrIr	�_opt_to_args�szSoSOptions._opt_to_argscCs�t|j|t|��r|St|j|t�r6t|�d��St|j|t�rpt|�}|durltd|�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)	rr:rr�split�boolr�	ExceptionrL)r�keyrZconfrrr	�_convert_to_type�s
�zSoSOptions._convert_to_typec	
s��fdd�}t�}z<t�dd��}|�|��Wd�n1sD0YWn>ty�}z&td��d|jd���WYd}~n
d}~00|d	|�|||�|�d
�r�t�d�r�t�d�r�|�d
�D]0\}}|�	d
�d�j
vr̈j�|d|�q�dS)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�|�|�r�t|�|��}d|��vr6t|�d��|d<dddd�}t|�D]<}d|vrl|�|�||�dd�<||vrJ|�|�|||<qJ|��D]b\}}t|t	�r�|d	kr�|�d
d�}|�j
vr�td|�d
|�d��q���||��}t
�||�q�dS)NrF�	verbosityZlabel�plugoptsZprofiles)�nameZ
plugin_optionZprofile�-�_�keywordsr$rzUnknown option 'z' in section 'r-)�has_sectionrr=r;rL�popr�replacerr.r:�printrSr)�section�config�odictZrename_optsrRr��config_filerrr	�_update_from_section�s*
�
z9SoSOptions.update_from_conf.<locals>._update_from_sectionzutf-8)�encodingNz+WARNING: Unable to read configuration file z : ��globalZplugin_optionsrU�skip_plugins�.rrJ)
r�openZ	read_file�OSErrorr]r4rZrr=rOrgrUr>)	rrbZ	componentrcr_�f�erRrrrar	�update_from_conf�s&	".��

�zSoSOptions.update_from_confTcCs<|jD]0}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)rrZskip_defaultr"rrr	�merge�s
	

zSoSOptions.mergecCs6i}|jD]&}t||�}|r(|dvr(d}|||<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.
        �Z
add_presetZ
del_presetZdescZnoteN)r!r)rZ
preset_filterr`r"�valuerrr	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||vrdS|dkr$|r$dS|�jvrHt|�t�j|�krHdSdS)z. Test for non-null option values.
            )�False�Nonez[]z""z''�0FrUT)r:r.)rVrpZnull_valuesr&rr	�	has_values
z%SoSOptions.to_args.<locals>.has_valuecs*|dvrdS|dvr |dkr dS�||�S)z8 Filter out preset and null-valued options.
            roF)Zlog_sizeZplugin_timeoutZcmd_timeoutrTr)rVrp)rtrr	�
filter_opt!s�z&SoSOptions.to_args.<locals>.filter_optcSs||�d�rdt|�d}|S|�dd�}t|�r<d�|�n|}|durX|�d|��}n|}t|�dkrpd	|nd|}|S)
zD Convert sos option notation to command line arguments.
            rTrWr,rXr)Tr$rerG)�
startswithrLr\r
r*�len)rVrpr"rrrr	�argify,s
z"SoSOptions.to_args.<locals>.argifycSs|dS)Nrr)�xrrr	�<lambda>@r(z$SoSOptions.to_args.<locals>.<lambda>)rRcs$g|]\}}�||�r�||��qSrr)r%�nr,)rxrurr	r'Ar(z&SoSOptions.to_args.<locals>.<listcomp>)�sortedrr=)rZ	opt_itemsr)rxrurtrr	�to_argss
	
zSoSOptions.to_argsN)Fr$rr)T)T)�__name__�
__module__�__qualname__rr#r6r7r9rA�classmethodrCrNrSrmrnrr}rrrr	rs

>

rc@seZdZdZddd�ZdS)�
SosListOptionz0Allow to specify comma delimited list of pluginsNcCs<t|�d��}t||j�r*|t||j�7}t||j|�dS)Nr))rrOr�destr)r�parser�	namespace�values�
option_stringr=rrr	�__call__HszSosListOption.__call__)N)r~rr��__doc__r�rrrr	r�Dsr�c@seZdZdZddd�ZdS)�
ClusterOptionz6Used to store/manipulate options for cluster profiles.NcCs"||_||_||_||_||_dSr)rVrp�opt_type�cluster�description)rrVrpr�r�r�rrr	rARs
zClusterOption.__init__)N)r~rr�r�rArrrr	r�Osr�N)	�argparserZconfigparserrr
rrr�r�rrrr	�<module>	s	)