8f6ddlmZmZddlmZddlmZddlmZddl m Z m Z m Z m Z mZmZmZmZmZddlmZddlmZdd lmZmZmZmZdd lmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z*e rddl+m,Z,GddeZ-e de#fZ.e de-fZ/Gdde0Z1Gdde1Z2GddZ3GddeZ4Gdde4Z5Gdd e4Z6e&Gd!dZ7e8d"krWdd#l9mZeZe7Z:e:;e7d$d%&e7dd'(e7d)d*+e:d'<e7d,-e7d.d/0e:d.<e7d1d/0e7d2-e:d2;e7d3-e7d4-e7d5-e:d,;e7e:j=d6-e7d7-e:d1>d8e?e:d9Sd9S):)ABCabstractmethod)islice) itemgetter)RLock) TYPE_CHECKINGDictIterableList NamedTupleOptionalSequenceTupleUnion) ratio_resolve)Align)ConsoleConsoleOptionsRenderableType RenderResult)ReprHighlighter)Panel)Pretty)Region)Result rich_repr)Segment) StyleTypeTreec@eZdZUdZeed<eeeed<dS) LayoutRenderzAn individual layout render.regionrenderN)__name__ __module__ __qualname____doc__r__annotations__r rw/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/rich/layout.pyr#r# s6&& NNN g r,r#LayoutceZdZdZdS) LayoutErrorzLayout related error.Nr&r'r(r)r+r,r-r0r0+sr,r0ceZdZdZdS) NoSplitterz"Requested splitter does not exist.Nr1r+r,r-r3r3/s,,,,r,r3cPeZdZdZeZd dddeddfdZd ed e de fd Z dS) _Placeholderz4An internal renderable used as a Layout placeholder.layoutr.stylereturnNc"||_||_dSN)r7r8)selfr7r8s r-__init__z_Placeholder.__init__8s  r,consoleoptionsc#*K|j}|jp |jj}|j}|jr|jd|d|dnd|d|d}t t jt|d|j | |d|VdS) Nz (z x )(middle)verticalblue)r8title border_styleheight) max_widthrHsizer7namerrcenterrr8 highlighter)r<r>r?widthrHr7rFs r-__rich_console__z_Placeholder.__rich_console__<s!67<#6{ )v{ 3 3 3 3& 3 3 3 3(U((v(((   L( ; ; ;*""5))         r,)r6) r&r'r(r)rrMrr=rrrrOr+r,r-r5r53s>>!/##Kx 4  )7       r,r5c eZdZUdZdZeed<edefdZede dde de e de ffd Z d S) SplitterzBase class for a splitter.r6rKr9cdS)z(Get the icon (emoji) used in layout.treeNr+r<s r- get_tree_iconzSplitter.get_tree_iconUr,childrenr.r$cdS)zDivide a region amongst several child layouts. Args: children (Sequence(Layout)): A number of child layouts. region (Region): A rectangular region to divide. Nr+)r<rVr$s r-dividezSplitter.divideYrUr,N)r&r'r(r)rKstrr*rrTrrr rrXr+r,r-rQrQPs$$D#NNN7s777^7  * 4: %&() *   ^   r,rQc ^eZdZdZdZdefdZdeddede e deffdZ d S) RowSplitterz!Split a layout region in to rows.rowr9cdS)Nu[layout.tree.row]⬌r+rSs r-rTzRowSplitter.get_tree_iconjs%%r,rVr.r$c#K|\}}}}t||}d}t} t||D]\} } | | ||z|| |fV|| z } dSNrrrzip) r<rVr$xyrNrH render_widthsoffset_Regionchild child_widths r-rXzRowSplitter.dividems%1eV%eX66 "%h ">"> " " E;VQ VDDD D D D k !FF " "r,N r&r'r(r)rKrYrTrrr rrXr+r,r-r[r[esz++ D&s&&&& " * "4: " %&() * " " " " " "r,r[c ^eZdZdZdZdefdZdeddede e deffdZ d S) ColumnSplitterz$Split a layout region in to columns.columnr9cdS)Nu[layout.tree.column]⬍r+rSs r-rTzColumnSplitter.get_tree_icon~s((r,rVr.r$c#K|\}}}}t||}d}t} t||D]\} } | | |||z|| fV|| z } dSr_r`) r<rVr$rbrcrNrHrender_heightsrerfrg child_heights r-rXzColumnSplitter.divides%1eV&vx88#&x#@#@ # # E<AJ|DDD D D D l "FF # #r,Nrir+r,r-rkrkysz.. D)s)))) # * #4: # %&() * # # # # # #r,rkc(eZdZdZeedZ d+dddddddeedee d ee d e d e d e d dfdZ d e fdZed efdZed edfdZed efdZde d edfdZde d dfdZed,dZdddedefdeee fd dfdZdedefd dfdZdedefd dfdZdedefd dfdZd-dZded dfd Zd!d"d#e d dfd$Z d%e d&e d e!fd'Z"d!e#d(e$d efd)Z%d!e#d(e$d e&fd*Z'dS).r.aBA renderable to divide a fixed height in to rows or columns. Args: renderable (RenderableType, optional): Renderable content, or None for placeholder. Defaults to None. name (str, optional): Optional identifier for Layout. Defaults to None. size (int, optional): Optional fixed size of layout. Defaults to None. minimum_size (int, optional): Minimum size of layout. Defaults to 1. ratio (int, optional): Optional ratio for flexible layout. Defaults to 1. visible (bool, optional): Visibility of layout. Defaults to True. )r\rlNrT)rKrJ minimum_sizeratiovisible renderablerKrJrrrsrtr9c|pt||_||_||_||_||_||_|jd|_g|_ i|_ t|_ dS)Nrl) r5 _renderablerJrrrsrKrt splitterssplitter _children _render_mapr_lock)r<rurKrJrrrsrts r-r=zLayout.__init__sq&;d);); (   ":$.":"<"< ')&(WW r,c#jKd|jdfVd|jdfVd|jdfVd|jdfVdS)NrKrJrrrrs)rKrJrrrsrSs r- __rich_repr__zLayout.__rich_repr__sadi%%%%di%%%%d/2222tz1$$$$$$r,c"|jr|n|jS)zLayout renderable.)rzrwrSs r-ruzLayout.renderables~;tt4+;;r,c$d|jDS)zGets (visible) layout children.c g|] }|j | Sr+)rt).0rgs r- z#Layout.children..sCCC%U]CCCCr,rzrSs r-rVzLayout.childrensDC4>CCCCr,c|jS)zGet a map of the last render.)r{rSs r-mapz Layout.maps r,cj|j|kr|S|jD]}||}||cSdS)zGet a named layout, or None if it doesn't exist. Args: name (str): Name of layout. Returns: Optional[Layout]: Layout instance or None if no layout was found. N)rKrzget)r<rKrg named_layouts r-rz Layout.getsR 9  K ( ($yy +'''',tr,cX||}|td||S)NzNo layout with name )rKeyError)r<rKr7s r- __getitem__zLayout.__getitem__s2$ >:$::;; ; r,r!cddlmddlmddlm}dddffd |}||d |jjd }dfd |||S)z/Get a tree renderable to show layout structure.r)Styled)Tabler r7r.r9c|j}d}|jrt |nt |d}||||}|S)N)rrrr)paddingdim)ryrTgridrtradd_row)r7icontabletext_summaryrrs r-summaryzLayout.tree..summarysv?0022DJJ|J44E#).SvffVF^^U6S6S  MM$ % % %HOr, layout.tree.T) guide_style highlighttreer!Nc|jD]9}||d|jj|:dS)Nr)r)rzaddryrK)rr7rgrecursers r-rzLayout.tree..recursesn)  HH$H5>3F$H$H   r,)rr!r7r.r9N)pip._vendor.rich.styledrpip._vendor.rich.tablerpip._vendor.rich.treer!ryrK)r<r!r7rrrrrs @@@@r-rz Layout.trees 322222000000...... H        t GFOO=v';==            d r,rl)rylayoutsrycd|D} t|tr|n|j||_n #t$rt d|wxYw||jdd<dS)zSplit the layout in to multiple sub-layouts. Args: *layouts (Layout): Positional arguments should be (sub) Layout instances. splitter (Union[Splitter, str]): Splitter instance or name of splitter. cZg|](}t|tr|nt|)Sr+ isinstancer.rr7s r-rz Layout.split..sA   !00 DFFfVnn   r,zNo splitter called N)rrQrxryrr3rz)r<ryr_layoutss r-splitz Layout.splits  !    Ah110-T^H-// MM  A A A?8??@@ @ A$qqqs 1AAcRd|D}|j|dS)zAdd a new layout(s) to existing split. Args: *layouts (Union[Layout, RenderableType]): Positional arguments should be renderables or (sub) Layout instances. c3bK|]*}t|tr|nt|V+dSr;rrs r- z#Layout.add_split..%sO  !00 DFFfVnn      r,N)rzextend)r<rrs r- add_splitzLayout.add_splits>  !    h'''''r,c |j|ddidS)zSplit the layout in to a row (layouts side by side). Args: *layouts (Layout): Positional arguments should be (sub) Layout instances. ryr\Nrr<rs r- split_rowzLayout.split_row+s!  G,e,,,,,r,c |j|ddidS)zSplit the layout in to a column (layouts stacked on top of each other). Args: *layouts (Layout): Positional arguments should be (sub) Layout instances. ryrlNrrs r- split_columnzLayout.split_column3s!  G/h/////r,c|jdd=dS)zReset splits to initial state.NrrSs r-unsplitzLayout.unsplit;s N111   r,cT|j5||_ddddS#1swxYwYdS)zjUpdate renderable. Args: renderable (RenderableType): New renderable object. N)r|rw)r<rus r-updatez Layout.update?sx Z * *)D  * * * * * * * * * * * * * * * * * *s !!r>r layout_namec@|j5||}|j|\}}|\}}}} |||j|| } t || |j|<|| ||ddddS#1swxYwYdS)zRefresh a sub-layout. Args: console (Console): Console instance where Layout is to be rendered. layout_name (str): Name of layout. N)r|r{ render_linesr?update_dimensionsr#update_screen_lines) r<r>rr7r$_linesrbrcrNrHliness r-refresh_screenzLayout.refresh_screenHsZ 5 5+&F!-f5NFF$* !Q5&((99%HHE(4FE'B'BD V $  ' 'q! 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5sA>BBBrNrHcV|tdd||fg}|j}|j}g}|j}|rR|||d\}} |j} | r)|j| | D] } || |Rdt |tdD} | S)z,Create a dict that maps layout on to Region.rci|]\}}|| Sr+r+rr7r$s r- z+Layout._make_region_map..hs.    F   r,r)key)rappendpoprVryrXsortedr) r<rNrHstackpushrlayout_regionsappend_layout_regionr7r$rVchild_and_region region_maps r-_make_region_mapzLayout._make_region_mapYs/3VAq%5P5P.Q-R|i68-4 +  ' ' '+B/NFFH +(.(>(>x(P(P++$D)****  +  "(Z]]"K"K"K   r,r?c8|j}|jp|j}|||}d|D}i}|j}|j} |D]=\} } || j| | j| j} t| | || <>|S)zRender the sub_layouts. Args: console (Console): Console instance. options (ConsoleOptions): Console options. Returns: RenderMap: A dict that maps Layout on to a tuple of Region, lines c*g|]\}}|j ||fSr+)rVrs r-rz!Layout.render..{s9   ? V    r,) rIrHritemsrrrurNr#) r<r>r? render_width render_heightrr render_maprrr7r$rs r-r%z Layout.renderns( 8'. **<GG   ","2"2"4"4    68 + #5, = =NFF L!#4#4V\6=#Q#QE".fe!.s0K0K0K0K0K0Kr,)r|rIrNrHr%rr{rangervaluesrarrline)r<r>r?rNrHr layout_lines_islicer$r_xrc _layout_width layout_heightr\rnew_line layout_rows r-rOzLayout.__rich_console__sZ  %6E^5w~FWg.G.Gv.V.VWWJ)D 0K0KU6]]0K0K0KLG!+!2!2!4!4 % % 6<3A}m!$GL!Q->??""%%ICJJt$$$$% |~~H*   %%%%%%%%                   sC,DD Dr;)r9r!)r9N)(r&r'r(r)r[rkrxr rrYintboolr=rr~propertyrur rV RenderMaprrrrrrQrrrrrrr RegionMaprrrr%rrOr+r,r-r.r.sm  $~>>I04#"^,sm  sm    *%v%%%% rrrrrMrpanelrprettyrr$rreprrrsegmentrr8rrr!r#rr Exceptionr0r3r5rQr[rkr.r&pip._vendor.rich.consoler7rrrrprintr+r,r-r s########                      "!!!!!JJJJJJJJJJJJ((((((########+******     :    6! " <' (      )   --------        :     s   *"""""("""(#####X###( QQQQQQQ Qh z000000giiG VXXF H1%%%QV$$$BX&&&  6NVV000&&fA2N2N2NOOO 6NVV!<<O>O>OPPP 4LEFF11166x3H3H3H 6Nv{ A A A66wCWCWCWXXX 9U### MM&1r,