"Te# ddlmZmZmZmZddlmZmZddlm Z m Z m Z m Z ddl mZddlmZddlmZddlmZmZmZdd lmZGd d eZed k(rdd lmZddlmZddlm Z ddl!m"Z"ddl#m$Z$e$ddgZ%e%jMddde%jMdde%jMddde%jOd d!d"e%jOd#d$d%e%jOd&d'd(e%jOd)d*d+d,Z(e"e(d-d.d/Z)ed0Z*ed1dd2Z+e+jYd3d45Z-e-jYd6d75Z.e.jYed8e)e.jYed9e e*d:e-jYd;d<5Z/de/_0e jbd=d4:Z2e/jYed>e2e/jYed?e%e Zejge+y@y@)A)IteratorListOptionalTuple) loop_first loop_last)ConsoleConsoleOptionsRenderableType RenderResult) JupyterMixin) Measurement)Segment)Style StyleStack StyleType)StyledceZdZdZdddddddeded ed ed ed ed dfdZddddddedeed eed ed eed df dZ ddZ ddZ y)TreeaA renderable for a tree structure. Args: label (RenderableType): The renderable or str for the tree label. style (StyleType, optional): Style of this tree. Defaults to "tree". guide_style (StyleType, optional): Style of the guide lines. Defaults to "tree.line". expanded (bool, optional): Also display children. Defaults to True. highlight (bool, optional): Highlight renderable (if str). Defaults to False. treez tree.lineTF)style guide_styleexpanded highlight hide_rootlabelrrrrrreturnNcf||_||_||_g|_||_||_||_yN)rrrchildrenrrr)selfrrrrrrs +/usr/lib/python3/dist-packages/rich/tree.py__init__z Tree.__init__s6  &$&   ""rrrrct|| |jn|| |jn||| |jn|}|jj ||S)a3Add a child tree. Args: label (RenderableType): The renderable or str for the tree label. style (StyleType, optional): Style of this tree. Defaults to "tree". guide_style (StyleType, optional): Style of the guide lines. Defaults to "tree.line". expanded (bool, optional): Also display children. Defaults to True. highlight (Optional[bool], optional): Highlight renderable (if str). Defaults to False. Returns: Tree: A new child Tree, which may be further modified. r&)rrrrr!append)r"rrrrrnodes r#addzTree.add)sX*  % $**5,7,?(([(1(9dnny   T" r%c #Kg}|j}|j}tj}|j}t j }||jdxs|} td\} } } } dgdtdtdt dtffd }|| | g}|tt|gt||j}t||j}t d d }d }|rW|} t|\}}|||r|| |d jxs||d <|j ||jz} |j ||jz}||j"rdndd}|j%t'|j(|j+j,t/d|Dz |j0dj2du}|d k(r |j"spt5|D]b\}}|r&j7||j8|Ed{|Ed{||s?|sB||r| n| |d jxs||d <d|j:r|j<r||r| n| |d jxs||d <|j|t?|j<dk(r| n| | |jA||j|jA||j|tt|j<|dz }|rVyy#t$rU|j|r?|d jxs|} || | |d <|j|jYwxYw7y7rw)N)default) z| z+-- z`-- ))r/u│ u ├── u └── )r/u┃ u ┣━━ u ┗━━ )r/u║ u ╠══ u ╚══ indexrrcjr|}n4|jrdn|jrdnd}jrdn||}||S)z.Make a Segment for a level of the guide lines.rr) ascii_onlybold underline2legacy_windows)r0rlineguide ASCII_GUIDES TREE_GUIDES_Segmentoptionss r# make_guidez)Tree.__rich_console__..make_guide]sS!!#E*"ZZ53C3Ca"(>(>1EJ5QD%( (r%F)r4r5rr2rc34K|]}|jywr ) cell_length).0levels r# z(Tree.__rich_console__..s@%++@s)widthrheight)pad) post_style)!popr(rr7 get_stylernullrrangeintiterr rrnext StopIterationcurrentr render_linesrrupdate max_widthsumrjustifyr apply_stylebackground_stylerr!lenpush)r"consoler<stackrHrYnew_linerI null_stylerSPACECONTINUEFORKENDr=levelsguide_style_stack style_stackremove_guide_stylesdepth stack_nodelastr)rprefixrenderable_linesfirstr7r9r:r;s ` @@@r#__rich_console__zTree.__rich_console__Hs46ii||<<>%% ZZ\  0 0"=K %*1X"xs7   )c )% )G ) )",Hk!B C T)TF# $%&y1A1A'BC 4::!67 #5AJ !*- d  'VBZ-=-=-KLr +33i@P@P6QQK'')DJJ*??E$..Qa:;F&33tzz5)!++@@@A"nn  OO4/ 4  QJ4>>#-.>#? KE4#+#7#7"!22':$8$ $OO"N%/%)Ex9I9I9WZ&r  }}'!Ex1A1A1OZr  c$--&8A&=s4U  4::!67!&&y1A1A'BCT)DMM234 o!  "(*"2"2"@jK!+D+!>F2J%))+OO% : $s]DOM)'D*OO  OO  O'O*C;O'O)AOOOO Oct|gg}|j}|j}d}d}tj}d} |r|} t | } || |||| j\} } | dz}t| |z|}t| |z|}| jr,| jr |t| j| dz } |rt||S#t $r| dz} YwxYw)Nrrr.) rMrHr(rgetrNrOrmaxrr!)r"rZr<r[rHrYminimummaximummeasurerB iter_treer min_measure max_measureindents r#__rich_measure__zTree.__rich_measure__s(,TF|nii||//I I O'.w'L $KQYF+.8G+.8G}}T$--() 7G,,!   s CC+*C+)rZr r<r rr )rZr r<r rr) __name__ __module__ __qualname____doc__r rboolr$rr*rlrwr%r#rr s"!,## #  #  ### #,&*+/$) "  i(   D> >^ ^+;^ ^@- -+;- -r%r__main__)Group)Markdown)Panel)Syntax)Tabler,dim) row_stylesReleasedcyanT)rno_wrapTitlemagenta)rz Box Officerightgreen)rUrz Dec 20, 2019z Star Wars: The Rise of Skywalkerz $952,110,690z May 25, 2018zSolo: A Star Wars Storyz $393,151,347z Dec 15, 2017z!Star Wars Ep. V111: The Last Jediz$1,332,539,889z Dec 16, 2016zRogue One: A Star Wars Storyz$1,332,439,889zmclass Segment(NamedTuple): text: str = "" style: Optional[Style] = None is_control: bool = False pythonmonokai)theme line_numbersz=### example.md > Hello, World! > > Markdown _all_ the things u🌲 [b green]Rich Tree)rrz:file_folder: Renderablesred)rz!:file_folder: [bold yellow]Atomiczuu greenu 📄 Syntaxu 📄 Markdown) border_stylez&:file_folder: [bold magenta]Containersz bold magentaz Just a panelu 📄 Panelsu📄 [b magenta]TableN)4typingrrrr_looprr rZr r r r jupyterrrrrsegmentrrrrrstyledrrrx rich.consoler rich.markdownr rich.panelr rich.syntaxr rich.tablertable add_columnadd_rowcodesyntaxmarkdownrootr*r) simple_nodecontainers_noderfitpanelprintr}r%r#rs22(JJ! //u-<u-p z"& " b%[ )E Zvt< WI. \7'B MM."DnU MM.";^L MM."EGWX MM."@BRS D D()$ GF H )TT JD 88/U8 CD((>J(WKOOE-01OOE/5+PQRhh0nO $O EIIn5 9EmU345u=>iG MM$kr%