
    ~ g5                     B   S r  SSKr " S S5      r " S S\5      r " S S\5      rS	 r " S
 S\5      r " S S\5      r	 " S S\5      r
 " S S\5      r " S S\5      r " S S\5      rS r " S S5      r " S S\5      r " S S\5      rg! \ a    SSKr Nf = f)zNThis provides a restricted tag language to define the sos report
index/report
    Nc                   $    \ rS rSr0 rS rS rSrg)Node   c                 B    [         R                  " U R                  5      $ N)jsondumpsdataselfs    6/usr/lib/python3/dist-packages/sos/report/reporting.py__str__Node.__str__   s    zz$))$$    c                     g)NF r   nodes     r   can_addNode.can_add   s    r   r   N)__name__
__module____qualname____firstlineno__r
   r   r   __static_attributes__r   r   r   r   r      s    D%r   r   c                       \ rS rSrSrSrg)Leaf"   z0Marker class that can be added to a Section noder   N)r   r   r   r   __doc__r   r   r   r   r   r   "   s    :r   r   c                   *    \ rS rSrSrS rS rS rSrg)Report&   z?The root element of a report. This is a container for sections.c                     0 U l         g r   r
   r   s    r   __init__Report.__init__)   s	    	r   c                 "    [        U[        5      $ r   )
isinstanceSectionr   s     r   r   Report.can_add,   s    $((r   c                     U H>  nU R                  U5      (       d  M  UR                  U R                  UR                  '   M@     g r   )r   r
   namer   nodesr   s      r   add
Report.add/   s1    D||D!!'+yy		$))$ r   r$   N	r   r   r   r   r   r%   r   r/   r   r   r   r   r!   r!   &   s    I)1r   r!   c                 T    [        U [        5      (       a  U $ U R                  SS5      $ )z3returns a string text for a given unicode/str inpututf8ignorer(   strdecode)ss    r   _decoder9   5   s$    As##AD&()CDr   c                   *    \ rS rSrSrS rS rS rSrg)r)   :   zaA section is a container for leaf elements. Sections may be nested
inside of Report objects only.c                 2    [        U5      U l        0 U l        g r   )r9   r,   r
   )r   r,   s     r   r%   Section.__init__>   s    DM		r   c                 "    [        U[        5      $ r   )r(   r   r   s     r   r   Section.can_addB   s    $%%r   c                     U HZ  nU R                  U5      (       d  M  U R                  R                  UR                  / 5      R	                  UR                  5        M\     g r   )r   r
   
setdefaultADDS_TOappendr-   s      r   r/   Section.addE   sB    D||D!!		$$T\\26==diiH r   )r
   r,   Nr1   r   r   r   r)   r)   :   s    &&Ir   r)   c                       \ rS rSrSrS rSrg)CommandK   commandsc                 >    [        U5      U[        U5      S.U l        g )N)r,   return_codehrefr9   r
   )r   r,   rJ   rK   s       r   r%   Command.__init__O   s    $T]$/$T],	r   r$   Nr   r   r   r   rB   r%   r   r   r   r   rF   rF   K   s    G,r   rF   c                       \ rS rSrSrS rSrg)
CopiedFileU   copied_filesc                 <    [        U5      [        U5      S.U l        g N)r,   rK   rL   r   r,   rK   s      r   r%   CopiedFile.__init__Y       $T]$T],	r   r$   NrN   r   r   r   rP   rP   U   s    G,r   rP   c                       \ rS rSrSrS rSrg)CreatedFile^   created_filesc                 <    [        U5      [        U5      S.U l        g rT   rL   rU   s      r   r%   CreatedFile.__init__b   rW   r   r$   NrN   r   r   r   rY   rY   ^   s    G,r   rY   c                       \ rS rSrSrS rSrg)Alertg   alertsc                 $    [        U5      U l        g r   rL   r   contents     r   r%   Alert.__init__k       G$	r   r$   NrN   r   r   r   r_   r_   g   s    G%r   r_   c                       \ rS rSrSrS rSrg)Noteo   notesc                 $    [        U5      U l        g r   rL   rc   s     r   r%   Note.__init__s   rf   r   r$   NrN   r   r   r   rh   rh   o   s    G%r   rh   c                 $    U R                  S5      $ )zReturn 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)strings    r   ends_bsrq   w   s     ??4  r   c                       \ rS rSrSrSrSrSrSrSr	Sr
SrS	rS
rSrSrSr\\SS4\\SS4\\SS4\\SS4\\	SS44r/ rS rS rS rSrg)PlainTextReport   z@Will generate a plain text report from a top_level Report object z  * %(name)sz  ! %sz  * %szLoaded Plugins:z  {name}
   z{name}zH========================================================================z-  commands executed:z-  files copied:z-  files created:z
-  alerts:z	-  notes:c                 ^    [        [        R                  UR                  5      5      U l        g r   )sorteddictitemsr
   report_data)r   report_nodes     r   r%   PlainTextReport.__init__   s    !$**[-=-=">?r   c           	      F   / =U l         n[        U R                  5      S:  a  UR                  U R                  5        UR                  U R                  5        SnSn[        U R
                  5      nU R
                   H;  u  pVUSU 3-  nUS-  nX0R                  -  S:X  d  M&  X4:  d  M-  X R                  -  nM=     X R                  -  nUR                  U5        U R
                   He  u  pWUR                  U R                  5        UR                  U 5        U R                   H#  u  ppU R                  XxR                  XU5        M%     Mg     [        U R                  5      S:  a  UR                  U R                  5        SR                  [        S U5      5      nU$ )Nr   ru   z     rv   c                 T    [        U [        5      (       a  U $ U R                  SS5      $ )Nr3   r4   r5   )is    r   <lambda>)PlainTextReport.unicode.<locals>.<lambda>   s*    z!S/A/A! +J/0xx/I+Jr   )line_buflenHEADERrC   PLUGLISTHEADERr|   PLUGLISTMAXITEMSPLUGLISTSEPPLUGLISTFOOTERPLUGDIVIDERsubsectionsprocess_subsectionrB   FOOTERjoinmap)r   r   liner   	plugcountsection_name_section_contentstype_format_headerfooteroutputs                r   unicodePlainTextReport.unicode   st   #%%t{{aOODKK( 	++,(()	#//OLb''DFA)))Q.Q](((	  0
 	###.2.>.>*LOOD,,-OO|n.262B2B.''(8--(.A 3C /? t{{aOODKK(3  K') * r   c                    X!;   a  U R                   R                  U5        [        UR                  U5      S S9 H   nU R                   R                  XF-  5        M"     [	        U5      S:  a  U R                   R                  U5        g g g )Nc                 :    [        U [        5      (       a  U S   $ S$ )Nr,   ru   )r(   rz   )xs    r   r   4PlainTextReport.process_subsection.<locals>.<lambda>   s    z!T/B/B!F)"J"Jr   )keyr   )r   rC   ry   getr   )r   sectionr   r   r   r   items          r   r   "PlainTextReport.process_subsection   sv    >MM  (KK$J $$W^4	
 6{Q$$V,  r   )r   r|   N)r   r   r   r   r   r   r   LEAFALERTNOTEr   PLUGLISTITEMr   r   r   PLUGINFORMATr   rF   rP   rY   r_   rh   r   r   r%   r   r   r   r   r   r   rs   rs      s    JFFDED&NLKNLK 
$4b9	T/b9	d0b9	\b9	t[b9K H@ D	-r   rs   c                   ~    \ rS rSrSrSrSrSrSrSr	Sr
SrS	rS
rSrSrSr\\SS4\\SS4\\SS4\\SS4\\	SS44rSrg)
HTMLReport   z: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>rw   z</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>r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rF   rP   rY   r_   rh   r   r   r   r   r   r   r      s    DF F5DED:N<LK$N@LK 
$<gF	T7gF	d8gF	1gF	t0gFKr   r   c                       \ rS rSrSrS rSrg)
JSONReport   z:Will generate a JSON report from a top_level Report objectc                 F    [         R                  " U R                  SSS9nU$ )N   F)indentensure_ascii)r   r	   r|   )r   r   s     r   r   JSONReport.unicode   s    D,,QUKr   r   N)r   r   r   r   r   r   r   r   r   r   r   r      s
    Dr   r   )r   r   ImportError
simplejsonr   r   r!   r9   r)   rF   rP   rY   r_   rh   rq   rs   r   r   r   r   r   <module>r      s   
	 	;4 ;1T 1E
Id I",d ,, ,,$ ,%D %%4 %!H- H-V# #L C  s   B 
BB