U ʗRe@sddlmZddlmZddlmZmZddlmZm Z m Z ddl m Z ddl mZddlmZdd lmZGd d d e Zed krdd lZddlmZzejdZWnek rdZYnXeZeeedeZejedddd S))Union) AlignMethod)cell_len set_cell_size)ConsoleConsoleOptions RenderResult) JupyterMixin Measurement)Style)Textc @seZdZdZddddddeeefeeeefeedd d d Z ed d dZ e e e dddZeeedddZe e edddZdS)RuleuA console renderable to draw a horizontal rule (line). Args: title (Union[str, Text], optional): Text to render in the rule. Defaults to "". characters (str, optional): Character(s) used to draw the line. Defaults to "─". style (StyleType, optional): Style of Rule. Defaults to "rule.line". end (str, optional): Character at end of Rule. defaults to "\\n" align (str, optional): How to align the title, one of "left", "center", or "right". Defaults to "center". u─z rule.line center) charactersstyleendalignN)titlerrrrreturncCsNt|dkrtd|dkr,td|d||_||_||_||_||_dS)Nrz:'characters' argument must have a cell width of at least 1)leftrrightzAinvalid value for align, expected "left", "center", "right" (not ))r ValueErrorrrrrr)selfrrrrrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/rich/rule.py__init__s  z Rule.__init__)rcCsd|jd|jdS)NzRule(z, r)rr)rrrr__repr__.sz Rule.__repr__)consoleoptionsrccs4|j}ttddpdd}|jr.||js.dn|j}t|}|jsT|||VdSt|jt rh|j}n|j |jdd}|j dd|_ | |jd krd nd }td ||} | s|||VdSt |jd } |jd kr|j| dd|t|j d } t || |d} | | d|t| j t|j } t || |d}|| | | j d|j| || d|j |jn|jdkr|j| dd| || d| ||| j|jnJ|jdkr|j| dd| |||jd|j| d| |t| j || _ | VdS)NisasciicSstdd|DS)Ncss|]}t|dkVqdS)N)ord).0crrr 8sz:Rule.__rich_console__....)all)srrr8z'Rule.__rich_console__..-z rule.text)rr rr)rellipsis)overflowrrr) max_widthgetattrstr ascii_onlyrrr _rule_line isinstancer render_strplainreplace expand_tabsrmaxrtruncateappendrr)rr"r#widthr$r chars_len title_textZrequired_spaceZtruncate_width rule_textZ side_widthrZ right_lengthrrrr__rich_console__1s`            zRule.__rich_console__)rBrArcCs6t|j||d|j}||t|j||_|SNr)rrrr?rr;)rrBrArDrrrr8ms zRule._rule_linecCs tddSrFr )rr"r#rrr__rich_measure__sszRule.__rich_measure__)r)__name__ __module__ __qualname____doc__rr6rr rr r!rrr rEintr8r rGrrrrr s2     <r__main__N)rz Hello, World)rZfoor0)rA)typingrrrcellsrrr"rrr jupyterr measurer rr textrrrHsyspip._vendor.rich.consoleargv IndexErrorprintrrrrs&      m