�
���c� � �� � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZej dk rd dlm Z ne
Z dgZd� Zd� Z
e j Z d� Z G d� d ej � � Z G d
� de� � Zd� Z G d
� d� � ZdS )� N)� � )�OrderedDict�Pathc �H � t j t | � � dd� � S )a2
Given a path with elements separated by
posixpath.sep, generate all parents of that path.
>>> list(_parents('b/d'))
['b']
>>> list(_parents('/b/d/'))
['/b']
>>> list(_parents('b/d/f/'))
['b/d', 'b']
>>> list(_parents('b'))
[]
>>> list(_parents(''))
[]
� N)� itertools�islice� _ancestry��paths �9/usr/lib/python3/dist-packages/setuptools/_vendor/zipp.py�_parentsr s � � ��I�d�O�O�Q��5�5�5� c # �� K � | � t j � � } | r?| t j k r3| V � t j | � � \ } }| r| t j k �-dS dS dS dS )aR
Given a path with elements separated by
posixpath.sep, generate all elements of that path
>>> list(_ancestry('b/d'))
['b/d', 'b']
>>> list(_ancestry('/b/d/'))
['/b/d', '/b']
>>> list(_ancestry('b/d/f/'))
['b/d/f', 'b/d', 'b']
>>> list(_ancestry('b'))
['b']
>>> list(_ancestry(''))
[]
N)�rstrip� posixpath�sep�split)r
�tails r r r % s� � � � � �;�;�y�}�%�%�D�
� +�4�9�=�(�(��
�
�
��_�T�*�*�
��d� � +�4�9�=�(�(�(�(� +� +� +� +�(�(r c �P � t j t |� � j | � � S )zZ
Return items in minuend not in subtrahend, retaining order
with O(1) lookup.
)r �filterfalse�set�__contains__)�minuend�
subtrahends r �_differencer ? s � �
� ��Z���!=�w�G�G�Gr c �Z � � e Zd ZdZed� � � Z� fd�Zd� Zd� Ze d� � � Z
� xZS )�CompleteDirszk
A ZipFile subclass that ensures that implied directories
are always included in the namelist.
c � � t j � t t | � � � � }d� |D � � }t t
|| � � � � S )Nc 3 �4 K � | ]}|t j z V � �d S �N)r r )�.0�ps r � <genexpr>z-CompleteDirs._implied_dirs.<locals>.<genexpr>P s) � � � �6�6��1�y�}�$�6�6�6�6�6�6r )r �chain�
from_iterable�mapr �_deduper )�names�parents�as_dirss r �
_implied_dirszCompleteDirs._implied_dirsM sL � ��/�/�/��H�e�0D�0D�E�E��6�6�g�6�6�6���{�7�E�2�2�3�3�3r c � �� t t | � � � � � }|t | � |� � � � z S r" |