o
    O6uf¨  ã                	   @   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 › 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©Úself© r   ú6/usr/lib/python3/dist-packages/sos/presets/__init__.pyÚ__str__4   s   ÿzPresetDefaults.__str__c              	   C   r   )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   r   r   r   Ú__repr__;   s
   ÿÿzPresetDefaults.__repr__Ú c                 C   s   || _ || _|| _|| _dS )z�Initialise 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 )z¥Write 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 )zŒDelete 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ÿþþû