← back to Atmos Game

assets/gen/.venv/lib/python3.12/site-packages/anyio/streams/__pycache__/file.cpython-312.pyc

73 lines

�

c�bj�����ddlmZdZddlmZmZddlmZmZddl	m
Z
ddlmZddl
mZmZdd	lmZmZmZmZmZmZdd
lmZmZGd�de�ZGd
�d�ZGd�dee�ZGd�dee�Zy)�)�annotations)�FileReadStream�FileStreamAttribute�FileWriteStream)�Callable�Mapping)�SEEK_SET�UnsupportedOperation)�PathLike)�Path)�IO�Any�)�BrokenResourceError�ClosedResourceError�EndOfStream�TypedAttributeSet�	to_thread�typed_attribute)�ByteReceiveStream�ByteSendStreamc�V�eZdZUe�Zded<e�Zded<e�Zded<y)r�	IO[bytes]�filer�path�int�filenoN)�__name__�
__module__�__qualname__rr�__annotations__rr���i/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/anyio/streams/file.pyrrs)��%�'�D�)�'� �"�D�$�"�!�#�F�C�#r#rc�.�eZdZdd�Zdd�Zedd��Zy)�_BaseFileStreamc��||_y�N��_file)�selfrs  r$�__init__z_BaseFileStream.__init__$s	����
r#c��rK�tj|jj��d{���y7��wr()r�run_syncr*�close�r+s r$�aclosez_BaseFileStream.aclose's$����� � ����!1�!1�2�2�2�s�-7�5�7c���tj�fd�i}t�jd�r�fd�|tj<	�jj��fd�|tj
<|S#t$rY|SwxYw)Nc����jSr(r)r0s�r$�<lambda>z2_BaseFileStream.extra_attributes.<locals>.<lambda>-s	���d�j�jr#�namec�B��t�jj�Sr()rr*r5r0s�r$r4z2_BaseFileStream.extra_attributes.<locals>.<lambda>1s���4��
�
���;Pr#c�8���jj�Sr()r*rr0s�r$r4z2_BaseFileStream.extra_attributes.<locals>.<lambda>8s���T�Z�Z�=N�=N�=Pr#)rr�hasattrr*rrr
)r+�
attributess` r$�extra_attributesz _BaseFileStream.extra_attributes*s����
 �$�$�&8�4
�
��4�:�:�v�&�3P�J�*�/�/�0�	Q��J�J����6Q�J�*�1�1�2����$�	����	�s�A6�6	B�BN)rr)�return�None)r;zMapping[Any, Callable[[], Any]])rrr r,r1�propertyr:r"r#r$r&r&#s ���3����r#r&c�@�eZdZdZedd��Zdd	d�Zefd
d�Zdd�Z	y)rz�
    A byte stream that reads from a file in the file system.

    :param file: a file that has been opened for reading in binary mode

    .. versionadded:: 3.0
    c��K�tjt|�jd��d{���}||�S7��w)z{
        Create a file read stream by opening the given file.

        :param path: path of the file to read from

        �rbN�rr.r�open)�clsrrs   r$�	from_pathzFileReadStream.from_pathFs4�����'�'��T�
����>�>���4�y��?�s�->�<�
>c���K�|dkrtd��	tj|jj|��d{���}|r|St�7�#t$rt
d�t$r}t|�d}~wwxYw�w)N�z$max_bytes must be a positive integer)	�
ValueErrorrr.r*�readr�OSErrorrr)r+�	max_bytes�data�excs    r$�receivezFileReadStream.receiveQsx�����q�=��C�D�D�	/�"�+�+�D�J�J�O�O�Y�G�G�D���K���H���	0�%�4�/��	/�%�3�.��	/�s:�A9�-A�A�A�
A9�A�A6�*A1�1A6�6A9c��tK�tj|jj||��d{���S7��w)au
        Seek the file to the given position.

        .. seealso:: :meth:`io.IOBase.seek`

        .. note:: Not all file descriptors are seekable.

        :param position: position to seek the file to
        :param whence: controls how ``position`` is interpreted
        :return: the new absolute position
        :raises OSError: if the file is not seekable

        N)rr.r*�seek)r+�position�whences   r$rOzFileReadStream.seekas+�����'�'��
�
����6�J�J�J�J�s�/8�6�8c��pK�tj|jj��d{���S7��w)z�
        Return the current stream position.

        .. note:: Not all file descriptors are seekable.

        :return: the current absolute position
        :raises OSError: if the file is not seekable

        N)rr.r*�tellr0s r$rSzFileReadStream.tellqs'�����'�'��
�
���8�8�8�8�s�-6�4�6N)r�str | PathLike[str]r;r)i)rJrr;�bytes)rPrrQrr;r)r;r)
rrr �__doc__�classmethodrDrMr	rOrSr"r#r$rr=s0�������� 7?�K� 
9r#rc�8�eZdZdZe	d					dd��Zdd�Zy)rz�
    A byte stream that writes to a file in the file system.

    :param file: a file that has been opened for writing in binary mode

    .. versionadded:: 3.0
    c��K�|rdnd}tjt|�j|��d{���}||�S7��w)a
        Create a file write stream by opening the given file for writing.

        :param path: path of the file to write to
        :param append: if ``True``, open the file for appending; if ``False``, any
            existing file at the given path will be truncated

        �ab�wbNrA)rCr�append�moders     r$rDzFileWriteStream.from_path�s=�����t�4���'�'��T�
����>�>���4�y��?�s�3A�A�
Ac���K�	tj|jj|��d{���y7�#t$rt
d�t$r}t|�d}~wwxYw�wr()rr.r*�writerGrrIr)r+�itemrLs   r$�sendzFileWriteStream.send�sR����	/��$�$�T�Z�Z�%5�%5�t�<�<�<���	0�%�4�/��	/�%�3�.��	/�s1�A �-9�7�9�A �9�A�A�A�A N)F)rrTr\�boolr;r)r`rUr;r<)rrr rVrWrDrar"r#r$rr~s;����7<�
�&�
�04�
�	�
��
�/r#rN)�
__future__r�__all__�collections.abcrr�ior	r
�osr�pathlibr�typingr
r�rrrrrr�abcrrrr&rrr"r#r$�<module>rlsd��"���.�-������4�$�+�$���4>9�_�&7�>9�B/�o�~�/r#