U cf@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)selfrrrrrrC/opt/hc_python/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__)consoleoptionsrccs |j}|jr|jsdn|j}t|}|js@|||VdSt|jtrT|j}n|j |jdd}|j dd|_ | |j dkrdnd}td ||}|s|||VdSt|jd } |j dkrv|j|d d |t|j d} t|| |d } | | d |t| j t|j } t|| |d } | | | | j d|j| || d| j |jn|j dkr|j|d d | || d| ||| j|jnJ|j dkr|j|d d | |||jd |j| d| |t| j || _ | VdS)N-z rule.text)rr rr)rellipsis)overflowrrr) max_width ascii_onlyrisasciirr _rule_line isinstancer render_strplainreplace expand_tabsrmaxrtruncateappendrr)rr"r#widthr chars_len title_textZrequired_spaceZtruncate_width rule_textZ side_widthrZ right_lengthrrrr__rich_console__1sZ           zRule.__rich_console__)r7r6rcCs6t|j||d|j}||t|j||_|SNr)rrrr4rr0)rr7r6r9rrrr-is zRule._rule_linecCs tddSr;r )rr"r#rrr__rich_measure__oszRule.__rich_measure__)r)__name__ __module__ __qualname____doc__rstrrr rr r!rrr r:intr-r r<rrrrr s2     8r__main__N)rz Hello, World)rZfoor&)r6)typingrrrcellsrrr"rrr jupyterr measurer rr textrrr=syspip._vendor.rich.consoleargv IndexErrorprintrrrrs&      i