
    -_g              	           d dl Z d dlZd dlmZ dZdZdZdZ G d d      Zd	Z	d
Z
dZdZdZdZ eddddd      Ze	 ee	e
e e             e eeeee      iZy)    N)
SoSOptionsz/etc/sos/presets.ddescnoteargsc                   `    e Zd ZdZdZdZdZ e       ZdZ	d Z
d Zddd e       fdZd Zd	 Zy)
PresetDefaultsa  Preset command line defaults to allow for quick reference to sets of
    commonly used options

    :param name: The name of the new preset
    :type name: ``str``

    :param desc: A description for the new preset
    :type desc: ``str``

    :param note: Note for the new preset
    :type note: ``str``

    :param opts: Options set for the new preset
    :type opts: ``SoSOptions``
    NTc           
          d| j                    d| j                   d| j                   dt        | j                         d	S )zeReturn a human readable string representation of this
            ``PresetDefaults`` object.
        zname=z desc=z note=z opts=())namer   r   stroptsselfs    6/usr/lib/python3/dist-packages/sos/presets/__init__.py__str__zPresetDefaults.__str__4   sC     		{&6$)) ETYY(+ 	,    c           
          d| j                    d| j                   d| j                   dt        | j                         d	S )zgReturn a machine readable string representation of this
            ``PresetDefaults`` object.
        zPresetDefaults(name='z' desc='z' note='z' opts=(r
   )r   r   r   reprr   r   s    r   __repr__zPresetDefaults.__repr__;   sD     (		{(499+ F8DO+<A? 	@r    c                 <    || _         || _        || _        || _        y)zInitialise a new ``PresetDefaults`` object with the specified
            arguments.

            :returns: The newly initialised ``PresetDefaults``
        Nr   r   r   r   )r   r   r   r   r   s        r   __init__zPresetDefaults.__init__B   s      				r   c                    | j                   rt        d      | j                  j                         }| j                  t
        | j                  t        | j                  t        |ii}t        j                  j                  |      st        j                  |d       t        t        j                  j                  || j                        dd      5 }t!        j"                  ||       ddd       y# 1 sw Y   yxY w)zWrite this preset to disk in JSON notation.

        :param presets_path: the directory where the preset will be written
        :type presets_path: ``str``
        zCannot write built-in preseti  )modewzutf-8)encodingN)builtin	TypeErrorr   dictr   DESCr   NOTEr   OPTSospathexistsmakedirsopenjoinjsondump)r   presets_pathodictpdictpfiles        r   writezPresetDefaults.writeM   s     <<:;; 		 T499dDIItUKLww~~l+KK51"'',,|TYY7"$ 	$',IIeU#	$ 	$ 	$s   C22C;c                 ~    t        j                  t         j                  j                  || j                               y)zDelete a preset from disk

        :param presets_path: the directory where the preset is saved
        :type presets_path: ``str``
        N)r$   unlinkr%   r)   r   )r   r,   s     r   deletezPresetDefaults.deletea   s#     			"'',,|TYY78r   )__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r0   r3    r   r   r   r      sM      DDD<D G,@ Rd 	$(9r   r   nonezDo not load a presetz+Use to disable automatically loaded presetsminimalzCSmall and quick report that reduces sos report resource consumptionzXMay be useful for low-resource systems, but may not provide sufficient data for analysis
      T)log_sizejournal_sizeplugin_timeoutcommand_timeoutlow_priorityr   )r*   r$   sos.optionsr   PRESETS_PATHr!   r"   r#   r   	NO_PRESETNO_PRESET_DESCNO_PRESET_NOTESMALL_PRESETSMALL_PRESET_DESCSMALL_PRESET_NOTESMALL_PRESET_OPTSGENERIC_PRESETSr8   r   r   <module>rL      s     	 "# O9 O9d 	'># <  B/1F  ~^.\ . 18I	r   