U cfe @s UddlZddlZddlZddlZddlZddlZddlmZmZddl m Z m Z ddl m Z ddl mZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZmZmZdd lmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,ddl-m.Z.ej/dkr8ddlm0Z0m1Z1m2Z2nddl3m0Z0m1Z1m2Z2ddl4m5Z5m6Z6ddl7m7Z7ddl8m9Z9m:Z:ddl;mZ>m?Z?ddl@mAZAmBZBddlCmDZDmEZEddlFmGZGddlHmIZIddlJmKZKmLZLddlMmNZOddlPmQZQmRZRddlSmTZTmUZUddlVmWZWmXZXdd lYmZZZdd!l[m\Z\dd"l]m^Z^dd#l_m`Z`dd$lambZbdd%lcmdZdmeZedd&lfmgZgdd'lhmiZimjZjmkZkdd(llmmZmmnZndd)lompZpmqZqerdd*lrmsZsdd+ltmuZudd,lvmwZwd-Zxd.Zyezd/kZ{e!e+e|d0fgd0fZ}e0d1Z~e0d2ZGd3d4d4ZeZzejZWnek rDdZYnXzejZWnek rndZYnXzejZWnek rd5ZYnXeeefZeefZeDjeDjeDjd6ZGd7d8d8e&Ze Gd9d:d:Ze2Gd;d<dd>e1Ze+eee|fZe#e+eebfZeKZGd?d@d@eZGdAdBdBZGdCdDdDZGdEdFdFZGdGdHdHZGdIdJdJZGdKdLdLZGdMdNdNZdee!dPe!dPeffdQdRdSZedTdUdVZeDjeDjeDjeDj{dWZdXdYeDZe GdZd[d[ejZGd\d]d]eZdae'd^ed_<d^dTd`daZedTdbdcZGdddedeZe|e|dfdgdhZedikredOdjZedkdldmdOdnddodpdqdrdsdtduedvdweeedgdOdxdydzd{d|gd|d}d~dndddddgdd}ddd5dtdgdd}ddddS)N)ABCabstractmethod) dataclassfield)datetime)wraps)getpass)escape)isclass)islice)ceil) monotonic) FrameType ModuleType TracebackType)IO TYPE_CHECKINGAnyCallableDictIterableListMapping NamedTupleOptionalTextIOTupleTypeUnioncast) NULL_FILE))LiteralProtocolruntime_checkable)errorsthemes)_emoji_replace)CONSOLE_HTML_FORMATCONSOLE_SVG_FORMAT) get_fileno)FormatTimeCallable LogRender)Align AlignMethod) ColorSystem blend_rgb)Control) EmojiVariant)NullHighlighterReprHighlighterrender) Measurementmeasure_renderables)Pager SystemPager)Pretty is_expandable) rich_cast)Region) render_scope)Screen)Segment)Style StyleTypeStyled)DEFAULT_TERMINAL_THEMESVG_EXPORT_THEME TerminalTheme)TextTextType)Theme ThemeStack)WindowsConsoleFeatures)LiveStatussdWindowsrK)defaultleftcenterrightfull)foldcropellipsisignorec@s eZdZdS)NoChangeN)__name__ __module__ __qualname__rcrcF/opt/hc_python/lib/python3.8/site-packages/pip/_vendor/rich/console.pyr_Vsr_)kitty256color16colorc@s"eZdZUdZeed<eed<dS)ConsoleDimensionszSize of the terminal.widthheightN)r`rarb__doc__int__annotations__rcrcrcrdrits ric @seZdZUdZeed<eed<eed<eed<eed<eed<eed<d Z e e ed <d Z e e ed <d Ze eed <d Ze eed<d Ze eed<d Ze eed<eedddZddddZeeeeeeeeed eeefeeefeeefee e efee e efee eefee eefee eefee eefdd ddZeddddZeddddZddd d!Zeedd"d#d$Zd S)%ConsoleOptionsz$Options for __rich_console__ method.sizelegacy_windows min_width max_width is_terminalencoding max_heightNjustifyoverflowFno_wrap highlightmarkuprkreturncCs|jd S)z+Check if renderables should use ascii only.utf)ru startswithselfrcrcrd ascii_onlyszConsoleOptions.ascii_onlycCstt}|j|_|S)zdReturn a copy of the options. Returns: ConsoleOptions: a copy of self. )ro__new____dict__copyroptionsrcrcrdrs  zConsoleOptions.copy) rjrrrsrwrxryrzr{rk) rjrrrsrwrxryrzr{rkr}c Cs|} t|ts$td|| _| _t|ts4|| _t|tsD|| _t|tsT|| _t|tsd|| _t|tst|| _t|ts|| _ t|ts|| _ t| ts| dk r| | _ | dkrdntd| | _ | S)zUpdate values, return a copy.rN) r isinstancer_maxrrrsrwrxryrzr{rvrk) rrjrrrsrwrxryrzr{rkrrcrcrdupdates,         zConsoleOptions.updaterjr}cCs|}td||_|_|S)zUpdate just the width, return a copy. Args: width (int): New width (sets both min_width and max_width) Returns: ~ConsoleOptions: New console options instance. r)rrrrrs)rrjrrcrcrd update_widths zConsoleOptions.update_widthrkr}cCs|}||_|_|S)zUpdate the height, and return a copy. Args: height (int): New height Returns: ~ConsoleOptions: New Console options instance. )rrvrk)rrkrrcrcrd update_heights  zConsoleOptions.update_heightcCs|}d|_|S)zReturn a copy of the options with height set to ``None``. Returns: ~ConsoleOptions: New console options instance. N)rrkrrcrcrd reset_heightszConsoleOptions.reset_height)rjrkr}cCs*|}td||_|_||_|_|S)aUpdate the width and height, and return a copy. Args: width (int): New width (sets both min_width and max_width). height (int): New height. Returns: ~ConsoleOptions: New console options instance. r)rrrrrsrkrv)rrjrkrrcrcrdupdate_dimensionss  z ConsoleOptions.update_dimensions)r`rarbrlrirnboolrmstrrwr JustifyMethodrxOverflowMethodryrzr{rkpropertyrr NO_CHANGErr_rrrrrrcrcrcrdro}sT      %   roc@s(eZdZdZeddefdddZdS)RichCastz5An object that may be 'cast' to a console renderable.ConsoleRenderabler|cCsdSNrcrrcrcrd__rich__szRichCast.__rich__N)r`rarbrlrrrrcrcrcrdrs rc@s"eZdZdZddddddZdS) rz-An object that supports the console protocol.Consolero RenderResultconsolerr}cCsdSrrcrrrrcrcrd__rich_console__sz"ConsoleRenderable.__rich_console__N)r`rarbrlrrcrcrcrdr s rc@seZdZdZdS) CaptureErrorz(An error in the Capture context manager.N)r`rarbrlrcrcrcrdr!src@s8eZdZdZd eddddZddeed d d ZdS) NewLinez$A renderable to generate new line(s)r&Ncountr}cCs ||_dSr)rrrrcrcrd__init__(szNewLine.__init__rrorccstd|jVdS)N )rCrrrcrcrdr+szNewLine.__rich_console__)r&) r`rarbrlrmrrrCrrcrcrcrdr%s rc@s>eZdZdZeeeeeddddZdee ddd Z dS) ScreenUpdatez)Render a list of lines at a given offset.Nlinesxyr}cCs||_||_||_dSr)_linesrr)rrrrrcrcrdr4szScreenUpdate.__init__rrccs>|j}tj}t|j|jD]\}}|||V|EdHqdSr)rr3move_to enumeraterr)rrrrroffsetlinercrcrdr9s  zScreenUpdate.__rich_console__) r`rarbrlrrCrmrrorrrcrcrcrdr1s rc@s`eZdZdZdddddZdddd Zeeeeeee dd d d Z e dd dZ dS)CapturezContext manager to capture the result of printing to the console. See :meth:`~rich.console.Console.capture` for how to use. Args: console (Console): A console instance to capture output. rN)rr}cCs||_d|_dSr)_console_result)rrrcrcrdrKszCapture.__init__r|cCs|j|Sr)r begin_capturerrcrcrd __enter__Os zCapture.__enter__exc_typeexc_valexc_tbr}cCs|j|_dSr)r end_capturerrrrrrcrcrd__exit__SszCapture.__exit__cCs|jdkrtd|jS)zGet the result of the capture.Nz.decorator.._replace)rrr)rrr)rrd decoratorszgroup..decorator)rrrr)rrrcrrdgroups  rr|cCsfztWntk rYdSXt}|jj}dt|jksNtdsN|dkrRdS|dkr^dSdSdS)z-Check if we're running in a Jupyter notebook.Fz google.colabDATABRICKS_RUNTIME_VERSIONZMQInteractiveShellTTerminalInteractiveShellN) get_ipython NameError __class__r`rosgetenv)ipythonshellrcrcrd _is_jupyters  r)standard256 truecolorwindowscCsi|]\}}||qSrcrc).0namesystemrcrcrd !src@s<eZdZUdZeed<eedZe e ed<dZ e ed<dS)ConsoleThreadLocalsz(Thread local values for Console context. theme_stack)default_factoryrr buffer_indexN) r`rarbrlrNrnrrrrrCrrmrcrcrcrdr$s rc@s,eZdZdZeeeeedddZdS) RenderHookz(Provides hooks in to the render process.)rr}cCsdS)aLCalled with a list of objects to render. This method can return a new list of renderables, or modify and return the same list. Args: renderables (List[ConsoleRenderable]): A number of renderable objects. Returns: List[ConsoleRenderable]: A replacement list of renderables. Nrc)rrrcrcrdprocess_renderables0szRenderHook.process_renderablesN)r`rarbrlrrrrrcrcrcrdr-s rrO_windows_console_featurescCs"tdk r tSddlm}|atS)Nr&get_windows_console_features)r _windowsr r rcrcrdr Cs  r cCsto tj S)zDetect legacy Windows.)WINDOWSr vtrcrcrcrddetect_legacy_windowsMsrc @seZdZUdZejZeeefe d<dddddddddddddddddddddde dddddd e e d e e e e e e e e ee e eee e ee ee ee e ee e e e ee e e eeefe d e e e e egefe egefe eeefd d d ZedddZeeedddZejeeddddZeeedddZeedddZ e jeddddZ ee!dddZ"e e#dddZ$dddd Z%ddd!d"Z&d#dd$d%d&Z'ddd'd(Z(e)dd)d*d+Z*ddd,d-Z+ddd.d/Z,e-e-e-dd0d1d2Z.ddd3d4Z/edd5d6Z0dd7ee dd8d9d:Z1ddd;d<Z2dd7ee e3d8d=d>Z4ee edd?d@Z5eeddAdBZ6ee ddCdDZ7ee ddEdFZ8ee9ddGdHZ:ee;ddIdJZe>jeddOdPdNZ>eeddQdRZ?e?jeddSdTdRZ?dddUdVZ@eAddWdXZBde eCe e eDdYdZd[ZEdedd]d^d_ZFde dd`dadbZGdcdddedfdgeHeeeedhdidjdkZIde e dldmdnZJde e dodpdqZKee ddrdsZLee dtdudvZMde e edwdxdydzZNdd{eHe e9eOd|d}d~ZPdeHe e9eQed|ddZRdddddeHe e9e eSe e eeedddZTddddddddeeeeSfe eUe eVe e e e e e e eWdd ddZXddeeeSfe eeSefeSdddZYdddddeQe-eee eUe e e e e e eeZdddZ[ddddde\eeeeSfe]ddddZ^e_ddddZ`ddddde-eee eeeSfe e ddddZaddddddddddddddde-eee eeeSfe eUe eVe e e e e e e e e ee ee e e e ddddZbddddddddddd e ee-edeefe e e e e e ee-ge-fe dd ddZcdddeHe ede e9ddddZedeeeeeddddZfdddddddde eee ee e eQeeegfeddddZheiejjkfeege elfe=eeemee-ffdddZnddddddddd\d e-eee eeeSfe eUe e e e e e e edd ddZoddddÄZpeQeedĜddƄZqddddddǜe\e e e e eredȜddʄZsddd˜e e ed̜dd΄Ztddd˜ee e ddϜddфZudddddҜe eve e ee edӜddՄZwddexddҜee eve ee dd֜dd؄Zydddezdddۜee eve eee eedܜddބZ{dddezdddۜeee eve eee eddߜddZ|dS)rar A high level console interface. Args: color_system (str, optional): The color system supported by your terminal, either ``"standard"``, ``"256"`` or ``"truecolor"``. Leave as ``"auto"`` to autodetect. force_terminal (Optional[bool], optional): Enable/disable terminal control codes, or None to auto-detect terminal. Defaults to None. force_jupyter (Optional[bool], optional): Enable/disable Jupyter rendering, or None to auto-detect Jupyter. Defaults to None. force_interactive (Optional[bool], optional): Enable/disable interactive mode, or None to auto detect. Defaults to None. soft_wrap (Optional[bool], optional): Set soft wrap default on print method. Defaults to False. theme (Theme, optional): An optional style theme object, or ``None`` for default theme. stderr (bool, optional): Use stderr rather than stdout if ``file`` is not specified. Defaults to False. file (IO, optional): A file object where the console should write to. Defaults to stdout. quiet (bool, Optional): Boolean to suppress all output. Defaults to False. width (int, optional): The width of the terminal. Leave as default to auto-detect width. height (int, optional): The height of the terminal. Leave as default to auto-detect height. style (StyleType, optional): Style to apply to all output, or None for no style. Defaults to None. no_color (Optional[bool], optional): Enabled no color mode, or None to auto detect. Defaults to None. tab_size (int, optional): Number of spaces used to replace a tab character. Defaults to 8. record (bool, optional): Boolean to enable recording of terminal output, required to call :meth:`export_html`, :meth:`export_svg`, and :meth:`export_text`. Defaults to False. markup (bool, optional): Boolean to enable :ref:`console_markup`. Defaults to True. emoji (bool, optional): Enable emoji code. Defaults to True. emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None. highlight (bool, optional): Enable automatic highlighting. Defaults to True. log_time (bool, optional): Boolean to enable logging of time by :meth:`log` methods. Defaults to True. log_path (bool, optional): Boolean to enable the logging of the caller by :meth:`log`. Defaults to True. log_time_format (Union[str, TimeFormatterCallable], optional): If ``log_time`` is enabled, either string for strftime or callable that formats the time. Defaults to "[%X] ". highlighter (HighlighterType, optional): Default highlighter. legacy_windows (bool, optional): Enable legacy Windows mode, or ``None`` to auto detect. Defaults to ``None``. safe_box (bool, optional): Restrict box options that don't render on legacy Windows. get_datetime (Callable[[], datetime], optional): Callable that gets the current time as a datetime.datetime object (used by Console.log), or None for datetime.now. get_time (Callable[[], time], optional): Callable that gets the current time in seconds, default uses time.monotonic. _environautoNFr"Tz[%X]) color_systemforce_terminal force_jupyterforce_interactive soft_wraprstderrfilequietrjrkrno_colortab_sizerecordr{emoji emoji_variantrzlog_timelog_pathlog_time_format highlighterrqsafe_box get_datetimeget_timer)rrrrrHighlighterTypec!Csl|dk r||_|dkrtn||_|jr| dkrZ|jd}|dk rV|rVt|} nt} | dkr|jd}|dk r|rt|} nt} ||_||_ ||_ ||_ ||_ ||_ |dkrto|j n||_| dkr|jd}|dk r|rt||j} | dkr0|jd} | dk r0| r0t| } ||_| |_| |_|d|_|dk r\||_||_| |_||_|dkrd|_n |dkr||_n t||_t|_t|||d|_|pt|_ ||_!|pt"j#|_$|pt%|_&| |_'| dk r| nd|jk|_(|dkr |j)o"|j* n||_+t|_,t-t.|dkrDt/j0n|d|_1g|_2g|_3d|_4d |_5dS) NJUPYTER_COLUMNS JUPYTER_LINESCOLUMNSLINESr) show_time show_path time_formatNO_COLOR)rF)6rr is_jupyterrisdigitrmJUPYTER_DEFAULT_COLUMNSJUPYTER_DEFAULT_LINESrr_markup_emoji_emoji_variant _highlightrrqr_width_height_force_terminal_filerr _color_system_detect_color_system COLOR_SYSTEMS threadingRLockrr. _log_render_null_highlighterr"r#rnowr$r r%rrrtis_dumb_terminalis_interactive_record_buffer_lockrrNr(DEFAULT_thread_locals_record_buffer _render_hooks_live_is_alt_screen)!rrrrrrrrrrrjrkrrrrr{rrrzrr r!r"rqr#r$r%rjupyter_columns jupyter_linescolumnsrrcrcrdrxs#                zConsole.__init__r|cCsd|jd|jdS)Nz)rjr;rrcrcrd__repr__szConsole.__repr__cCs4|jp|jrtjntj}t|d|}|dkr0t}|S)z Get the file object to write to.rich_proxied_fileN)r:rsysstdoutgetattrr )rrrcrcrdrs  z Console.file)new_filer}cCs ||_dS)zSet a new file object.N)r:)rrVrcrcrdrscCs|jjSzGet a thread local buffer.)rGrrrcrcrdrszConsole._buffercCs|jjSrWrGrrrcrcrd _buffer_index szConsole._buffer_indexvaluer}cCs ||j_dSrrX)rr[rcrcrdrYscCs|jjS)z!Get the thread local theme stack.)rGrrrcrcrd _theme_stackszConsole._theme_stackcCs|jr tjS|jr|jrdStrD|jr,tjSt}|jr>tjStj S|j dd }|dkrhtjS|j dd }|d\}}}t |tj}|SdS)z"Detect color system from env vars.N COLORTERMr)r24bitTERM-)r/r1 TRUECOLORrtrCr rqr r EIGHT_BITrrstriplower rpartition _TERM_COLORSSTANDARD)rwindows_console_features color_termterm _term_name_hyphencolorsrrcrcrdr<s& zConsole._detect_color_systemcCs|jd7_dS)z4Enter in to a buffer context, and buffer all output.r&N)rYrrcrcrdr0szConsole._enter_buffercCs|jd8_|dS)z5Leave buffer context, and render content if required.r&N)rY _check_bufferrrcrcrdr4szConsole._exit_bufferrP)liver}c Cs0|j |jdk rtd||_W5QRXdS)zSet Live instance. Used by Live context manager. Args: live (Live): Live instance using this Console. Raises: errors.LiveError: If this Console has a Live context currently active. Nz+Only one live display may be active at once)rrJr' LiveError)rrorcrcrdset_live9s   zConsole.set_livec Cs|j d|_W5QRXdS)zClear the Live instance.N)rrJrrcrcrd clear_liveGszConsole.clear_live)hookr}c Cs"|j|j|W5QRXdS)zpAdd a new render hook to the stack. Args: hook (RenderHook): Render hook instance. N)rrIappend)rrsrcrcrdpush_render_hookLszConsole.push_render_hookc Cs |j|jW5QRXdS)z'Pop the last renderhook from the stack.N)rrIpoprrcrcrdpop_render_hookUszConsole.pop_render_hookcCs ||S)z,Own context manager to enter buffer context.rrrcrcrdrZszConsole.__enter__)r exc_value tracebackr}cCs |dS)zExit buffer context.N)r)rrryrzrcrcrdr_szConsole.__exit__cCs |dS)z`Begin capturing console output. Call :meth:`end_capture` to exit capture mode and return output.NrxrrcrcrdrcszConsole.begin_capturecCs$||j}|jdd=||S)zhEnd capture mode and return captured string. Returns: str: Console output. N)rrr)r render_resultrcrcrdrgs  zConsole.end_capturer)rrr}cCs|jj||ddS)aPush a new theme on to the top of the stack, replacing the styles from the previous theme. Generally speaking, you should call :meth:`~rich.console.Console.use_theme` to get a context manager, rather than calling this method directly. Args: theme (Theme): A theme instance. inherit (bool, optional): Inherit existing styles. Defaults to True. r|N)r\rrrrrcrcrdrrs zConsole.push_themecCs|jdS)z9Remove theme from top of stack, restoring previous theme.N)r\rrrcrcrdr}szConsole.pop_themecCs t|||S)aUse a different theme for the duration of the context manager. Args: theme (Theme): Theme instance to user. inherit (bool, optional): Inherit existing console styles. Defaults to True. Returns: ThemeContext: [description] )rr}rcrcrd use_themes zConsole.use_themecCs|jdk rt|jSdSdS)zpGet color system string. Returns: Optional[str]: "standard", "256" or "truecolor". N)r;_COLOR_SYSTEMS_NAMESrrcrcrdrs  zConsole.color_systemcCst|jddpdS)zGet the encoding of the console file, e.g. ``"utf-8"``. Returns: str: A standard encoding string. ruutf-8)rUrrdrrcrcrdruszConsole.encodingcCs|jdk r|jSttjdr.tjjdr.dS|jr8dS|jd}|dk rVd|_dSt |j dd}z|dkrrdn|WSt k rYdSXdS)zCheck if the console is writing to a terminal. Returns: bool: True if the console writing to a device capable of understanding terminal codes, otherwise False. NraidlelibF FORCE_COLORTisatty) r9hasattrrSstdinrarr/rrrUr ValueError)r force_colorrrcrcrdrts"  zConsole.is_terminalcCs$|jdd}|dk}|jo"|S)zxDetect dumb terminal. Returns: bool: True if writing to a dumb terminal, otherwise False. r_r)dumbunknown)rrrdrt)r_termis_dumbrcrcrdrCs zConsole.is_dumb_terminalc Cs$t|jj|j|jd|j|j|jdS)zGet default console options.r&)rvrprqrrrsrurt)rorprkrqrjrurtrrcrcrdrszConsole.optionsc Cs<|jdk r(|jdk r(t|j|j|jS|jr8tddSd}d}trrzt\}}Wqtt t fk rnYqXn>> from rich.console import Console >>> console = Console() >>> with console.capture() as capture: ... console.print("[bold magenta]Hello World[/]") >>> print(capture.get()) Returns: Capture: Context manager with disables writing to the terminal. )r)rcapturercrcrdrAszConsole.capture)rrrr}cCst||||dS)aA context manager to display anything printed within a "pager". The pager application is defined by the system and will typically support at least pressing a key to scroll. Args: pager (Pager, optional): A pager object, or None to use :class:`~rich.pager.SystemPager`. Defaults to None. styles (bool, optional): Show styles in pager. Defaults to False. links (bool, optional): Show links in pager. Defaults to False. Example: >>> from rich.console import Console >>> from rich.__main__ import make_test_card >>> console = Console() >>> with console.pager(): console.print(make_test_card()) Returns: PagerContext: A context manager. )rrr)r)rrrrrcrcrdrRsz Console.pagerr&rcCs"|dkstd|t|dS)zqWrite new line(s). Args: count (int, optional): Number of new lines. Defaults to 1. rzcount must be >= 0N)AssertionErrorrrrrcrcrdrisz Console.line)homer}cCs,|r|ttn|tdS)zClear the screen. Args: home (bool, optional): Also move the cursor to 'home' position. Defaults to True. N)rr3clearr)rrrcrcrdrssz Console.cleardotszstatus.spinnerg?g)@)spinner spinner_stylespeedrefresh_per_secondrR)statusrrrrr}cCs$ddlm}|||||||d}|S)atDisplay a status and spinner. Args: status (RenderableType): A status renderable (str or Text typically). spinner (str, optional): Name of spinner animation (see python -m rich.spinner). Defaults to "dots". spinner_style (StyleType, optional): Style of spinner. Defaults to "status.spinner". speed (float, optional): Speed factor for spinner animation. Defaults to 1.0. refresh_per_second (float, optional): Number of refreshes per second. Defaults to 12.5. Returns: Status: A Status object that may be used as a context manager. r&rQ)rrrrr)rrR)rrrrrrrRstatus_renderablercrcrdr~s zConsole.status)rr}cCs|jr|t|dSdS)zqShow or hide the cursor. Args: show (bool, optional): Set visibility of the cursor. TF)rtrr3r)rrrcrcrdrszConsole.show_cursor)enabler}cCs.d}|jr*|js*|t|d}||_|S)aEnables alternative screen mode. Note, if you enable this mode, you should ensure that is disabled before the application exits. See :meth:`~rich.Console.screen` for a context manager that handles this for you. Args: enable (bool, optional): Enable (True) or disable (False) alternate screen. Defaults to True. Returns: bool: True if the control codes were written. FT)rtrqrr3 alt_screenrK)rrchangedrcrcrdrs  zConsole.set_alt_screencCs|jS)zCheck if the alt screen was enabled. Returns: bool: True if the alt screen was enabled, otherwise False. )rKrrcrcrd is_alt_screenszConsole.is_alt_screen)titler}cCs|jr|t|dSdS)aSet the title of the console terminal window. Warning: There is no means within Rich of "resetting" the window title to its previous value, meaning the title you set will persist even after your application exits. ``fish`` shell resets the window title before and after each command by default, negating this issue. Windows Terminal and command prompt will also reset the title for you. Most other shells and terminals, however, do not do this. Some terminals may require configuration changes before you can set the title. Some terminals may not support setting the title at all. Other software (including the terminal itself, the shell, custom prompts, plugins, etc.) may also set the terminal window title. This could result in whatever value you write using this method being overwritten. Args: title (str): The new title of the terminal window. Returns: bool: True if the control code to change the terminal title was written, otherwise False. Note that a return value of True does not guarantee that the window title has actually changed, since the feature may be unsupported/disabled in some terminals. TF)rtrr3r)rrrcrcrdset_window_titleszConsole.set_window_titler)rrr}cCst|||p ddS)auContext manager to enable and disable 'alternative screen' mode. Args: hide_cursor (bool, optional): Also hide the cursor. Defaults to False. style (Style, optional): Optional style for screen. Defaults to None. Returns: ~ScreenContext: Context which enables alternate screen on enter, and disables it on exit. r)rr)r)rrrrcrcrdrs zConsole.screenr)rrr}cCst||p|j|}|S)aMeasure a renderable. Returns a :class:`~rich.measure.Measurement` object which contains information regarding the number of characters required to print the renderable. Args: renderable (RenderableType): Any renderable or string. options (Optional[ConsoleOptions], optional): Options to use when measuring, or None to use default options. Defaults to None. Returns: Measurement: A measurement of the renderable. )r9rr)rrr measurementrcrcrdmeasureszConsole.measurec cs|p|j}|jdkrdSt|}t|dr@t|s@|||}n>t|trl|j||j |j d}|||}nt d|dz t |}Wn&tk rt d|dYnXt}|}|D](}t||r|Vq|||EdHqdS) akRender an object in to an iterable of `Segment` instances. This method contains the logic for rendering objects with the console protocol. You are unlikely to need to use it directly, unless you are extending the library. Args: renderable (RenderableType): An object supporting the console protocol, or an object that may be converted to a string. options (ConsoleOptions, optional): An options object, or None to use self.options. Defaults to None. Returns: Iterable[Segment]: An iterable of segments that may be rendered. r&Nr)rzr{zUnable to render zC; A str, Segment or object with __rich_console__ method is requiredzobject z is not renderable)rrsr?rr rrr render_strrzr{r'NotRenderableErroriter TypeErrorrCrr8) rrr_optionsrender_iterabletext_renderable iter_render_Segment render_outputrcrcrdr8s8       zConsole.render)rpad new_lines)rrrrrr}c Cs|j|p|j}|||}|r.t||}|j}|dk rFtd|}tttj ||j |||dd|} |jdk r|jt | } | dkr|rtd|j |tdgntd|j |gg} | | | | W5QRSQRXdS)aGRender objects in to a list of lines. The output of render_lines is useful when further formatting of rendered console text is required, such as the Panel class which draws a border around any renderable object. Args: renderable (RenderableType): Any object renderable in the console. options (Optional[ConsoleOptions], optional): Console options, or None to use self.options. Default to ``None``. style (Style, optional): Optional style to apply to renderables. Defaults to ``None``. pad (bool, optional): Pad lines shorter than render width. Defaults to ``True``. new_lines (bool, optional): Include " " characters at end of lines. Returns: List[List[Segment]]: A list of lines, where a line is a list of Segment objects. Nr)include_new_linesrrrOr) rrr8rC apply_stylerkrrr split_and_crop_linesrsrextend) rrrrrrrender_options _rendered render_heightr extra_linespad_linercrcrd render_lines:s<     zConsole.render_linesr)rrwrxrr{rzr"rK) textrrwrxrr{rzr"r}cCs|p|dko|j} |p"|dko"|j} |p4|dko4|j} | rZt||| |jd} || _|| _n"t| rnt||jdn||||d} | r|p|j nd} | dk r| t | }| | |S| S)aConvert a string to a Text instance. This is called automatically if you print or log a string. Args: text (str): Text to render. style (Union[str, Style], optional): Style to apply to rendered text. justify (str, optional): Justify method: "default", "left", "center", "full", or "right". Defaults to ``None``. overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to ``None``. emoji (Optional[bool], optional): Enable emoji, or ``None`` to use Console default. markup (Optional[bool], optional): Enable markup, or ``None`` to use Console default. highlight (Optional[bool], optional): Enable highlighting, or ``None`` to use Console default. highlighter (HighlighterType, optional): Optional highlighter to apply. Returns: ConsoleRenderable: Renderable object. N)rrr)default_variant)rwrxr) r4r3r6 render_markupr5rwrxrKr)r"r copy_styles)rrrrwrxrr{rzr" emoji_enabledmarkup_enabledhighlight_enabled rich_text _highlighterhighlight_textrcrcrdrus4   zConsole.render_str)rV)rrVr}c Cst|tr|Sz2|j|}|dkr.t|}|jr<|n|WStjk r}z6|dk rn| |WYSt d|d|dW5d}~XYnXdS)a Get a Style instance by its theme name or parse a definition. Args: name (str): The name of a style or a style definition. Returns: Style: A Style object. Raises: MissingStyle: If no style could be parsed from name. NzFailed to get style z; ) rrDr\rparselinkrr'StyleSyntaxError get_style MissingStyle)rrrVrerrorrcrcrdrs   zConsole.get_stylerwrr{rz)objectsseprrwrr{rzr}cs6g}|jgj} dkr:tddfdd } | t} |sP|dkrV|jrV|j} ddfdd } |D]} t| } t| tr| |j| ||| d qtt| t r| | qtt| t r| | qtt | r| t | | d qt| | t| qt| |j dk r2||j fd d |D}|S) aCombine a number of renderables and text into one renderable. Args: objects (Iterable[Any]): Anything that Rich can render. sep (str): String to write between print data. end (str): String to write at end of print data. justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``. emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Returns: List[ConsoleRenderable]: A list of things to render. )rWrXrYN)rr}cst|ttdSr)r/rr0)r)_appendrwrcrd align_appendsz2Console._collect_renderables..align_appendr|cs,r(td}|dS)N)rwr)rKjoinr)sep_text)rtrrwrrrcrd check_textsz0Console._collect_renderables..check_text)rr{r")r"csg|]}t|qSrcrFrrrrcrd sz0Console._collect_renderables..)rtrrAr6r"r?rrrrKrr>r=rr)rrrrrwrr{rzr append_textrrrrrc)rrtrrwrrrrd_collect_renderablessJ       zConsole._collect_renderablesu─z rule.linerX) charactersralign)rrrrr}cCs*ddlm}|||||d}||dS)uDraw a line with optional centered title. Args: title (str, optional): Text to render over the rule. Defaults to "". characters (str, optional): Character(s) to form the line. Defaults to "─". style (str, optional): Style of line. Defaults to "rule.line". align (str, optional): How to align the title, one of "left", "center", or "right". Defaults to "center". r&)Rule)rrrrN)rulerr)rrrrrrrrcrcrdrs z Console.rule)rr}c Gs0|js,||jdd|DW5QRXdS)zInsert non-printing control codes. Args: control_codes (str): Control codes, such as those that may move the cursor. css|] }|jVqdSr)segment)r_controlrcrcrd 6sz"Console.control..N)rCrr)rrrcrcrdr.szConsole.controlrOr)rrrrz)rrrrrzr}c Gs4|dd|D}|j|||ddddd|d dS)aOutput to the terminal. This is a low-level way of writing to the terminal which unlike :meth:`~rich.console.Console.print` won't pretty print, wrap text, or apply markup, but will optionally apply highlighting and a basic style. Args: sep (str, optional): String to write between print data. Defaults to " ". end (str, optional): String to write at end of print data. Defaults to "\\n". style (Union[str, Style], optional): A style to apply to output. Defaults to None. highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``. css|]}t|VqdSr)r)r_objectrcrcrdrKszConsole.out..FTr^)rrzrr{ryrxr\rN)rr)rrrrrzr raw_outputrcrcrdout8sz Console.out)rrrrwrxryrr{rzrjrkr\rnew_line_start)rrrrrwrxryrr{rzrjrkr\rrr}c Gs|s tf}| dkr|j} | r:|dkr*d}|dkr6d}d} |jdd}|.|j||||||| d}|D]}||}ql|jj||| dk rt| |jnt | ||| d}g}|j }|j }|dkr|D]}||||qn&|D] }|t |||||q|r:tddd |Dd kr:|d t | rl|jj }t j||jdd D]}||qZn |j |W5QRXdS) a[Print to the console. Args: objects (positional args): Objects to log to the terminal. sep (str, optional): String to write between print data. Defaults to " ". end (str, optional): String to write at end of print data. Defaults to "\\n". style (Union[str, Style], optional): A style to apply to output. Defaults to None. justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``. overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None. no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None. emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``. markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``. highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``. width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``. crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True. soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for Console default. Defaults to ``None``. new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``. NTr^Fr)rwrxrjrkryr{rzrcss|] }|jVqdSrrrrrcrcrdrsz Console.print..r&rr)rrrIrrrrminrjrrr8rCrrrr splitlinesinsertrrr)rrrrrwrxryrr{rzrjrkr\rrr render_hooksrrsr new_segmentsrr8r buffer_extendrrcrcrdrXsx%    z Console.printre) dataindentrz skip_keys ensure_asciicheck_circular allow_nanrV sort_keys) jsonrrrzrrrrrVrr}c Csxddlm} |dkr2| j|||||||| | d } n4t|tsLtd|d| |||||||| | d } |j| dddS) aPretty prints JSON. Output will be valid JSON. Args: json (Optional[str]): A string containing JSON. data (Any): If json is not supplied, then encode this data. indent (Union[None, int, str], optional): Number of spaces to indent. Defaults to 2. highlight (bool, optional): Enable highlighting of output: Defaults to True. skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False. ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False. check_circular (bool, optional): Check for circular references. Defaults to True. allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True. default (Callable, optional): A callable that converts values that can not be encoded in to something that can be JSON encoded. Defaults to None. sort_keys (bool, optional): Sort dictionary keys. Defaults to False. r)JSONN)rrzrrrrrVrz/json must be str. Did you mean print_json(data=z) ?T)r)pip._vendor.rich.jsonr from_datarrrr) rrrrrzrrrrrVrrjson_renderablercrcrd print_jsons:    zConsole.print_json)regionr)rrrr}c Csz|jstd|p|j}|dkrBd}}||j|jp<|j}n|\}}}}|||}|j||d} || ||dS)aUpdate the screen at a given offset. Args: renderable (RenderableType): A Rich renderable. region (Region, optional): Region of screen to update, or None for entire screen. Defaults to None. x (int, optional): x offset. Defaults to 0. y (int, optional): y offset. Defaults to 0. Raises: errors.NoAltScreen: If the Console isn't in alt screen mode. 0Alt screen must be enabled to call update_screenNrr) rr' NoAltScreenrrrsrkrupdate_screen_lines) rrrrrrrrjrkrrcrcrd update_screens     zConsole.update_screenrrcCs>|jstdt|||}||}|j||dS)aUpdate lines of the screen at a given offset. Args: lines (List[List[Segment]]): Rendered lines (as produced by :meth:`~rich.Console.render_lines`). x (int, optional): x offset (column no). Defaults to 0. y (int, optional): y offset (column no). Defaults to 0. Raises: errors.NoAltScreen: If the Console isn't in alt screen mode. rN)rr'rrr8rrrn)rrrr screen_updaterrcrcrdrs     zConsole.update_screen_linesrTr!rcrjrr word_wrap show_localssuppress max_frames)rjrrrrrrr}c Cs0ddlm}||||||||d} || dS)a Prints a rich render of the last exception and traceback. Args: width (Optional[int], optional): Number of characters used to render code. Defaults to 100. extra_lines (int, optional): Additional lines of code to render. Defaults to 3. theme (str, optional): Override pygments theme used in traceback word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False. show_locals (bool, optional): Enable display of local variables. Defaults to False. suppress (Iterable[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback. max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100. r&) TracebackrN)rzrr) rrjrrrrrrrrzrcrcrdprint_exception.s  zConsole.print_exception)r currentframer}cCsr|d7}|}|dk rP|r2|dk r2|j}|d8}q|dk s>t|jj|j|jfSt|}|j|j |j jfSdS)aEGet caller frame information. Args: offset (int): the caller offset within the current frame stack. currentframe (Callable[[], Optional[FrameType]], optional): the callable to use to retrieve the current frame. Defaults to ``inspect.currentframe``. Returns: Tuple[str, int, Dict[str, Any]]: A tuple containing the filename, the line number and the dictionary of local variables associated with the caller frame. Raises: RuntimeError: If the stack offset is invalid. r&N) f_backrf_code co_filenamef_linenof_localsinspectstackfilenamelinenoframe)rr r frame_inforcrcrd_caller_frame_infoQs    zConsole._caller_frame_info) rrrrwrr{rz log_locals _stack_offset) rrrrrwrr{rzrrr}c  sN| s tf} |jdd} |$|j| ||||||d} dk rTfdd| D} || \} }}| drrdn tj| }| tj d}|rdd| D}| t |d d |j || ||||d g} | D]}|| } qg}|j}|j}|j}| D]}||||q|jj}tj||jd d D]}||q0W5QRXdS)aXLog rich content to the terminal. Args: objects (positional args): Objects to log to the terminal. sep (str, optional): String to write between print data. Defaults to " ". end (str, optional): String to write at end of print data. Defaults to "\\n". style (Union[str, Style], optional): A style to apply to output. Defaults to None. justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``. emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to None. markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to None. highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to None. log_locals (bool, optional): Boolean to enable logging of locals where ``log()`` was called. Defaults to False. _stack_offset (int, optional): Offset of caller from end of call stack. Defaults to 1. Nrcsg|]}t|qSrcrFrrrcrdrszConsole.log...z [i]locals)r)rpathline_no link_pathFr)rrIrrrrrabspathreritemsrtrAr@r$rrr8rrrCrrj)rrrrrwrr{rzrrrrrrrlocalsrr locals_maprsrrr8rrrrrcrrdlogts^    z Console.logc Cs|jr|jdd=dS|jj|jrN|j|j|jddW5QRX|jdkr|jrddl m }||j| |jdd|jdd=nt rd}|j rt|j}|dk r|tk}|rddlm}ddlm}|jdd}|jr |jr tt|}||||jn| |jdd}|jj}d} zt|| krX||ng} | j} d} |d D]L} | t| | kr| r|d | | d} | | | t| 7} qp| r|d | | Wn4t k r}z|j!d |_!W5d}~XYnXnZ| |jdd}z|j|Wn4t k rl}z|j!d |_!W5d}~XYnX|j"|jdd=W5QRXdS) aQCheck if the buffer may be rendered. Render it if it can (e.g. Console.quiet is False) Rendering is supported on Windows, Unix and Jupyter environments. For legacy Windows consoles, the win32 API is called directly. This method will also record what it renders if recording is enabled via Console.record. Nrr&)displayF)LegacyWindowsTerm)legacy_windows_renderi TrzG *** You may need to add PYTHONIOENCODING=utf-8 to your environment ***)#rrrrrErHrrYr/jupyterr%rr rqr,r_STD_STREAMS_OUTPUTpip._vendor.rich._win32_consoler&"pip._vendor.rich._windows_rendererr'rr;rrC remove_colorwriterrtrrrUnicodeEncodeErrorreasonflush)rr%use_legacy_windows_renderfilenor&r'rrr- MAX_WRITEbatch batch_appendrprrrcrcrdrnsp           zConsole._check_buffer)rr}c Cszg}|j}|j}|j}|j }|jr2|r2t|}|D]4\}}} |rZ||j|||dq6|rb| s6||q6d|} | S)z)Render buffered output, and clear buffer.)rrqr) rtr;rqrtrrCr,r8r) rroutputrtrrq not_terminalrrrrenderedrcrcrdrs(    zConsole._render_buffer)r{rpasswordstream)promptr{rr9r:r}cCs@|r|j|||dd|r(td|d}n|r6|}nt}|S)a5Displays a prompt and waits for input from the user. The prompt may contain color / style. It works in the same way as Python's builtin :func:`input` function and provides elaborate line editing and history features if Python's builtin :mod:`readline` module is previously loaded. Args: prompt (Union[str, Text]): Text to render in the prompt. markup (bool, optional): Enable console markup (requires a str prompt). Defaults to True. emoji (bool, optional): Enable emoji (requires a str prompt). Defaults to True. password: (bool, optional): Hide typed text. Defaults to False. stream: (TextIO, optional): Optional file to read input from (rather than stdin). Defaults to None. Returns: str: Text read from stdin. r)r{rr)r:)rrreadlineinput)rr;r{rr9r:resultrcrcrdr=,s z Console.inputrr)rrr}c Csf|jstd|jH|r2ddd|jD}nddd|jD}|rX|jdd=W5QRX|S)aGenerate text from console contents (requires record=True argument in constructor). Args: clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``. styles (bool, optional): If ``True``, ansi escape codes will be included. ``False`` for plain text. Defaults to ``False``. Returns: str: String containing console contents. ITo export console contents set record=True in the constructor or instancercss&|]\}}}|r||n|VqdSrr7)rrr_rcrcrdr`sz&Console.export_text..css|]}|js|jVqdSr)rrrrcrcrdresN)rrrErrH)rrrrrcrcrd export_textNs    zConsole.export_text)rrrr}c Cs6|j||d}t|ddd}||W5QRXdS)aGenerate text from console and save to a given location (requires record=True argument in constructor). Args: path (str): Path to write text files. clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``. styles (bool, optional): If ``True``, ansi style codes will be included. ``False`` for plain text. Defaults to ``False``. r?wtrruN)rBopenr-)rrrrr write_filercrcrd save_textns zConsole.save_textrr code_format inline_styles)rrrIrJr}c Cs|jstdg}|j}|pt}d}|dkr0tn|} |j~|rtt|j D]\\} } } t | } | r| |} | j rd| j d| d} | rd| d| dn| } || qTni}tt|j D]t\} } } t | } | r6| |} | | t|d }| j r$d |d | j d| d} nd |d| d} || qg}|j}|D]&\}}|rR|d |d|dqRd|}| jd|||jj|jjd}|r|j dd=W5QRX|S)aIGenerate HTML from console contents (requires record=True argument in constructor). Args: theme (TerminalTheme, optional): TerminalTheme object containing console colors. clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``. code_format (str, optional): Format string to render HTML. In addition to '{foreground}', '{background}', and '{code}', should contain '{stylesheet}' if inline_styles is ``False``. inline_styles (bool, optional): If ``True`` styles will be inlined in to spans, which makes files larger but easier to cut and paste markup. If ``False``, styles will be embedded in a style tag. Defaults to False. Returns: str: String containing console contents as HTML. r@rNz zz          z)Console.export_svg..get_svg_stylegQ?r&(r")rr}cSst|ddS)z.HTML escape text and replace spaces with nbsp.rOz )r replacerrcrcrd escape_textA sz'Console.export_svg..escape_textN)rrattribsr}c s`ttddddfdd|D}|rNd|d|d|d |d Sd|d|d S) z.Make a tag from name, content, and attributes.rZcSst|trt|dSt|S)Ng)rfloatrTr)r[rcrcrd stringifyJ s  z7Console.export_svg..make_tag..stringifyrOc3s4|],\}}|dddd|dVqdS)rAr`z=""N)lstripry)rkvr~rcrdrO sz7Console.export_svg..make_tag..rrPz)objectrrr!)rrr{ tag_attribsrcrrdmake_tagE s z$Console.export_svg..make_tagz terminal-rcss|]}t|VqdSr)reprrrcrcrdra sz%Console.export_svg..rr^)lengthrTrect?? crispEdges)fillrrrjrkshape_renderingrOrr`zurl(#-line-))_classrr textLength clip_pathcsg|]}|dqS)rrc)rr) line_heightrcrdr sz&Console.export_svg..rc 3s@|]8\}}dd|ddd|dddVqdS) z rrr)rrrjrkz Nrc)rrr) char_widthrrrfrjrcrdr sc3s*|]"\}}dd|d|dVqdS).z-rz { z }Nrc)rrtrule_no)rfrcrdr szrgba(255,255,255,0.35)1)rstroke stroke_widthrrrjrkrxz-titlemiddlere)rr text_anchorrrz )rfr char_heightrterminal_widthterminal_heightrjrk terminal_x terminal_yrchrome backgroundsmatrixr)N)"pip._vendor.rich.cellsrgrDrrIrjrrrErrCrPrHrzlibadler32rencoderrrmrirUrVrkrlrjrWrtrranger!r rT)2rrrrrIrerfrgrvr margin_top margin_right margin_bottom margin_left padding_top padding_rightpadding_bottom padding_left padding_widthpadding_height margin_width margin_heighttext_backgrounds text_groupclassesstyle_norzrrrrrrrrules class_namehas_backgroundrOrl text_length line_offsetsrrrrrrr title_colorsvgrc)rYrrrrurfrjrd export_svgs& !                      zConsole.export_svg)rrrrrIrerfr}c Cs>|j||||||d}t|ddd} | |W5QRXdS)a7Generate an SVG file from the console contents (requires record=True in Console constructor). Args: path (str): The path to write the SVG to. title (str, optional): The title of the tab in the output image theme (TerminalTheme, optional): The ``TerminalTheme`` object to use to style the terminal clear (bool, optional): Clear record buffer after exporting. Defaults to ``True`` code_format (str, optional): Format string used to generate the SVG. Rich will inject a number of variables into the string in order to form the final SVG output. The default template used and the variables injected by Rich can be found by inspecting the ``console.CONSOLE_SVG_FORMAT`` variable. font_aspect_ratio (float, optional): The width to height ratio of the font used in the ``code_format`` string. Defaults to 0.61, which is the width to height ratio of Fira Code (the default font). If you aren't specifying a different font inside ``code_format``, you probably don't need this. unique_id (str, optional): unique id that is used as the prefix for various elements (CSS styles, node ids). If not set, this defaults to a computed value based on the recorded content. rdrCrrDN)rrEr-) rrrrrrIrerfrrFrcrcrdsave_svg szConsole.save_svg)NFF)r&)T)T)T)TN)N)N)r)N)rr)r)}r`rarbrlrenvironrrrrnr6rr#rrMrrmrEr4rr-rrr}rrQrrsetterrrCrrYrNr\r1r<rrrqrrrrurwrrrrrrrrr~rrurtrCrorrirprrjrkrrrr;rrrrrrrrrrrr9rrr8rDrrrr&rrrrrLr0rr3rrrrr@rrrr  staticmethodrr rrrr$rnrrr=rBrGrJr`r*rbr+rrrcrcrcrdrRsX #   |     #  -    ! !   6 ?  <  $ M    # e  A #   #% QO "  O " r) svg_main_coder}cCstt|S)zReturns a unique hash for the given SVG main code. Args: svg_main_code (str): The content we're going to inject in the SVG envelope. Returns: str: a hash of the given content )rrrr)rrcrcrd _svg_hash s r__main__)rzJSONRPC [i]request[/i]g?Fz2.0subtract*)minuend subtrahendr!)Zjsonrpcrparamsidz Hello, World!z{'a': 1}z&Which one is correct team name in NBA?zNew York BullszLos Angeles KingszGolden State Warriorsz Huston Rocket)questionrZanswer)answeredq1z 5 + 7 = ? z 12 - 8 = ?)rrq2)ZsportZmaths)remptyZquiz)T)rrplatformrSr>rabcrr dataclassesrrr functoolsrrrar r itertoolsr mathr timer typesrrrtypingrrrrrrrrrrrrrrrpip._vendor.rich._null_filer version_infor#r$r%Zpip._vendor.typing_extensionsrr'r(r)_export_formatr*r+_filenor,r@r-r.rr/r0rir1r2rr3rr4r"r5r6r{r8rrr9r:rr;r<prettyr=r>protocolr?rr@scoperArrBrrCrrDrEstyledrGterminal_themerHrIrJrrKrLrrMrNr rOrorPrrRr1r2rr rr&rrr_r __stdin__r2 _STDIN_FILENO Exception __stdout___STDOUT_FILENO __stderr___STDERR_FILENOrr)rbrgrfrirorrrrrArrrrrrrrrrrrar=r!rlocalrrr rnr rrrr`rr$rrrcrcrcrdsP        D                         !'/!" E