Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_zoneinfo/data/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_zoneinfo/data/__pycache__/update_test_data.cpython-312.pyc

�

*Μg^���dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
gd�Zeje
�jZej d��d
d��Zdd�Zdd�Zdd	�Zdd
�Zddd�Zedk(re�yy)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)�maxsizec��d}ttjtj�D]}||zj�s�|cSt
d��)zEGet the first zoneinfo directory on TZPATH containing the "UTC" zone.rzCannot find time zone data.)�map�pathlib�Path�zoneinfo�TZPATH�exists�OSError)�key�paths  �E/usr/local/lib/python3.12/test/test_zoneinfo/data/update_test_data.py�get_zoneinfo_pathr)sE���C��G�L�L�(�/�/�2���3�J��� ��K�3��3�4�4�c��t�}|dz}|j�std��t|d�5}t	|�}ddd�j�j
dd�\}}|ddj�r!t|�dks|ddj�std	d
|��z��d|iS#1swY�uxYw)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)rrr
�open�next�strip�rsplit�isdigit�len�isalpha�
ValueError)r�	tzdata_zi�f�version_line�_rs      r�get_zoneinfo_metadatar&4s�����D��{�"�I������B�C�C�	
�i��	���A�w��
��#�#�%�,�,�S�!�4�J�A�w�
�A�a�L� � �"��w�<�!���q�r�{�"�"�$��
;���y�!�
"�
�	
�
�w���!
�	�s�B7�7Cc��t�}t||zd�5}|j�cddd�S#1swYyxYw)N�rb)rr�read)rrr#s   r�get_zoneinfor*Os/����D�	
�d�S�j�$�	�1��v�v�x�
 �	�	�s�4�=c��tj|�}tj|�}|j	d�}tj|d��}|S)Nzutf-8�F)�width)�lzma�compress�base64�	b85encode�decode�textwrap�wrap)�data�compressed_zone�raw�raw_data_str�data_strs     r�encode_compressedr:VsC���m�m�D�)�O�
�
�
�?�
+�C��:�:�g�&�L��}�}�\��4�H��Orc	�\�tD�cic]}|tt|����}}|Scc}w)N)�KEYSr:r*)r�outputs  r�load_compressed_keysr>`s1��CG�
H�4�C�c�$�\�#�%6�7�7�4�F�
H��M��Is�)c��tjdd��tdd��}t�}t	�}||d�}tt|zd�5}t
j||fi|��ddd�y#1swYyxYw)NT)�exist_ok�parents�)�indent�	sort_keys)�metadatar5�w)�
TEST_DATA_LOC�mkdir�dictr>r&r�json�dump)�fname�json_kwargs�compressed_keysrEr=r#s      r�update_test_datarOfsw������t��4�15��D�1�K�+�,�O�$�&�H����F�

�m�e�#�S�	)�Q��	�	�&�!�+�{�+�
*�	)�	)�s�A2�2A;�__main__)�returnzpathlib.Path)rQztyping.Dict[str, str])r�strrQ�bytes)r5rSrQztyping.List[str])rQz"typing.Dict[str, typing.List[str]])zzoneinfo_data.json)rLrRrQ�None)�__doc__�
__future__rr0�	functoolsrJr.rr3�typingr
r<r	�__file__�parentrG�	lru_cacherr&r*r:r>rO�__name__�rr�<module>r^s���
�#�
������
��������X�&�-�-�
�����T�"�5�#�5� �6���,�&�z����r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists