HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/sos/report/__pycache__/reporting.cpython-38.pyc
U

i��dS�@sdZzddlZWnek
r,ddlZYnXGdd�de�ZGdd�de�ZGdd�de�Zd	d
�ZGdd�de�Z	Gd
d�de�Z
Gdd�de�ZGdd�de�ZGdd�de�Z
Gdd�de�Zdd�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)zR This provides a restricted tag language to define the sosreport
    index/report
�Nc@seZdZdd�Zdd�ZdS)�NodecCst�|j�S�N)�json�dumps�data��self�r	�6/usr/lib/python3/dist-packages/sos/report/reporting.py�__str__szNode.__str__cCsdS)NFr	�r�noder	r	r
�can_addszNode.can_addN)�__name__�
__module__�__qualname__rrr	r	r	r
rsrc@seZdZdZdS)�Leafz0Marker class that can be added to a Section nodeN)rrr�__doc__r	r	r	r
rsrc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�Reportz?The root element of a report. This is a container for sections.cCs
i|_dSr)rrr	r	r
�__init__'szReport.__init__cCs
t|t�Sr)�
isinstance�Sectionrr	r	r
r*szReport.can_addcGs&|D]}|�|�r|j|j|j<qdSr)rr�name�rZnodesr
r	r	r
�add-s
z
Report.addN�rrrrrrrr	r	r	r
r$srcCst|t�r|S|�dd�S)z3returns a string text for a given unicode/str input�utf8�ignore�r�str�decode)�sr	r	r
�_decode3sr"c@s(eZdZdZdd�Zdd�Zdd�ZdS)	rzeA section is a container for leaf elements. Sections may be nested
    inside of Report objects only.cCst|�|_i|_dSr)r"rr)rrr	r	r
r<s
zSection.__init__cCs
t|t�Sr)rrrr	r	r
r@szSection.can_addcGs0|D]&}|�|�r|j�|jg��|j�qdSr)rr�
setdefault�ADDS_TO�appendrr	r	r
rCs
zSection.addNrr	r	r	r
r8src@seZdZdZdd�ZdS)�CommandZcommandscCst|�|t|�d�|_dS)N)r�return_code�href�r"r)rrr'r(r	r	r
rMs�zCommand.__init__N�rrrr$rr	r	r	r
r&Isr&c@seZdZdZdd�ZdS)�
CopiedFileZcopied_filescCst|�t|�d�|_dS�N)rr(r)�rrr(r	r	r
rWs�zCopiedFile.__init__Nr*r	r	r	r
r+Ssr+c@seZdZdZdd�ZdS)�CreatedFileZ
created_filescCst|�t|�d�|_dSr,r)r-r	r	r
r`s�zCreatedFile.__init__Nr*r	r	r	r
r.\sr.c@seZdZdZdd�ZdS)�AlertZalertscCst|�|_dSrr)�rZcontentr	r	r
riszAlert.__init__Nr*r	r	r	r
r/esr/c@seZdZdZdd�ZdS)�NoteZnotescCst|�|_dSrr)r0r	r	r
rqsz
Note.__init__Nr*r	r	r	r
r1msr1cCs
|�d�S)a Return True if 'string' ends with a backslash, and False otherwise.

        Define this as a named function for no other reason than that pep8
        now forbids binding of a lambda expression to a name:

        'E731 do not assign a lambda expression, use a def'
    �\)�endswith)�stringr	r	r
�ends_bsusr5c@s�eZdZdZdZdZdZdZdZdZ	dZ
dZd	ZdZ
d
ZdZeeddfeed
dfeeddfeeddfeeddffZgZdd�Zdd�Zdd�ZdS)�PlainTextReportz@Will generate a plain text report from a top_level Report object�z  * %(name)sz  ! %sz  * %szLoaded Plugins:z  {name}�
�z{name}zH========================================================================z-  commands executed:z-  files copied:z-  files created:z
-  alerts:z	-  notes:cCstt�|j��|_dSr)�sorted�dict�itemsr�report_data)rZreport_noder	r	r
r�szPlainTextReport.__init__c
	Cs,g|_}t|j�dkr$|�|j�|�|j�d}d}t|j�}|jD]B\}}||jj|d�7}|d7}||jdkrH||krH||j	7}qH||j
7}|�|�|jD]P\}}|�|j�|�|jj|d��|j
D] \}}	}
}|�||j|
|	|�q�q�t|j�dk�r|�|j�d�tdd�|��}|S)Nrr7)r�r8cSst|t�r|S|�dd�S)Nrrr)�ir	r	r
�<lambda>�sz)PlainTextReport.unicode.<locals>.<lambda>)�line_buf�len�HEADERr%�PLUGLISTHEADERr=�PLUGLISTITEM�format�PLUGLISTMAXITEMS�PLUGLISTSEP�PLUGLISTFOOTER�PLUGDIVIDER�PLUGINFORMAT�subsections�process_subsectionr$�FOOTER�join�map)
rrA�liner?Z	plugcountZsection_name�_Zsection_contentsZtype_�format_�header�footer�outputr	r	r
�unicode�s:




��zPlainTextReport.unicodecCs\||krX|j�|�t|�|�dd�d�D]}|j�||�q*t|�dkrX|j�|�dS)NcSst|t�r|dSdS)Nrr7)rr;)�xr	r	r
r@��z4PlainTextReport.process_subsection.<locals>.<lambda>)�keyr)rAr%r:�getrB)rZsectionrZrTrSrU�itemr	r	r
rM�s�
z"PlainTextReport.process_subsectionN)rrrrrCrN�LEAF�ALERT�NOTErDrErHrGrIrKrJr&r+r.r/r1rLrArrWrMr	r	r	r
r6�s.




�"r6c@sveZdZdZdZdZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZeed
dfeeddfeeddfeeddfeeddffZdS)�
HTMLReportz:Will generate a HTML report from a top_level Report objecta�<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
        <head>
            <meta http-equiv="Content-Type" content="text/html;
                  charset=utf-8" />
            <title>Sos System Report</title>
            <style type="text/css">
                td {
                    padding: 0 5px;
                   }
            </style>
        </head>
        <body>
z</body></html>z(<li><a href="%(href)s">%(name)s</a></li>z<li>%s</li>z#<h3>Loaded Plugins:</h3><table><tr>z&<td><a href="#{name}">{name}</a></td>
z
</tr>
<tr>r9z
</tr></table>z+<h2 id="{name}">Plugin <em>{name}</em></h2>z<hr/>
z<p>Commands executed:</p><ul>z</ul>z<p>Files copied:</p><ul>z<p>Files created:</p><ul>z<p>Alerts:</p><ul>z<p>Notes:</p><ul>N)rrrrrCrNr]r^r_rDrErHrGrIrKrJr&r+r.r/r1rLr	r	r	r
r`�s&




�r`c@seZdZdZdd�ZdS)�
JSONReportz:Will generate a JSON report from a top_level Report objectcCstj|jddd�}|S)N�F)�indentZensure_ascii)rrr=)rrVr	r	r
rW�szJSONReport.unicodeN)rrrrrWr	r	r	r
ra�sra)rr�ImportErrorZ
simplejson�objectrrrr"rr&r+r.r/r1r5r6r`rar	r	r	r
�<module>s$	
		K&