%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/sos/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/sos/__pycache__/options.cpython-312.pyc

�

i��d,5��r�ddlmZddlmZmZmZmZd�Zd�ZGd�d�Z	Gd�de�Z
Gd	�d
�Zy)�)�Action)�ConfigParser�ParsingError�Error�DuplicateOptionErrorc�<�t|�}|tuxs|tuS)z@Return true if val is an instance of a known sequence type.
    )�type�list�tuple)�val�val_types  �-/usr/lib/python3/dist-packages/sos/options.py�_is_seqrs"���C�y�H��t��0�x�5�0�0�c�8�|j�}|dvry|dvryy)N)�true�on�yesT)�false�off�noF)�lower)r�_vals  r�str_to_boolrs(���9�9�;�D��$�$��	
�'�	'��rc�|�eZdZd�Zd�Zdd�Zd�Zd�Zifd�Ze	ifd��Z
e	d��Zd	�Zd
�Z
dd�Zdd�Zd
�Zy)�
SoSOptionsc�p�d�}t||�r�t||�}t||�}||�r||�r|s||jvrRt|�sGt	|||�|r|jj|�y|jj
|�yt|�rt	||||z�yyy)Nc��|dk(xs|duS)N��)rs r�_unsetz%SoSOptions._merge_opt.<locals>._unset"s���2�I�,����-r)�hasattr�getattr�_nondefaultr�setattr�discard�add)�self�opt�src�
is_defaultr!�newvalue�oldvalues       r�
_merge_optzSoSOptions._merge_opt!s���	.��3����s�C�(�H��t�S�)�H�
�x� ���)9���D�,�,�,�w�x�7H���c�8�,���$�$�,�,�S�1��$�$�(�(��-���"���c�8�h�#6�7�#�!rc��t|t�st|�}|jD]}|j	|||��y�N)�
isinstance�dict�vars�	arg_namesr.)r(r*r+�args    r�_merge_optszSoSOptions._merge_opts9s8���#�t�$��s�)�C��>�>�	2�C��O�O�C��j�1�	2rc��|}d}|jD]
}|||z|zz
}�|j|�|jD�cgc]}t||���}}|s,|D�	cgc] }	t|	�rdj	|	�n|	��"}}	n$|D�	cgc]}	t|	t�rd|	zn|	��}}	|t|�zj|�|zScc}wcc}	wcc}	w)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=%s�,z'%s')r4�stripr#r�joinr1�strr)
r(�quote�sep�prefix�suffix�args�arg_fmtr5�vals�vs
          r�__strzSoSOptions.__str?s��������>�>�	(�C��C�'�M�C�'�'�D�	(��
�
�3��.2�n�n�=�s���c�"�=��=��>B�C��7�1�:�C�H�H�Q�K�1�4�C�D�C�FJ�J��*�Q��"4�F�Q�J�!�;�J�D�J��u�T�{�"�)�)�#�.��7�7��>��D��Ks�C�%C�Cc�"�|j�Sr0��_SoSOptions__str�r(s r�__str__zSoSOptions.__str__Xs���z�z�|�rc�,�|jdddd��S)NTz, zSoSOptions(�))r<r=r>r?rFrHs r�__repr__zSoSOptions.__repr__[s!���z�z��$�}�!$��&�	&rc�B�||_t|j��|_t	�|_|jD]}t
|||j|��|j�D]-}|jj|�t
||||��/y)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
�keysr4�setr$r%�append)r(rN�kwargsr5s    r�__init__zSoSOptions.__init___s���)����l�/�/�1�2����5����$�$�	7�C��D�#�t�0�0��5�6�	7��;�;�=�	,�C��N�N�!�!�#�&��D�#�v�c�{�+�	,rc�Z�tdit|��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
        rNTr )rr3r6)�clsr@rN�optss    r�	from_argszSoSOptions.from_argsws/���B�D��J�B�\�B������t�$��rc��d}d}||vrd|zgS||vr&tdt|��D�cgc]}d|z��	c}Sd|zdz|zgScc}w)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)�verbosez--%sr�--�=)�range�int)rUr)r�no_value�count�ds      r�_opt_to_argszSoSOptions._opt_to_args�sf��
��
���(�?��S�L�>�!��%�<�*/��3�s�8�*<�=�Q�F�S�L�=�=��s�
�S� �3�&�'�'��>s�Ac���t|j|t|��r|St|j|t�r|j	d�D�cgc]}|��c}St|j|t
�r!t
|�}|�td|�d|�d���|St|j|t�r	t|�S|Scc}w#t$rtd|�d|�d���wxYw)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
        r8z
Value of 'z' in z# must be True or False or analagousz must be integer)
r1rNr	r
�split�boolr�	Exceptionrd�
ValueError)r(�keyr�confrCs     r�_convert_to_typezSoSOptions._convert_to_type�s����d�'�'��,�d�3�i�8��J��d�'�'��,�d�3�"�y�y��~�.�!�A�.�.��d�'�'��,�d�3��c�"�C��{���D�"�#�#��
��d�'�'��,�c�2�
/��3�x���
��/���
/��#&��!.�/�/�
/�s�	C
�=
C�C+c	�������fd�}t�}		t��5}|j|��ddd�|d
|�|||�|jd�rit�d�r\|jd�D]G\}}	|j!d
�d�j"vs�'�j$j'|dz|	z��Iyyy#1swY��xYw#t$r-}t	d|j
�d|j�d�����d}~wttf$rt	d�z��wxYw#ttf$r)}td��d|jd	���Yd}~��!d}~wwxYw)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
        c�r��|j|��r$t|j|��}d|j�vrt	|jd��|d<dddd�}t
|�D]F}d|vr$|j|�||jdd�<||vs�0|j|�|||<�H|j�D]m\}}t|t�r|d	k7r|jd
d�}|�jvrtd|�d
|�d���N�j||��}t�||��oyy)Nr`�	verbosity�label�plugopts�profiles)�name�
plugin_option�profile�-�_�keywords� rzUnknown option '�' in section '�')�has_sectionr2�itemsrOrd�popr
�replacer1r;rN�printrpr%)�section�config�odict�rename_optsrnr�config_filer(s      ��r�_update_from_sectionz9SoSOptions.update_from_conf.<locals>._update_from_section�s>����!�!�'�*��V�\�\�'�2�3����
�
��,�),�U�Y�Y�y�-A�)B�E�+�&�
$�%/�)���
 ��;�A�C��c�z�7<�y�y��~��c�k�k�#�s�3�4��k�)�27�)�)�C�.��k�#�.�/�	A�!&���
�
,�H�C��"�#�s�+��z�0A�!�k�k�#�r�2���$�"3�"3�3��!$�g�/�0� ��/�/��S�+�F�C��D�#�s�+�
,�'+rNzDuplicate option 'r~z
' in file z%Failed to parse configuration file %sz+WARNING: Unable to read configuration file z : ��global�plugin_optionsru�.rrb)r�open�	read_filer�exit�optionr�rr�OSError�IOErrorr�r@r�r"r�rj�skip_pluginsrurQ)
r(r��	componentr�r��f�err�ernrs
``        r�update_from_confzSoSOptions.update_from_conf�sb���!	,�F���	�
*��+�&�5�!��$�$�Q��4�5�	�X�v�.��Y��/����.�/�G�D�*�4M�"�L�L�)9�:�
:���S��y�y��~�a�(�D�,=�,=�=��M�M�(�(��s��S��9�
:�5N�/�!5�5��'�
E��!�j�j�#�+�+�{�D�E�E�� �%�(�
*��B�(�)�*�*�
*����!�	������q�	�+�
�
��	�sE�C�C�C�C�
C�	D&�(D�!D&�&D)�)E!�8E�E!c��|jD]1}t||�s�t||��|r�|j||d��3y)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)r4r"r#r.)r(r*�skip_defaultr5s    r�mergezSoSOptions.merge�sC���>�>�	1�C��3��$���s�C� �,�L�����S�%�0�		1rc�^�i}|jD]}t||�}|r|dvrd}|||<�|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)r4r#)r(�
preset_filterr�r5�values     rr2zSoSOptions.dictsI�����>�>�	�C��D�#�&�E���F�F� �E��E�#�J�
	��rc������fd���fd�}d�}t�j�j�d���}|D��cgc]\}}|||�s�|||���c}}Scc}}w)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"]``

        c���d}|r||vry|dk(r|ry|�jvr%t|�t�j|�k(ryy)z. Test for non-null option values.
            )�False�Nonez[]z""z''�0FruT)rNr;)rwr��null_valuesr(s   �r�	has_valuez%SoSOptions.to_args.<locals>.has_value!sU���C�K��E�[�0���z�!�e���t�(�(�(��u�:��T�%6�%6�t�%<�!=�=� �rc�4��|dvry|dvr|dk(ry�||�S)z8 Filter out preset and null-valued options.
            r�F)�log_size�plugin_timeout�cmd_timeoutrTr )rwr�r�s  �r�
filter_optz&SoSOptions.to_args.<locals>.filter_opt.s1����C�C���D�D��A�:���T�5�)�)rc��|jd�rdt|�dzz}|S|jdd�}t|�rdj	|�n|}|dur|�d|��}n|}t|�dkDrd	|z}|Sd|z}|S)
zD Convert sos option notation to command line arguments.
            rsrzrCr{r8Tr}r�ra)�
startswithrdr�rr:�len)rwr�r5r)s    r�argifyz"SoSOptions.to_args.<locals>.argify9s������{�+��C��J��,�,���
��<�<��S�)�D�'.�u�~�C�H�H�U�O�5�E��D� �!%�u�-���� #�C��1��$��*�C��J�36��)�C��Jrc��|dS)Nrr )�xs r�<lambda>z$SoSOptions.to_args.<locals>.<lambda>Ms
��a��d�r)rn)�sortedr2r�)r(r�r��	opt_items�nrCr�s`     @r�to_argszSoSOptions.to_argssV���	�		*�	�(�4�9�9�;�,�,�.�N�C�	�+4�I��!�Q�
�1�a�8H��q�!��I�I��Is�A �A N)Fr}rr)T)�__name__�
__module__�__qualname__r.r6rGrIrLrS�classmethodrWrhrpr�r�r2r�r rrrrsl��8�02�8�2�&�%'�,�0�*,�
��
��(��(�$�<B:�H
1�� 6Jrrc��eZdZdZdd�Zy)�
SosListOptionz0Allow to specify comma delimited list of pluginsNc���|jd�D�cgc]}|��}}t||j�r|t||j�z
}t||j|�ycc}w)Nr8)rjr#�destr%)r(�parser�	namespace�values�
option_stringr)r�s       r�__call__zSosListOption.__call__UsV�� &���S� 1�2���2��2��9�d�i�i�(��W�Y��	�	�2�2�E��	�4�9�9�e�,��3s�	A&r0)r�r�r��__doc__r�r rrr�r�Qs
��:�-rr�c��eZdZdZdd�Zy)�
ClusterOptionz6Used to store/manipulate options for cluster profiles.Nc�J�||_||_||_||_||_yr0)rwr��opt_type�cluster�description)r(rwr�r�r�r�s      rrSzClusterOption.__init___s&����	���
� ��
����&��rr0)r�r�r�r�rSr rrr�r�\s
��@�'rr�N)�argparser�configparserrrrrrrrr�r�r rr�<module>r�sC���0�0�1��oJ�oJ�d	-�F�-�'�'r

Zerion Mini Shell 1.0