X 8WdZddlmZddlZddlmZddlmZddlm Z m Z e rddl m Z m Z mZmZmZGdd ZdS) zUniversal report objects and some formatting drivers. A way to create simple reports using python objects, primarily designed to be formatted as text and html. ) annotationsN)Iterator)StringIO) TYPE_CHECKINGTextIO) BaseLayoutEvaluationSection ParagraphSectionTablecdeZdZdZejdfdd Zdd ZdddZddZ ddZ ddZ d dZ d!dZ dS)" BaseWriterzBase class for ureport writers.Nlayoutrstreamrencoding str | NonereturnNonec|st|dd}|pd|_||_||||dS)zFormat and write the given layout into the stream object. unicode policy: unicode strings may be found in the layout; try to call 'stream.write' with it, but give it back encoded using the given encoding if it fails rzUTF-8N)getattrrout begin_formataccept end_format)selfrrrs w/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pylint/reporters/ureports/base_writer.pyformatzBaseWriter.formatsj <vz7;;H +G   d 'EvaluationSection | Paragraph | SectioncXt|ddD]}||dS)zgRecurse on the layout children and call their accept method (see the Visitor pattern). childrenN)rr)rrchilds rformat_childrenzBaseWriter.format_children3s>VZ44  E LL      rstringstrc6||dzdS)z"Write a line in the output buffer. N)writerr&s rwritelnzBaseWriter.writeln:s 6D=!!!!!rc:|j|dS)z$Write a string in the output buffer.N)rr*r+s rr*zBaseWriter.write>s vrcd|_dS)zBegin to format a layout.rN)sectionrs rrzBaseWriter.begin_formatBs  rcdS)zFinished formatting a layout.Nr"r0s rrzBaseWriter.end_formatFsrtabler list[list[str]]c "gg}|j}||D]D}|dkr|g|j}|dz}|d|E|dxxdg|t|dz zz cc<|S)zTrick to get table content without actually writing it. return an aligned list of lists containing table cells values as string rr%)colscompute_contentappendlen)rr2resultr7cells rget_table_contentzBaseWriter.get_table_contentIs $&$z((// $ $Dqyy b!!!z AID 2J  d # # # #r rddS__455  r Iterator[str]c#K|j} |jD]B}t}||_|||VC ||_dS#||_wxYw)zTrick to compute the formatting of children layout before actually writing it. return an iterator on strings (one for each child element) N)rr!rrgetvalue)rrrr#rs rr8zBaseWriter.compute_contentZsh  ( (!! T"""oo''''''  ( DHHHsDHNNNNs A A A()rrrrrrrr)rrrr)r%)r&r'rr)rr)r2r rr3)rrrr>)__name__ __module__ __qualname____doc__sysstdoutrr$r,r*rrr=r8r"rrrrs)) # (""""",,,,"rr)rD __future__rrEcollections.abcriortypingrrpylint.reporters.ureports.nodesrr r r r rr"rrrLs  #""""" $$$$$$((((((((OOOOOOOOOOr