CasperSecurity

Current Path : /lib/python3/dist-packages/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/__pycache__/zipp.cpython-310.pyc

o

��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�_parentssrccsN�|�tj�}|r!|tjkr%|Vt�|�\}}|r#|tjksdSdSdSdS)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||��}|s'td��|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|dvS)N>�..�.r	)�partr	r	r
�allowedf�z)SanitizedNames._sanitize.<locals>.allowedz	^([A-Z]):z\1)�flags�\�/zEmpty filename)	�re�sub�
IGNORECASE�replacer�join�filter�
ValueError�endswith)�namer�bare�clean�parts�joinedr	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*krleZd+Sd+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�zipfile�ZipFile�_pathlib_compat�root�at)rr=r>r	r	r
�__init__�s

��
z
Path.__init__cCs&z|��WStyt|�YSw)zu
        For path-like objects, convert to a filename for compatibility
        on Python 3.6.1 and earlier.
        )�
__fspath__�AttributeError�strrr	r	r
r<�s

�zPath._pathlib_compatcC�t�|jj|j�Sr)�	functools�partialr=�openr>rr	r	r
rF��z	Path.opencCst�|j�d��S�Nr#)r
�basenamer>rrr	r	r
r,�rGz	Path.namecOsH|���}tj|g|�Ri|����Wd�S1swYdSr)rF�io�
TextIOWrapper�read)r�args�kwargs�strmr	r	r
�	read_text�s
$�zPath.read_textcCs4|���}|��Wd�S1swYdSr)rFrL)rrOr	r	r
�
read_bytes�s
$�zPath.read_bytescCst�|j�d��|j�d�kSrH)r
�dirnamer>r)rrr	r	r
�	_is_child�szPath._is_childcCst|j|�Sr)r7r=)rr>r	r	r
�_next�r z
Path._nextcCs|jp	|j�d�SrH)r>r+rr	r	r
�is_dir�szPath.is_dircCs
|��Sr)rUrr	r	r
�is_file�s
zPath.is_filecCs|j|��vSr)r>�_namesrr	r	r
�exists��zPath.existscCs,|��std��t|j|���}t|j|�S)NzCan't listdir a file)rUr*rrTrWr)rS)r�subsr	r	r
�iterdir�szPath.iterdircCrCr)r
r(r=�filenamer>rr	r	r
�__str__�szPath.__str__cCs|jj|d�S)Nr)�_Path__repr�formatrr	r	r
�__repr__�rYz
Path.__repr__cCsP|�|�}t�|j|�}t�|j|d�}|��}|�||vr%||vr%|�S|�S)Nr8)r<r
r(r>rWrT)r�add�next�next_dir�namesr	r	r
�joinpath�s

 z
Path.joinpathcst��fdd��D��S)Nc3s2�|]}t|�D]
}|d�vr|dVqqdS)r#N)r)�.0r,�parent�rdr	r
�	<genexpr>�s����z%Path._implied_dirs.<locals>.<genexpr>)�more_itertools�unique_everseenrhr	rhr
�
_implied_dirs�s�zPath._implied_dirscCs|t|�|��Sr)rrl)�clsrdr	r	r
�_add_implied_dirsrGzPath._add_implied_dirscCs(t�|j�d��}|r|d7}|�|�SrH)r
rRr>rrT)r�	parent_atr	r	r
rg
s
zPath.parentcCs|�tttj|j�����Sr)rnrrrrr=rrr	r	r
rWszPath._names)�N)r8)r1r2r3r4r^r?r5r<�propertyrFr,rPrQrSrTrUrVrXr[r]r`re�__truediv__rl�classmethodrnrgrW�sys�version_info�__div__r	r	r	r
r7ss@@








�r7)�
__future__rrJrtr
r:rDrr$rj�type�
__metaclass__rrrr7r	r	r	r
�<module>s9
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY