
    %e                     t    d dl Z d dlZd dlmZ  e j        d          ZdedefdZdedee         fdZd Z	dS )	    N)Optionalzt(?P<base>https:\/\/?(gist\.)?github.com\/)(?P<account>([\w\.]+\/){1,2})(?P<blob_or_raw>(blob|raw))?(?P<suffix>(.+)?)urlreturnc                     t                               |           }|r@|                                }|d         dk    r dj        di |S |d         dk    r| S | dz   S | S )zCheck url to see if it describes a GitHub Gist "blob" URL.

    If so, returns a new URL to get the "raw" script.
    If not, returns URL unchanged.
    blob_or_rawblobz{base}{account}raw{suffix}rawz/raw )_GITBLOB_REmatch	groupdictformat)r   r   mdicts      2lib/python3.11/site-packages/streamlit/url_util.pyprocess_gitblob_urlr      s     c""E !!6))6/6????? 5((J V|J    c                 `    d| vrd| z  } t           j                            |           }|j        S )z8Return the hostname of a URL (with or without protocol).z://z	http://%s)urllibparseurlparsehostname)r   parseds     r   get_hostnamer   5   s6     CC\""3''F?r   c                 r    ddl }|                    d| z  dd           |                    |d           dS )	z#Pretty-print a URL on the terminal.r   Nz  %s: Fblue)nlfgT)bold)clicksecho)titler   r   s      r   	print_urlr"   @   sD    LLL	KK5 UvK666	KK$Kr   )
rer   typingr   compiler   strr   r   r"   r
   r   r   <module>r'      s    
			        bj S S    2c hsm             r   