File: //usr/local/lib/python3.10/test/test_importlib/__pycache__/update-zips.cpython-310.pyc
o
�i� � @ sT d Z ddlZddlZddlZddlZdd� Zdd� Zdd� Zed ko'e� dS dS )
z�
Generate the zip test data files.
Run to build the tests/zipdataNN/ziptestdata.zip files from
files in tests/dataNN.
Replaces the file with the working copy, but does commit anything
to the source repo.
� Nc C s d} t tt| �� dS )a;
>>> from unittest import mock
>>> monkeypatch = getfixture('monkeypatch')
>>> monkeypatch.setattr(zipfile, 'ZipFile', mock.MagicMock())
>>> print(); main() # print workaround for bpo-32509
<BLANKLINE>
...data01... -> ziptestdata/...
...
...data02... -> ziptestdata/...
...
)Z01Z02N)�tuple�map�generate)�suffixes� r �</usr/local/lib/python3.10/test/test_importlib/update-zips.py�main s r c C s� t �t�j�t�� �}|d| � d� }t�|d��,}t |d| � � �D ]\}}dt �
|�� � }t|d|� |�
||� q#W d � d S 1 sHw Y d S )NZzipdataz/ziptestdata.zip�w�dataZziptestdataz->)�pathlib�Path�__file__�parent�relative_to�os�getcwd�zipfile�ZipFile�walk�
PurePosixPath�as_posix�print�write)�suffix�rootZzfpath�zf�src�rel�dstr r r r ! s �"�r c c s| � t �| �D ]5\}}}t�t��
|�d� W d � n1 s w Y |D ]}t�|�| }|�| �}||fV q'qd S )N�__pycache__) r r �
contextlib�suppress�KeyError�remover r r )�datapath�dirpath�dirnames� filenames�filename�resr r r r r + s ��
��r �__main__) �__doc__r r r r r r r �__name__r r r r �<module> s