HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/test_zoneinfo/data/__pycache__/update_test_data.cpython-310.pyc
o

�i^�@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
gd�Ze�e
�jZejdd�ddd	��Zd dd�Zd!dd�Zd"dd�Zd#dd�Zd$d%dd�Zedkr`e�dSdS)&a�
Script to automatically generate a JSON file containing time zone information.

This is done to allow "pinning" a small subset of the tzdata in the tests,
since we are testing properties of a file that may be subject to change. For
example, the behavior in the far future of any given zone is likely to change,
but "does this give the right answer for this file in 2040" is still an
important property to test.

This must be run from a computer with zoneinfo data installed.
�)�annotationsN)zAfrica/AbidjanzAfrica/CasablancazAmerica/Los_AngeleszAmerica/Santiagoz
Asia/TokyozAustralia/Sydneyz
Europe/Dublinz
Europe/Lisbonz
Europe/LondonzPacific/Kiritimati�UTC)�maxsize�return�pathlib.PathcCs4d}ttjtj�D]}||��r|Sq	td��)zEGet the first zoneinfo directory on TZPATH containing the "UTC" zone.rzCannot find time zone data.)�map�pathlib�Path�zoneinfoZTZPATH�exists�OSError)�key�path�r�E/usr/local/lib/python3.10/test/test_zoneinfo/data/update_test_data.py�get_zoneinfo_path)s�r�typing.Dict[str, str]cCs�t�}|d}|��std��t|d��}t|�}Wd�n1s#wY|���dd�\}}|dd���rHt|�dksH|dd��	�sQt
d	d
|����d|iS)Nz	tzdata.ziz*Time zone data does not include tzdata.zi.�r� �r��zJVersion string should be YYYYx, where YYYY is the year and x is a letter; zfound: �version)rrr�open�next�strip�rsplit�isdigit�len�isalpha�
ValueError)rZ	tzdata_zi�fZversion_line�_rrrr�get_zoneinfo_metadata4s&
�����r#r
�str�bytescCs@t�}t||d��}|��Wd�S1swYdS)N�rb)rr�read)r
rr!rrr�get_zoneinfoOs$�r(�data�typing.List[str]cCs0t�|�}t�|�}|�d�}tj|dd�}|S)Nzutf-8�F)�width)�lzma�compress�base64Z	b85encode�decode�textwrap�wrap)r)Zcompressed_zone�rawZraw_data_strZdata_strrrr�encode_compressedVs



r4�"typing.Dict[str, typing.List[str]]cCsdd�tD�}|S)NcSsi|]	}|tt|���qSr)r4r()�.0r
rrr�
<dictcomp>asz(load_compressed_keys.<locals>.<dictcomp>)�KEYS)�outputrrr�load_compressed_keys`sr:�zoneinfo_data.json�fname�NonecCsxtjddd�tddd�}t�}t�}||d�}tt|d��}tj||fi|��Wd�dS1s5wYdS)NT)�exist_ok�parents�)�indentZ	sort_keys)�metadatar)�w)�
TEST_DATA_LOC�mkdir�dictr:r#r�json�dump)r<Zjson_kwargsZcompressed_keysrBr9r!rrr�update_test_datafs��"�rI�__main__)rr)rr)r
r$rr%)r)r%rr*)rr5)r;)r<r$rr=)�__doc__Z
__future__rr/�	functoolsrGr-rr1�typingr
r8r	�__file__�parentrD�	lru_cacherr#r(r4r:rI�__name__rrrr�<module>s,







�