o
    id                  	   @   s   d dl Z d dlZd dlmZ dZdZdZdZG dd dZd	Z	d
Z
dZdZdZdZeddddddZe	ee	e
ee deeeeeediZdS )    N)
SoSOptionsz/etc/sos/presets.ddescnoteargsc                   @   sZ   e Zd ZdZdZdZdZe ZdZ	dd Z
dd Zddde fd	d
Zdd Zdd ZdS )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                 C      d| j | j| jt| jf S )zeReturn a human readable string representation of this
            ``PresetDefaults`` object.
        z!name=%s desc=%s note=%s opts=(%s))namer   r   stroptsself r   6/usr/lib/python3/dist-packages/sos/presets/__init__.py__str__4      zPresetDefaults.__str__c                 C   r   )zgReturn a machine readable string representation of this
            ``PresetDefaults`` object.
        z6PresetDefaults(name='%s' desc='%s' note='%s' opts=(%s))r   r   r   reprr
   r   r   r   r   __repr__;   r   zPresetDefaults.__repr__ c                 C   s   || _ || _|| _|| _dS )zInitialise a new ``PresetDefaults`` object with the specified
            arguments.

            :returns: The newly initialised ``PresetDefaults``
        Nr   r   r   r
   )r   r   r   r   r
   r   r   r   __init__B   s   
zPresetDefaults.__init__c                 C   s   | j rtd| j }| jt| jt| jt	|ii}t
j|s&t
j|dd tt
j|| jd}t|| W d   dS 1 sCw   Y  dS )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wN)builtin	TypeErrorr
   dictr   DESCr   NOTEr   OPTSospathexistsmakedirsopenjoinjsondump)r   presets_pathodictpdictpfiler   r   r   writeM   s   
"zPresetDefaults.writec                 C   s   t t j|| j dS )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&   r   r   r   delete`   s   zPresetDefaults.delete)__name__
__module____qualname____doc__r   r   r   r   r
   r   r   r   r   r*   r,   r   r   r   r   r      s    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_PRESETSr   r   r   r   <module>   s4   
Q