L i` UddlmZddlZddlmZmZmZmZddlm Z ddl m Z erddl m Z eZded<eZded <eZded <eZded <Gd d eZddZej,dZddZddZy)) annotationsN) TYPE_CHECKINGTextIO TypeAlias TypedDict) NotRequired)extract_leading_emoji)PathrPageHashPageName ScriptPathIconc@eZdZUded<ded<ded<ded<d ed <y ) PageInfor script_pathr page_script_hashzNotRequired[Icon]iconzNotRequired[PageName] page_namezNotRequired[str] url_pathnameN)__name__ __module__ __qualname____annotations__[/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/source_util.pyrr!s  $$""rrc^ddl}t|dr|j|St|dS)a8Open a read-only Python file taking proper care of its encoding. In Python 3, we would like all files to be opened with utf-8 encoding. However, some author like to specify PEP263 headers in their source files with their own encodings. In that case, we should respect the author's encoding. rNopenzutf-8)encoding)tokenizehasattrr)filenamer s ropen_python_filer#)s/x }}X&& 7 ++rz([0-9]*)[_ -]*(.*)\.pyctjt|j}t |dk(rt |d|\\}}|j }|dk(r td|fSt||fS)Nrz0 is not a Python file. This should never happen.inf)refindallPAGE_FILENAME_REGEXnamelen ValueErrorlowerfloat)rmatchesnumberlabels r page_sort_keyr2=s}jj,k.>.>?G 7|qmK L   _fe KKME |e e$$ &M5 !!rctjt|j}|ytjdd|j dj xs|j d}t|S)aCompute the icon and name of a page from its script path. This is *almost* the page name displayed in the nav UI, but it has underscores instead of spaces. The reason we do this is because having spaces in URLs both looks bad and is hard to deal with due to the need to URL-encode them. To solve this, we only swap the underscores for spaces right before we render page names. )r%r%z[_ ]+_)r'searchr)r*subgroupstripr )r extraction icon_and_names rpage_icon_and_namer=Psn(*yy1DkFVFV'WJFF#z''* eg%!!!$ ! //r)r"strreturnr)rr r?ztuple[float, str])rr r?ztuple[str, str]) __future__rr'typingrrrrtyping_extensionsrstreamlit.string_utilr pathlibr r>r rr r rrr#compiler)r2r=rrrrFsv# >>)7)) Ii#y#,"!bjj!:;"&0r