← back to Atmos Game

assets/gen/.venv/lib/python3.12/site-packages/fsspec/__pycache__/fuse.cpython-312.pyc

122 lines

�

c�bj�'���ddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZmZm
Z
ddlmZddlmZej$d�ZGd�de
�Zd	d
d
efd�Zd�Zed
k(rddlZeej2dd�yy)�N)�EIO�ENOENT)�FUSE�FuseOSError�LoggingMixIn�
Operations)�__version__)�	url_to_fs�fsspec.fusec�b�eZdZdd�Zdd�Zd�Zd�Zd�Zd�Zd�Z	dd	�Z
d
�Zdd�Zd�Z
d
�Zd�Zy)�FUSErc��||_i|_|jd�dz|_d|_t
j
d|�||_y)N�/rzStarting FUSE at %s)�fs�cache�rstrip�root�counter�logger�info�_ready_file)�selfr�path�
ready_files    �b/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/fsspec/fuse.py�__init__zFUSEr.__init__sC�������
��K�K��$�s�*��	�������)�4�0�%���Nc��tjd|�|jr	|dvrddd�Sdj|j|jd�g�j
d�}	|jj|�}|jdd	�|jd
d	�d�}|jdd
�}|ddk7r!tj|z|d<d|d<d|d<n(tj|z|d<|d|d<d|d<d|d<d|vr|dnt!j �|d<d|vr|dnt!j �|d<d|vr|dnt!j �|d<|S#t$r}tt�|�d}~wwxYw)Nz
getattr %s�z/.fuse_readyz.fuse_ready�file�)�type�st_size�r�uidi��gid)�st_uid�st_gid�modei�r"�st_moderr#�
st_blksize�sizeiP��st_nlink�atime�st_atime�ctime�st_ctime�mtime�st_mtime)r�debugr�joinr�lstriprrr�FileNotFoundErrorrr�get�stat�S_IFDIR�S_IFREG�time)rr�fhr�exc�data�perms       r�getattrz
FUSEr.getattrs|�����\�4�(�����(G� G�"�q�1�1��w�w��	�	�4�;�;�s�#3�4�5�<�<�S�A��	/��7�7�<�<��%�D��(�(�5�$�/�4�8�8�E�4�;P�Q���x�x���&����<�6�!�"�l�l�T�1�D��O��D��O�!"�D���"�l�l�T�1�D��O�"�6�l�D��O�!*�D��� �D���,3�t�O�4��=������Z��,3�t�O�4��=������Z��,3�t�O�4��=������Z�����%!�	/��f�%�3�.��	/�s�(E-�-	F�6F�Fc�L�tjd|�dj|j|j	d�g�}|j
j
|d�}|D�cgc]0}tjj|jd����2}}ddg|zScc}w)Nz
readdir %sr$rF�.z..)rr5r6rr7r�ls�osr�basenamer)rrr>�files�fs     r�readdirz
FUSEr.readdir6s������\�4�(��w�w��	�	�4�;�;�s�#3�4�5�����
�
�4��'��:?�@�%�Q����!�!�!�(�(�3�-�0�%��@��T�{�U�"�"��As�#5B!c��dj|j|jd�g�}|jj	|�y�Nr$rr)r6rr7r�mkdir�rrr)s   rrMzFUSEr.mkdir=�5���w�w��	�	�4�;�;�s�#3�4�5�����
�
�d��rc��dj|j|jd�g�}|jj	|�yrL)r6rr7r�rmdir)rrs  rrQzFUSEr.rmdirBrOrc��tjd|||f�|jr|dvry|j|}|j	|�|j|�}|S)Nzread %srsready)rr5rr�seek�read)rrr,�offsetr>rI�outs       rrTz
FUSEr.readGsU�����Y��t�V� 4�5�����(G� G���J�J�r�N��	���v���f�f�T�l���
rc��tjd||f�|j|}|j|�|j	|�t|�S)Nzwrite %s)rr5rrS�write�len)rrr@rUr>rIs      rrXzFUSEr.writeRsA�����Z�$���0��J�J�r�N��	���v��	����
��4�y�rc�r�tjd||f�dj|j|j	d�g�}|j
j
|�|j
j|d�}||j|j<|xjdz
c_	|jdz
S)Nz	create %sr$r�wbr-)
rr5r6rr7r�touch�openrr)rr�flags�fi�fnrIs      r�createzFUSEr.createYs������[�4��-�0�
�W�W�d�i�i����S�!1�2�
3�����
�
�b���G�G�L�L��T�"��#$��
�
�4�<�<� ��������|�|�a��rc�R�tjd||f�dj|j|j	d�g�}|dzdk(rd}nd}|j
j
||�|j|j<|xjdz
c_|jdz
S)	Nzopen %sr$r�r�rbr[r-)	rr5r6rr7rr]rr)rrr^r`r)s     rr]z
FUSEr.openbs������Y��u�
�.�
�W�W�d�i�i����S�!1�2�
3���1�9��>��D��D�#'�7�7�<�<��D�#9��
�
�4�<�<� ��������|�|�a��rc��dj|j|jd�g�}|dk7rt�|jj|�yrL)r6rr7�NotImplementedErrorrr\)rr�lengthr>r`s     r�truncatezFUSEr.truncateos?��
�W�W�d�i�i����S�!1�2�
3���Q�;�%�%����
�
�b�rc���dj|j|jd�g�}	|jj	|d�y#t
tf$r}tt�|�d}~wwxYw)Nr$rF)	r6rr7r�rm�OSErrorr8rr)rrr`r?s    r�unlinkzFUSEr.unlinkvs\��
�W�W�d�i�i����S�!1�2�
3��	,��G�G�J�J�r�5�!���*�+�	,��c�"��+��	,�s�A�A/�A*�*A/c���	||jvr:|j|}|j�|jj|�y#t$r}t	|�Yd}~yd}~wwxYw)Nr)r�close�pop�	Exception�print)rrr>rI�es     r�releasez
FUSEr.release}s\��	��T�Z�Z���J�J�r�N�����	��
�
���r�"����	��!�H�H���	�s�AA�	A)�A$�$A)c���t|jd�rHdj|j|j	d�g�}|jj||�St�)N�chmodr$r)�hasattrrr6rr7rurfrNs   rruzFUSEr.chmod�sK���4�7�7�G�$��7�7�D�I�I�t�{�{�3�'7�8�9�D��7�7�=�=��t�,�,�!�!r)F)N)�__name__�
__module__�__qualname__rrBrJrMrQrTrXrar]rhrlrsru�rrr
r
sC��&��8#��
�
	�� � ��,��"rr
TFc����������������fd�}�s/tj|��}d|_|j�|S	|�y#t$rYywxYw)amMount stuff in a local directory

    This uses fusepy to make it appear as if a given path on an fsspec
    instance is in fact resident within the local file-system.

    This requires that fusepy by installed, and that FUSE be available on
    the system (typically requiring a package to be installed with
    apt, yum, brew, etc.).

    Parameters
    ----------
    fs: file-system instance
        From one of the compatible implementations
    path: str
        Location on that file-system to regard as the root directory to
        mount. Note that you typically should include the terminating "/"
        character.
    mount_point: str
        An empty directory on the local file-system where the contents of
        the remote path will appear.
    foreground: bool
        Whether or not calling this function will block. Operation will
        typically be more stable if True.
    threads: bool
        Whether or not to create threads when responding to file operations
        within the mounter directory. Operation will typically be more
        stable if False.
    ready_file: bool
        Whether the FUSE process is ready. The ``.fuse_ready`` file will
        exist in the ``mount_point`` directory if True. Debugging purpose.
    ops_class: FUSEr or Subclass of FUSEr
        To override the default behavior of FUSEr. For Example, logging
        to file.

    c�6��t�����������S)N)r)�	nothreads�
foreground)r)r~r�mount_point�	ops_classrr�threadss�������r�<lambda>zrun.<locals>.<lambda>�s!���4��"�d�z�2���+��	r)�targetTN)�	threading�Thread�daemon�start�KeyboardInterrupt)	rrrr~r�rr��func�ths	```````  r�runr��sV���X��D��
�
�
�T�
*����	�
���
��	�	��F�� �	��	�s�A
�
	A�Ac	��Gd�dtj�}|dtj��}|j	ddt
��|j	dtd	�
�|j	dtd�
�|j	d
td�
�|j	dddd��|j	ddtd�
�|j	dddd��|j	dddd��|j	dddd ��|j|�}i}|jxsgD]�}|jd!�\}}}|s|jd"|���#�|j�}|jd$�rt|d%td$��}n"|jd&�r|d%td&�d'v}d(|vr*|jd(d)�\}	}
|	|vr	|||	|
<��|
|i||	<��|||<��|j rGt#j$t"j&|j d*�+�Gd,�d-t(t*�}|}nt(}t-|j.fi|��\}
}t0j3d.|t
|j4��t7|
|j8|j4|j:|j<|j>|�/�y%)0a�Mount filesystem from chained URL to MOUNT_POINT.

    Examples:

    python3 -m fsspec.fuse memory /usr/share /tmp/mem

    python3 -m fsspec.fuse local /tmp/source /tmp/local \
            -l /tmp/fsspecfuse.log

    You can also mount chained-URLs and use special settings:

    python3 -m fsspec.fuse 'filecache::zip::file://data.zip' \
            / /tmp/zip \
            -o 'filecache-cache_storage=/tmp/simplecache'

    You can specify the type of the setting by using `[int]` or `[bool]`,
    (`true`, `yes`, `1` represents the Boolean value `True`):

    python3 -m fsspec.fuse 'simplecache::ftp://ftp1.at.proftpd.org' \
            /historic/packages/RPMS /tmp/ftp \
            -o 'simplecache-cache_storage=/tmp/simplecache' \
            -o 'simplecache-check_files=false[bool]' \
            -o 'ftp-listings_expiry_time=60[int]' \
            -o 'ftp-username=anonymous' \
            -o 'ftp-password=xieyanbo'
    c���eZdZ�fd�Z�xZS)�*main.<locals>.RawDescriptionArgumentParserc���t�|��}|jd�}|jj	�|d<dj|�S)Nz

r-)�super�format_help�split�descriptionrr6)r�usage�parts�	__class__s   �rr�z6main.<locals>.RawDescriptionArgumentParser.format_help�sE����G�'�)�E��K�K��'�E��'�'�.�.�0�E�!�H��;�;�u�%�%r)rwrxryr��
__classcell__)r�s@r�RawDescriptionArgumentParserr��s
���	&�	&rr�r)�progr�z	--version�version)�actionr��urlzfs url)r"�help�source_pathzsource directory in fsrzlocal directoryz-oz--option�appendz3Any options of protocol included in the chained URL)r�r�z-lz
--log-filez%Logging FUSE debug info (Default: '')z-fz--foreground�store_falsez-Running in foreground or not (Default: False)z-tz	--threadsz-Running with threads support (Default: False)z-rz--ready-filezZThe `.fuse_ready` file will exist after FUSE is ready. (Debugging purpose, Default: False)�=zWrong option: )�messagez[int]Nz[bool])�1�yes�true�-r-z%(asctime)s %(message)s)�level�filename�formatc��eZdZy)�main.<locals>.LoggingFUSErN)rwrxryrzrr�LoggingFUSErr�-s��rr�zMounting %s to %s)r~r�rr�) �argparse�ArgumentParser�main�__doc__�add_argumentr	�str�
parse_args�option�	partition�error�lower�endswith�intrYr��log_file�logging�basicConfig�DEBUGr
rr
r�rr5rr�r�r~r�r)�argsr��parser�kwargs�item�key�sep�value�val�fs_name�setting_namer��fuserr�url_paths               rr�r��s���8&�x�'>�'>�&�*�}�$�,�,�
W�F�
����I�{��K�
����C�h��7�
���
�C�6N��O�
���
�C�6G��H�
������
B�	������l��+R���������
<�	��������
<�	��������.�	�����T�"�D�
�F����!�r�!���.�.��-���S�%���L�L�>�$��!:�L�;��k�k�m���<�<�� ���o��W��
�.�/�E�
�\�\�(�
#��(�3�x�=�.�)�-A�A�E��#�:�$'�I�I�c�1�$5�!�G�\��&� �05��w���-�#/��"7��w���F�3�K�#"�&�}�}�����-�-��]�]�,�	
�	�5�,�	������T�X�X�0��0�L�B��
�L�L�$�h��D�4D�4D�0E�F��
��������?�?�����?�?��r�__main__r-)r�r�rFr:r�r=�errnorr�fuserrrr�fsspecr	�fsspec.corer
�	getLoggerrr
r�r�rw�sys�argvrzrr�<module>r�s�����	�����<�<��!�	��	�	�=�	)��z"�J�z"�B����;�|r�j�z�������!�"���r