%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/current/lib/python3/dist-packages/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/current/lib/python3/dist-packages/__pycache__/zipp.cpython-38.pyc

U

��f�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	e
Zdd�Zdd�Z
Gdd�d�ZGd	d
�d
�ZdS)�)�divisionNcCst�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	�&/usr/lib/python3/dist-packages/zipp.py�_parentssrccs4|�tj�}|r0|tjkr0|Vt�|�\}}q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�tailr	r	r
r%srcs,eZdZdZ�fdd�Zedd��Z�ZS)�SanitizedNamesz7
    ZipFile mix-in to ensure names are sanitized.
    cstt|jt�����S�N)�list�map�	_sanitize�super�namelist��self��	__class__r	r
r?szSanitizedNames.namelistcCs`dd�}tjdd|tjd�}|�dd�}|�d�}d�t||��}|sNtd��|d|�d�S)	a]
        Ensure a relative path with posix separators and no dot names.
        Modeled after
        https://github.com/python/cpython/blob/bcc1be39cb1d04ad9fc0bd1b9193d3972835a57c/Lib/zipfile/__init__.py#L1799-L1813
        but provides consistent cross-platform behavior.
        >>> san = SanitizedNames._sanitize
        >>> san('/foo/bar')
        'foo/bar'
        >>> san('//foo.txt')
        'foo.txt'
        >>> san('foo/.././bar.txt')
        'foo/bar.txt'
        >>> san('foo../.bar.txt')
        'foo../.bar.txt'
        >>> san('\\foo\\bar.txt')
        'foo/bar.txt'
        >>> san('D:\\foo.txt')
        'D/foo.txt'
        >>> san('\\\\server\\share\\file.txt')
        'server/share/file.txt'
        >>> san('\\\\?\\GLOBALROOT\\Volume3')
        '?/GLOBALROOT/Volume3'
        >>> san('\\\\.\\PhysicalDrive1\\root')
        'PhysicalDrive1/root'
        Retain any trailing slash.
        >>> san('abc/')
        'abc/'
        Raises a ValueError if the result is empty.
        >>> san('../..')
        Traceback (most recent call last):
        ...
        ValueError: Empty filename
        cSs|o
|dkS)N>�..�.r	)�partr	r	r
�allowedfsz)SanitizedNames._sanitize.<locals>.allowedz	^([A-Z]):z\1)�flags�\�/zEmpty filename)	�re�sub�
IGNORECASE�replacer�join�filter�
ValueError�endswith)�namerZbareZclean�partsZjoinedr	r	r
rBs$
zSanitizedNames._sanitize)�__name__�
__module__�__qualname__�__doc__r�staticmethodr�
__classcell__r	r	rr
r:src@s�eZdZdZdZd,dd�Zedd��Zedd	��Z	ed
d��Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�ZeZed"d#��Zed$d%��Zed&d'��Zd(d)�Zejd*kr�eZd+S)-�Pathu�
    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 = '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('abcde.zip', 'a.txt')
    >>> b
    Path('abcde.zip', 'b/')

    name property:

    >>> b.name
    'b'

    join with divide operator:

    >>> c = b / 'c.txt'
    >>> c
    Path('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:

    >>> str(c)
    'abcde.zip/b/c.txt'
    z>{self.__class__.__name__}({self.root.filename!r}, {self.at!r})�cCs,t|tj�r|nt�|�|��|_||_dSr)�
isinstance�zipfileZZipFile�_pathlib_compat�root�at)rr8r9r	r	r
�__init__�s

��z
Path.__init__cCs,z
|��WStk
r&t|�YSXdS)zu
        For path-like objects, convert to a filename for compatibility
        on Python 3.6.1 and earlier.
        N)�
__fspath__�AttributeError�strrr	r	r
r7�s
zPath._pathlib_compatcCst�|jj|j�Sr)�	functools�partialr8�openr9rr	r	r
r@�sz	Path.opencCst�|j�d��S�Nr")r
�basenamer9rrr	r	r
r+�sz	Path.namec
Os6|���$}tj|f|�|���W5QR�SQRXdSr)r@�io�
TextIOWrapper�read)r�args�kwargs�strmr	r	r
�	read_text�s
zPath.read_textc
Cs(|���}|��W5QR�SQRXdSr)r@rE)rrHr	r	r
�
read_bytes�s
zPath.read_bytescCst�|j�d��|j�d�kSrA)r
�dirnamer9r)rrr	r	r
�	_is_child�szPath._is_childcCst|j|�Sr)r3r8)rr9r	r	r
�_next�sz
Path._nextcCs|jp|j�d�SrA)r9r*rr	r	r
�is_dir�szPath.is_dircCs
|��Sr)rNrr	r	r
�is_file�szPath.is_filecCs|j|��kSr)r9�_namesrr	r	r
�exists�szPath.existscCs,|��std��t|j|���}t|j|�S)NzCan't listdir a file)rNr)rrMrPr(rL)rZsubsr	r	r
�iterdir�szPath.iterdircCst�|jj|j�Sr)r
r'r8�filenamer9rr	r	r
�__str__�szPath.__str__cCs|jj|d�S)Nr)�_Path__repr�formatrr	r	r
�__repr__�sz
Path.__repr__cCsN|�|�}t�|j|�}t�|j|d�}|��}|�||krH||krH|n|�S)Nr4)r7r
r'r9rPrM)r�add�nextZnext_dir�namesr	r	r
�joinpath�s

z
Path.joinpathcst��fdd��D��S)Nc3s0|](}t|�D]}|d�kr|dVqqdS)r"N)r)�.0r+�parent�rZr	r
�	<genexpr>�s

�z%Path._implied_dirs.<locals>.<genexpr>)�more_itertoolsZunique_everseenr^r	r^r
�
_implied_dirs�s�zPath._implied_dirscCs|t|�|��Sr)rra)�clsrZr	r	r
�_add_implied_dirsszPath._add_implied_dirscCs(t�|j�d��}|r|d7}|�|�SrA)r
rKr9rrM)rZ	parent_atr	r	r
r]
szPath.parentcCs|�tttj|j�����Sr)rcrrrrr8rrr	r	r
rPszPath._names)�N)r4)r-r.r/r0rUr:r1r7�propertyr@r+rIrJrLrMrNrOrQrRrTrWr[�__truediv__ra�classmethodrcr]rP�sys�version_infoZ__div__r	r	r	r
r3ss<@








r3)Z
__future__rrCrhr
r6r>rr#r`�typeZ
__metaclass__rrrr3r	r	r	r
�<module>s9

Zerion Mini Shell 1.0