Your IP : 3.133.148.130


Current Path : /opt/alt/python37/lib/python3.7/site-packages/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/__pycache__/zipp.cpython-37.pyc

B

mH�a� �@s�ddlZddlZddlZddlZddlZddlZddlZejdkrPddlm	Z	ne
Z	dgZdd�Zdd�Z
e	jZd	d
�ZGdd�dej�ZGd
d�de�Zdd�ZGdd�d�ZdS)�N)��)�OrderedDict�PathcCst�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)�path�r�5/opt/alt/python37/lib/python3.7/site-packages/zipp.py�_parentssr
ccs8|�tj�}x&|r2|tjkr2|Vt�|�\}}qWdS)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
�tailrrrr	%sr	cCst�t|�j|�S)zZ
    Return items in minuend not in subtrahend, retaining order
    with O(1) lookup.
    )r�filterfalse�set�__contains__)�minuend�
subtrahendrrr�_difference?srcsHeZdZdZedd��Z�fdd�Zdd�Zdd	�Ze	d
d��Z
�ZS)�CompleteDirszk
    A ZipFile subclass that ensures that implied directories
    are always included in the namelist.
    cCs.tj�tt|��}dd�|D�}tt||��S)Ncss|]}|tjVqdS)N)rr)�.0�prrr�	<genexpr>Psz-CompleteDirs._implied_dirs.<locals>.<genexpr>)r�chain�
from_iterable�mapr
�_deduper)�names�parents�as_dirsrrr�
_implied_dirsMszCompleteDirs._implied_dirscs tt|���}|t|�|��S)N)�superr�namelist�listr$)�selfr!)�	__class__rrr&SszCompleteDirs.namelistcCst|���S)N)rr&)r(rrr�	_name_setWszCompleteDirs._name_setcCs,|��}|d}||ko||k}|r(|S|S)zx
        If the name represents a directory, return that name
        as a directory (with the trailing slash).
        �/)r*)r(�namer!�dirname�	dir_matchrrr�resolve_dirZszCompleteDirs.resolve_dircCs>t|t�r|St|tj�s&|t|��Sd|jkr4t}||_|S)zl
        Given a source (filename or zipfile), return an
        appropriate CompleteDirs subclass.
        �r)�
isinstancer�zipfile�ZipFile�_pathlib_compat�moder))�cls�sourcerrr�makeds

zCompleteDirs.make)�__name__�
__module__�__qualname__�__doc__�staticmethodr$r&r*r/�classmethodr8�
__classcell__rr)r)rrGs
rcs,eZdZdZ�fdd�Z�fdd�Z�ZS)�
FastLookupzV
    ZipFile subclass to ensure implicit
    dirs exist and are resolved rapidly.
    c	s.t�t��|jSQRXtt|���|_|jS)N)�
contextlib�suppress�AttributeError�_FastLookup__namesr%r@r&)r()r)rrr&~szFastLookup.namelistc	s.t�t��|jSQRXtt|���|_|jS)N)rArBrC�_FastLookup__lookupr%r@r*)r()r)rrr*�szFastLookup._name_set)r9r:r;r<r&r*r?rr)r)rr@xsr@cCs&y|��Stk
r t|�SXdS)zi
    For path-like objects, convert to a filename for compatibility
    on Python 3.6.1 and earlier.
    N)�
__fspath__rC�str)r
rrrr4�sr4c@s�eZdZdZdZd-dd�Zd.dd�d	d
�Zedd��Zed
d��Z	edd��Z
edd��Zedd��Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�ZeZed+d,��ZdS)/ru4
    A pathlib-compatible interface for zip files.

    Consider a zip file with this structure::

        .
        ├── a.txt
        └── b
            ├── c.txt
            └── d
                └── e.txt

    >>> data = io.BytesIO()
    >>> zf = zipfile.ZipFile(data, 'w')
    >>> zf.writestr('a.txt', 'content of a')
    >>> zf.writestr('b/c.txt', 'content of c')
    >>> zf.writestr('b/d/e.txt', 'content of e')
    >>> zf.filename = 'mem/abcde.zip'

    Path accepts the zipfile object itself or a filename

    >>> root = Path(zf)

    From there, several path operations are available.

    Directory iteration (including the zip file itself):

    >>> a, b = root.iterdir()
    >>> a
    Path('mem/abcde.zip', 'a.txt')
    >>> b
    Path('mem/abcde.zip', 'b/')

    name property:

    >>> b.name
    'b'

    join with divide operator:

    >>> c = b / 'c.txt'
    >>> c
    Path('mem/abcde.zip', 'b/c.txt')
    >>> c.name
    'c.txt'

    Read text:

    >>> c.read_text()
    'content of c'

    existence:

    >>> c.exists()
    True
    >>> (b / 'missing.txt').exists()
    False

    Coercion to string:

    >>> import os
    >>> str(c).replace(os.sep, posixpath.sep)
    'mem/abcde.zip/b/c.txt'

    At the root, ``name``, ``filename``, and ``parent``
    resolve to the zipfile. Note these attributes are not
    valid and will raise a ``ValueError`` if the zipfile
    has no filename.

    >>> root.name
    'abcde.zip'
    >>> str(root.filename).replace(os.sep, posixpath.sep)
    'mem/abcde.zip'
    >>> str(root.parent)
    'mem'
    z>{self.__class__.__name__}({self.root.filename!r}, {self.at!r})�cCst�|�|_||_dS)aX
        Construct a Path from a ZipFile or filename.

        Note: When the source is an existing ZipFile object,
        its type (__class__) will be mutated to a
        specialized type. If the caller wishes to retain the
        original type, the caller should either create a
        separate ZipFile object or pass a filename.
        N)r@r8�root�at)r(rIrJrrr�__init__�s
z
Path.__init__r0N)�pwdcOsr|��rt|��|d}|��s0|dkr0t|��|jj|j||d�}d|kr`|sT|r\td��|Stj	|f|�|�S)z�
        Open this entry as text or binary following the semantics
        of ``pathlib.Path.open()`` by passing arguments through
        to io.TextIOWrapper().
        rr0)rL�bz*encoding args invalid for binary operation)
�is_dir�IsADirectoryError�exists�FileNotFoundErrorrI�openrJ�
ValueError�io�
TextIOWrapper)r(r5rL�args�kwargs�zip_mode�streamrrrrR�sz	Path.opencCst�|j�jp|jjS)N)�pathlibrrJr,�filename)r(rrrr,sz	Path.namecCst�|j�jp|jjS)N)rZrrJ�suffixr[)r(rrrr\	szPath.suffixcCst�|j�jp|jjS)N)rZrrJ�suffixesr[)r(rrrr]
sz
Path.suffixescCst�|j�jp|jjS)N)rZrrJ�stemr[)r(rrrr^sz	Path.stemcCst�|jj��|j�S)N)rZrrIr[�joinpathrJ)r(rrrr[sz
Path.filenamec	Os$|jd|�|��
}|��SQRXdS)Nr0)r0)rR�read)r(rVrW�strmrrr�	read_textszPath.read_textc	Cs|�d��
}|��SQRXdS)N�rb)rRr`)r(rarrr�
read_bytesszPath.read_bytescCst�|j�d��|j�d�kS)Nr+)rr-rJr)r(r
rrr�	_is_child!szPath._is_childcCs|�|j|�S)N)r)rI)r(rJrrr�_next$sz
Path._nextcCs|jp|j�d�S)Nr+)rJ�endswith)r(rrrrN'szPath.is_dircCs|��o|��S)N)rPrN)r(rrr�is_file*szPath.is_filecCs|j|j��kS)N)rJrIr*)r(rrrrP-szPath.existscCs.|��std��t|j|j���}t|j|�S)NzCan't listdir a file)rNrSrrfrIr&�filterre)r(�subsrrr�iterdir0szPath.iterdircCst�|jj|j�S)N)r�joinrIr[rJ)r(rrr�__str__6szPath.__str__cCs|jj|d�S)N)r()�_Path__repr�format)r(rrr�__repr__9sz
Path.__repr__cGs*tj|jftt|���}|�|j�|��S)N)rrlrJrr4rfrIr/)r(�other�nextrrrr_<sz
Path.joinpathcCs6|js|jjSt�|j�d��}|r,|d7}|�|�S)Nr+)rJr[�parentrr-rrf)r(�	parent_atrrrrsBszPath.parent)rH)r0)r9r:r;r<rnrKrR�propertyr,r\r]r^r[rbrdrerfrNrhrPrkrmrpr_�__truediv__rsrrrrr�s,L

)rTrr2rrA�sysrZ�version_info�collectionsr�dict�__all__r
r	�fromkeysr rr3rr@r4rrrrr�<module>s$
1

?>