L i hdZddlmZddlZddlZddlmZddlmZm Z d dZ d dZ d dZ dd Z d d Zy)zUtilities related to the CLI.) annotationsN)Any)env_utilerrorsc l ddl}|j|fi|y#t$rt|dYywxYw)zPrint a message to the terminal using click if available, else print using the built-in print function. You can provide any keyword arguments that click.secho supports. rNT)flush)clicksecho ImportErrorprintmessagekwargsr s X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/cli_util.py print_to_clirs6 # G&v& # gT"#s 33c T ddl}|j|fi|S#t$r|cYSwxYw)zStyle a message using click if available, else return the message unchanged. You can provide any keyword arguments that click.style supports. rN)r styler r s r style_for_clir(s4u{{7-f-- s  ''c.ddl}|j|y)Nr) webbrowseropen)urlrs r_open_browser_with_webbrowserr7sOOCc||g}ttjd5}tj||tj dddy#1swYyxYw)Nw)stdoutstderr)rosdevnull subprocessPopenSTDOUT)commandrcmd_liner s r_open_browser_with_commandr&=sL~H bjj# M''*:K:KLMMMs 'AAcFtjr t|ytjr.tjdr t d|yt|ytj r t d|yddl}tjd|jd)aOpen a web browser pointing to a given URL. We use this function instead of Python's `webbrowser` module because this way we can capture stdout/stderr to avoid polluting the terminal with the browser's messages. For example, Chrome always prints things like "Created new window in existing browser session", and those get on the user's way. url : str The URL. Must include the protocol. Nzxdg-openrrz!Cannot open browser in platform "") r IS_WINDOWSrIS_LINUX_OR_BSDis_executable_in_pathr& IS_DARWINplatformrErrorsystem)rr-s r open_browserr0Cs0%c*  ) )* 5 &z3 7 %c*"63/ ,,:8??;L:MQO PPr)rstrrrreturnNone)rr1rrr2r1)rr1r2r3)r$r1rr1r2r3)__doc__ __future__rrr!typingr streamlitrrrrrr&r0rrr9s4$" & #  M 'Qr