
    F\h                         S SK r S SKrSS jrSS jrS rS rS r\ R                  R                  \ R                  R                  SS5      5      SS r
\
4S	 jrC
S
 r " S S\5      rSq\" SS9  g)    Nc                    U nUb  [        U[        [        45      (       a  [        SS[	        U5       SU< 3-   5      e[        [        [        R                  R                  U5      5      (       d  [        [        U5      5      eUnOD[        R                  R                  SS 5      nUc  [        R                  " S5      n[!        XA5      n[#        U5      qg )Nz!tzpaths must be a list or tuple, znot z: PYTHONTZPATHTZPATH)
isinstancestrbytes	TypeErrortypeallmapospathisabs
ValueError_get_invalid_paths_messageenvironget	sysconfigget_config_var_parse_python_tzpathtupler   )to
stackleveltzpathsbase_tzpathenv_vars        '/usr/lib/python3.13/zoneinfo/_tzpath.py_reset_tzpathr      s     GgU|,,3gr'56 
 3rww}}g.//7@AA**..6?..x8G*7?;F    c                     [        U 5        g)zReset global TZPATH.N)r   )r   s    r   reset_tzpathr!      s    
 "r   c                 ,   U (       d  gU R                  [        R                  5      n[        [	        [        R
                  R                  U5      5      n[        U5      [        U5      :w  a'  SS Kn[        U5      nUR                  SU-   [        US9  U$ )N r   z>Invalid paths specified in PYTHONTZPATH environment variable. r   )splitr   pathsepr   filterr   r   lenwarningsr   warnInvalidTZPathWarning)r   r   
raw_tzpath
new_tzpathr)   msgs         r   r   r   $   s|    rzz*JvbggmmZ89J :#j/)(4L !	 	 	
 r   c                 H    S U  5       nSnX"R                  U5      -   nSU-   $ )Nc              3   r   #    U  H-  n[         R                  R                  U5      (       a  M)  Uv   M/     g 7fN)r   r   r   ).0r   s     r   	<genexpr>-_get_invalid_paths_message.<locals>.<genexpr><   s!     IgdRWW]]45HTTgs   (7	7z
    z@Paths should be absolute but found the following relative paths:)join)r   invalid_pathsprefixindented_strs       r   r   r   ;   s5    IgIMFKK66L 	K
	r   c                     [        U 5        [         HJ  n[        R                  R	                  X5      n[        R                  R                  U5      (       d  MH  Us  $    g)z,Retrieve the path to a TZif file from a key.N)_validate_tzfile_pathr   r   r   r5   isfile)keysearch_pathfilepaths      r   find_tzfiler?   G   sC    #77<<177>>(##O 
 r   _c                    [         R                  R                  U 5      (       a  [        SU  35      e[         R                  R	                  U 5      n[        U5      [        U 5      :w  a  [        SU  35      e[         R                  R	                  [         R                  R                  X5      5      nUR                  U5      (       d  [        SU  35      eg )Nz.ZoneInfo keys may not be absolute paths, got: z6ZoneInfo keys must be normalized relative paths, got: z;ZoneInfo keys must refer to subdirectories of TZPATH, got: )r   r   r   r   normpathr(   r5   
startswith)r   _basenew_pathresolveds       r   r:   r:   U   s    	ww}}T<TFC
 	
 ww%H
8}D	!DTFK
 	
 wwU =>Hu%%I$P
 	
 &r   c                     SSK Jn   [        5       n U R                  S5      R	                  S5      R                  S5       nU H-  nUR                  5       nU(       d  M  UR                  U5        M/     SSS5        S n[         GH$  n[        R                  R                  U5      (       d  M*  [        R                  " U5       H  u  pgnXe:X  a.  SU;   a  UR                  S5        S	U;   a  UR                  S	5        U H  n	[        R                  R!                  Xi5      n
[        R                  R#                  XS
9n[        R$                  S:w  a   UR'                  [        R$                  S5      nU(       a  X;   a  M  U" U
5      (       d  M  UR                  U5        M     M     GM'     SU;   a  UR                  S5        U$ ! , (       d  f       GNZ= f! [        [        4 a     GNpf = f)a  Returns a set containing all available time zones.

.. caution::

    This may attempt to open a large number of files, since the best way to
    determine if a given file on the time zone search path is to open it
    and check for the "magic string" at the beginning.
r   )	resourcestzdatazonesrNc                      [        U S5       nUR                  S5      S:H  sS S S 5        $ ! , (       d  f       g = f! [         a     gf = f)Nrb   s   TZifF)openread	Exception)fpathfs     r   	valid_key&available_timezones.<locals>.valid_key   s@    	eT"avvayG+ #"" 		s#   = ,	= 
:= = 
A
	A
rightposix)start/
posixrules)	importlibrI   setfilesjoinpathrP   stripaddImportErrorFileNotFoundErrorr   r   r   existswalkremover5   relpathsepreplace)rI   valid_zonesrT   zonerU   tz_rootrootdirnamesr^   filerS   r<   s               r   available_timezonesrp   o   s    $%K__X&//8==cBazz|4OOD)  C 6ww~~g&&%'WWW%5!DE h&OOG,h&OOG,T0ggooeo;66S=++bffc2Cc0U##OOC(  &6	 4 {" 	<(] CB
 *+ s5   /G G G5G 
GG G G.-G.c                       \ rS rSrSrSrg)r+      z?Warning raised if an invalid path is specified in PYTHONTZPATH.r#   N)__name__
__module____qualname____firstlineno____doc____static_attributes__r#   r   r   r+   r+      s    Ir   r+   r#      r$   )NrO   r1   )r   r   r   r!   r   r   r?   r   rC   r5   
_TEST_PATHr:   rp   RuntimeWarningr+   r   r#   r   r   <module>r|      s    	  ..	 WWbggll345cr:
 '1 
. >BJ> J 
  r   