403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.156
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/fs/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/fs/__pycache__/tarfs.cpython-310.pyc
o

�Q`+<�@s�dZddlmZddlmZddlZddlZddlZddlmZddlm	Z	m
Z
ddlZddlm
Z
dd	lmZdd
lmZddlmZddl
mZmZdd
lmZddlmZddlmZddlmZddlmZddl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(ej)r�ddlm*Z*ddlm+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3ddlm4Z4ddl5m6Z6ej7ddd�Z8gd�Z9ej:r�dd�Z;ndd�Z;Gdd �d e(�Z<ej=Gd!d"�d"e(��Z>ej=Gd#d�de��Z?e@d$k�rRdd%lAmBZBe<d&��+ZCeDeC�Ed'��eDeC�Ed(��eDeC�Fd)��eBeC�eDeC�eDeGeC��Wd�n	1�swYe<d*d+d,��ZCeC�Hd-�eC�Id.d/�eDeC�eDeGeC��Wd�dS1�sKwYdSdS)0z(Manage the filesystem in a Tar archive.
�)�print_function)�unicode_literalsN)�OrderedDict)�cast�IO�)�errors)�FS)�	write_tar)�ResourceType)�IllegalBackReference�NoURL)�Info)�
RawWrapper)�open_fs)�Permissions)�	url_quote)�relpath�basename�isbase�normpath�parts�frombase)�WrapFS)�TarInfo)	�Any�BinaryIO�
Collection�Dict�List�Optional�Text�Tuple�Union)�RawInfo)�SubFS�T�	ReadTarFS)�bound)�TarFS�
WriteTarFSr'cCs|�|d�S�N��get_info��member�encoding�r1�*/usr/lib/python3/dist-packages/fs/tarfs.py�_get_member_info4�r3cCs|��Sr+r,r.r1r1r2r3;sc@sJeZdZdZdddd�Z					dd
d�Zejr#					ddd
�ZdSdS)r)apRead and write tar files.

    There are two ways to open a TarFS for the use cases of reading
    a tar file, and creating a new one.

    If you open the TarFS with  ``write`` set to `False` (the
    default), then the filesystem will be a read only filesystem which
    maps to the files and directories within the tar file. Files are
    decompressed on the fly when you open them.

    Here's how you might extract and print a readme from a tar file::

        with TarFS('foo.tar.gz') as tar_fs:
            readme = tar_fs.readtext('readme.txt')

    If you open the TarFS with ``write`` set to `True`, then the TarFS
    will be a empty temporary filesystem. Any files / directories you
    create in the TarFS will be written in to a tar file when the TarFS
    is closed. The compression is set from the new file name but may be
    set manually with the ``compression`` argument.

    Here's how you might write a new tar file containing a readme.txt
    file::

        with TarFS('foo.tar.xz', write=True) as new_tar:
            new_tar.writetext(
                'readme.txt',
                'This tar file was written by PyFilesystem'
            )

    Arguments:
        file (str or io.IOBase): An OS filename, or an open file handle.
        write (bool): Set to `True` to write a new tar file, or
            use default (`False`) to read an existing tar file.
        compression (str, optional): Compression to use (one of the formats
            supported by `tarfile`: ``xz``, ``gz``, ``bz2``, or `None`).
        temp_fs (str): An FS URL for the temporary filesystem
            used to store data prior to tarring.

    )z.tar.xzz.txz)z.tar.bz2z.tbz)z.tar.gzz.tgz)�xz�bz2�gzFN�utf-8�temp://__tartemp__c	Cs�t|tjtjf�rtj�|�}|}nt|dd�}|r4|dur4d}t�|j	�D]
\}}|�
|�r3|}nq&|r>t||||d�St||d�S)N�name�)�compressionr0�temp_fs)r0)
�
isinstance�six�	text_type�binary_type�os�path�
expanduser�getattr�	iteritems�_compression_formats�endswithr*r')	�cls�file�writer<r0r=�filename�comp�
extensionsr1r1r2�__new__ss 	
��z
TarFS.__new__cC�dSr+r1)�selfrJrKr<r0r=r1r1r2�__init__�s	zTarFS.__init__)FNr8r9)	�__name__�
__module__�__qualname__�__doc__rGrO�typing�
TYPE_CHECKINGrRr1r1r1r2r)Bs$+�

���r)csdeZdZdZ			d�fdd�	Zdd�Zd	d
�Zdd�Zd
d�Z�fdd�Z				ddd�Z
�ZS)r*zA writable tar file.
    Nr8r9csH||_||_||_||_t|�|_t|j���|_t	t
|��|j�dSr+)�_filer<r0�_temp_fs_urlr�_temp_fs�dict�getmeta�_meta�superr*rR)rQrJr<r0r=��	__class__r1r2rR�s
zWriteTarFS.__init__cCsd}|�|j|j|j|j�S)Nz?WriteTarFS({!r}, compression={!r}, encoding={!r}, temp_fs={!r}))�formatrYr<r0rZ)rQ�tr1r1r2�__repr__�szWriteTarFS.__repr__cC�d�|j�S)Nz<TarFS-write '{}'>�rbrY�rQr1r1r2�__str__�r4zWriteTarFS.__str__cCs
|j|fSr+�r[�rQrCr1r1r2�
delegate_path�s
zWriteTarFS.delegate_pathcCs|jSr+rirgr1r1r2�delegate_fs�szWriteTarFS.delegate_fscs>|��sz|��W|j��n|j��wtt|���dSr+)�isclosedr
r[�closer_r*rgr`r1r2rn�s

zWriteTarFS.closecCs4|��st|j|p|j|p|j|p|jd�dSdS)a)Write tar to a file.

        Arguments:
            file (str or io.IOBase, optional): Destination file, may be
                a file name or an open file object.
            compression (str, optional): Compression to use (one of
                the constants defined in `tarfile` in the stdlib).
            encoding (str, optional): The character encoding to use
                (default uses the encoding defined in
                `~WriteTarFS.__init__`).

        Note:
            This is called automatically when the TarFS is closed.
        )r<r0N)rmr
r[rYr<r0)rQrJr<r0r1r1r2r
�s
��zWriteTarFS.write_tar)Nr8r9)NNN)rSrTrUrVrRrdrhrkrlrnr
�
__classcell__r1r1r`r2r*�s��r*csBeZdZdZdddddddd�Zejejej	ej
ejejej
ejejejejejejejejejejeji	ZZejjd0�fdd�	�Zedd	��Zd
d�Zdd
�Ze j!r]dd�Z"dd�Z#ndd�Z"dd�Z#d1dd�Z$dd�Z%dd�Z&dd�Z'dd�Z(		d2dd �Z)d3d#d$�Z*d%d&�Z+d'd(�Z,�fd)d*�Z-d+d,�Z.d4d.d/�Z/�Z0S)5r'zA readable tar file.
    TF)�case_insensitive�network�	read_only�supports_rename�thread_safe�
unicode_paths�virtualr8csXtt|���||_||_t|tjtjf�rt	j
|dd�|_nt	j
|dd�|_d|_dS)N�r��mode)�fileobjry)
r_r'rRrYr0r>r?r@rA�tarfile�open�_tar�_directory_cache)rQrJr0r`r1r2rRs
zReadTarFS.__init__csB|jdur|j��fdd�|jD���fdd�}t|��|_|jS)zLazy directory cache.Nc3s$�|]
}�|j��d�|fVqdS)�/N)r:�strip)�.0�info)�_decoder1r2�	<genexpr>s�
�z/ReadTarFS._directory_entries.<locals>.<genexpr>c	3sB��D]\}}zt|�}Wn	tyYqw|r||fVqdSr+)rr)r:r��_name)�_directory_entriesr1r2�	_list_tars��
��z/ReadTarFS._directory_entries.<locals>._list_tar)r~r�r}r)rQr�r1)r�r�r2r�s

�zReadTarFS._directory_entriescCre)NzReadTarFS({!r})rfrgr1r1r2rd*r4zReadTarFS.__repr__cCre)Nz<TarFS '{}'>rfrgr1r1r2rh.r4zReadTarFS.__str__cC�|�|j�Sr+)�encoder0�rQ�sr1r1r2�_encode4r4zReadTarFS._encodecCr�r+)�decoder0r�r1r1r2r�8r4zReadTarFS._decodecC�|Sr+r1r�r1r1r2r�>�cCr�r+r1r�r1r1r2r�Br�Ncsjt|�|��}|p
d}i}|s'ddd�|d<d|vr#dttj�i|d<t|�Sz	d}|j|�WntyN|�|�sAt�	|��d}t
�|��t
j�_
Ynwt|��j�����d�|d<d|vry�jt|j�j
�d	�|d<|sy�j|dd
<d|vr�|s��j�jt�jd����j�jd
�|d<d|vr�|s�t�|j�|d<|d��fdd�t��D��t|�S)Nr1r;T)r:�is_dir�basic�details�typeF)�sizer��modified�accessrx)�gid�group�permissions�uid�user�tarcs,i|]}|�d�r|�dd�t�|���qS)�is�is_)�
startswith�replacerE)r��k�r/r1r2�
<dictcomp>ss��z%ReadTarFS.getinfo.<locals>.<dictcomp>) r�validatepath�intr�	directoryr��KeyError�isdirr�ResourceNotFoundr{r�DIRTYPEr�rr�r:r��type_map�mtimer��gnamerry�dumpr��unamer3r0�update�dirr)rQrC�
namespaces�_path�raw_info�implicitr1r�r2�getinfoFsT+�


�
�
�
�
��zReadTarFS.getinfocsJt|�|���z|j���WSty$t�fdd�|jD��YSw)Nc3s�|]}t�|�VqdSr+)r)r�r:�r�r1r2r��s�z"ReadTarFS.isdir.<locals>.<genexpr>)rr�r�r�r��anyrjr1r�r2r�|s�zReadTarFS.isdircCs4t|�|��}z|j|��WStyYdSw�NF)rr�r��isfiler�)rQrCr�r1r1r2r��s�zReadTarFS.isfilecC�|��t�|��r+��checkr�ResourceReadOnly)rQrCr�r1r1r2�setinfo��
zReadTarFS.setinfocsXt|�|���|�|�tjurt�|���fdd�|jD�}dd�|D�}tt	�
|��S)Nc3s$�|]
}t�|�rt�|�VqdSr+)rr)r��nr�r1r2r��s�
�
�z$ReadTarFS.listdir.<locals>.<genexpr>css$�|]
}t|�rt|�dVqdS)rN)rr)r��childr1r1r2r��s�")rr��gettyperr�r�DirectoryExpectedr��listr�fromkeys)rQrC�children�contentr1r�r2�listdir�s

�zReadTarFS.listdircCr�r+r�)rQrCr��recreater1r1r2�makedir�s
zReadTarFS.makedirrw���c	Ks�t|�|��}d|vsd|vsd|vrt�|��z|j|}Wnty1t�t�|�d�Ynw|�	�s;t�
|��ttt
|j�|���}tjrPdd�}||_|S)N�w�+�acSrPr+r1r1r1r1r2�_flush�sz!ReadTarFS.openbin.<locals>._flush)rr�rr�r�r�r?�
raise_fromr�r��FileExpectedrrrr}�extractfile�PY2�flush)	rQrCry�	buffering�optionsr�r/�rwr�r1r1r2�openbin�s
�
zReadTarFS.openbincCr�r+r�rjr1r1r2�remove�r�zReadTarFS.removecCr�r+r�rjr1r1r2�	removedir�r�zReadTarFS.removedircs*tt|���t|d�r|j��dSdS)Nr})r_r'rn�hasattrr}rgr`r1r2rn�s
�zReadTarFS.closecCs|jjSr+)r}�closedrgr1r1r2rm�szReadTarFS.isclosed�downloadcCs>|dkrt|jtj�rt|j�}t|�}d�||�St||��)N�fsztar://{}!/{})r>rYr?�string_typesrrbr
)rQrC�purpose�quoted_file�quoted_pathr1r1r2�geturl�s


zReadTarFS.geturl)r8r+r�)rwr�)r�)1rSrTrUrVr^r{�BLKTYPEr�block_special_file�CHRTYPE�	characterr�r��FIFOTYPE�fifo�REGTYPErJ�AREGTYPE�SYMTYPE�symlink�CONTTYPE�LNKTYPE�_typemapr�r�CreateFailed�	catch_allrR�propertyr�rdrhr?r�r�r�r�r�r�r�r�r�r�r�r�rnrmr�ror1r1r`r2r'�sZ��


6
�

�__main__)�renderz	tests.tarrz/tests/ztests/ttt/settings.iniz	TarFS.tarT)rKzfoo/barzfoo/bar/baz.txtzHello, World)JrV�
__future__rrrBr{rW�collectionsrrrr?r;r�baser	�compressr
�enumsrrr
r�r�iotoolsr�openerrr�r�
_url_toolsrrCrrrrrr�wrapfsrrXrrrrrrr r!r"r#r$�subfsr%�TypeVarr&�__all__r�r3r)�python_2_unicode_compatibler*r'rS�fs.treer��tar_fs�printr��readtext�repr�makedirs�	writetextr1r1r1r2�<module>sl ,
\L
s
�
$��

Youez - 2016 - github.com/yon3zu
LinuXploit