%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/jeepney/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/jeepney/__pycache__/fds.cpython-312.pyc

�

+�c���\�ddlZddlZddlZddlmZGd�de�ZGd�d�Zdad�Z	y)�N)�warnc��eZdZdZy)�	NoFDErrorzQRaised by :class:`FileDescriptor` methods if it was already closed/converted
    N)�__name__�
__module__�__qualname__�__doc__���-/usr/lib/python3/dist-packages/jeepney/fds.pyrrs
���rrc�x�eZdZdZdZdZdZd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zdd�Zd�Zeddgfd��Zy)�FileDescriptora+A file descriptor received in a D-Bus message

    This wrapper helps ensure that the file descriptor is closed exactly once.
    If you don't explicitly convert or close the FileDescriptor object, it will
    close its file descriptor when it goes out of scope, and emit a
    ResourceWarning.
    ��_fd������c��||_y�Nr��self�fds  r�__init__zFileDescriptor.__init__s	����rc��|j}|j|jk(rd}n|j|jk(rd}d|�d�S)N�closed�	convertedz<FileDescriptor (z)>)r�_CLOSED�
_CONVERTED�r�details  r�__repr__zFileDescriptor.__repr__sD�������8�8�t�|�|�#��F�
�X�X����
(� �F�"�6�(�"�-�-rc���|j|jk(ry|j|jk(rtd��|j|jc|_}t	j
|�y)aClose the file descriptor

        This can safely be called multiple times, but will raise RuntimeError
        if called after converting it with one of the ``to_*`` methods.

        This object can also be used in a ``with`` block, to close it on
        leaving the block.
        z.Can't close FileDescriptor after converting itN)rrrr�os�closers  rr#zFileDescriptor.close$sS���8�8�t�|�|�#��
�X�X����
(��L�M�M��<�<����L�D�H�b��H�H�R�Lrc��|Srr
�rs r�	__enter__zFileDescriptor.__enter__5s���rc�$�|j�yr)r#)r�exc_type�exc_val�exc_tbs    r�__exit__zFileDescriptor.__exit__8s���
�
�rc��|jdk\r2td|j�d�td|��|j�yy)NrzFileDescriptor (z") was neither closed nor converted�)�
stacklevel�source)rr�ResourceWarningr#r%s r�__del__zFileDescriptor.__del__;s=���8�8�q�=��"�4�8�8�*�,N�O��A�d�
�
�J�J�L�rc�x�|jdkr+|j|jk(rdnd}td|����y)Nrrrz"FileDescriptor object was already )rrrrs  r�_checkzFileDescriptor._checkCs;���8�8�a�<�!%���T�\�\�!9�X�{�F��@���I�J�J�rc�:�|j�|jS)z�Get the integer file descriptor

        This does not change the state of the :class:`FileDescriptor` object,
        unlike the ``to_*`` methods.
        )r3rr%s r�filenozFileDescriptor.filenoHs��	
���
��x�x�rc�b�|j�|j|jc|_}|S)a,Convert to the low-level integer file descriptor::

            raw_fd = fd.to_raw_fd()
            os.write(raw_fd, b'xyz')
            os.close(raw_fd)

        The :class:`FileDescriptor` can't be used after calling this. The caller
        is responsible for closing the file descriptor.
        )r3rrrs  r�	to_raw_fdzFileDescriptor.to_raw_fdQs'��	
���
����������"��	rNc�~�|j�t|j|||||��}|j|_|S)aKConvert to a Python file object::

            with fd.to_file('w') as f:
                f.write('xyz')

        The arguments are the same as for the builtin :func:`open` function.

        The :class:`FileDescriptor` can't be used after calling this. Closing
        the file object will also close the file descriptor.
        )�	buffering�encoding�errors�newline)r3�openrr)r�moder9r:r;r<�fs       r�to_filezFileDescriptor.to_file_s;��	
���
���H�H�d�i��f�g�
���?�?����rc�z�ddlm}|j�||j��}|j|_|S)aCConvert to a socket object

        This returns a standard library :func:`socket.socket` object::

            with fd.to_socket() as sock:
                b = sock.sendall(b'xyz')

        The wrapper object can't be used after calling this. Closing the socket
        object will also close the file descriptor.
        r)�socket)r5)rBr3rr)rrB�ss   r�	to_socketzFileDescriptor.to_socketrs.��	"����
��$�(�(�#���?�?����r�returnc	�4�tjd�}|D]d\}}}|tjk(s�|tjk(s�/|j	|dt|�t|�|jzz
��f|D�cgc]
}||���c}Scc}w)z�Make a list of FileDescriptor from received file descriptors

        ancdata is a list of ancillary data tuples as returned by socket.recvmsg()
        �iN)�arrayrB�
SOL_SOCKET�
SCM_RIGHTS�	frombytes�len�itemsize)�cls�ancdata�fds�
cmsg_level�	cmsg_type�datarGs       r�from_ancdatazFileDescriptor.from_ancdata�s����k�k�#���+2�	M�'�J�	�4��V�.�.�.�9��@Q�@Q�3Q��
�
�d�#J�C��I��T��S�\�\�1I�$J�K�L�	M�!$�$�1��A��$�$��$s�B)rNNN)rrrr	�	__slots__rrrr r#r&r+r1r3r5r7r@rD�classmethodrTr
rrrr
so����I��G��J��.��"���K�
���&�$�
%�'7�&8�
%��
%rrc��t�9d}tjd�j}tj||z�atS)N�rG)�_fds_buf_size_cacherHrMrB�
CMSG_SPACE)�maxfds�fd_sizes  r�fds_buf_sizer]�s?���"����+�+�c�"�+�+��$�/�/���0@�A���r)
rHr"rB�warningsr�RuntimeErrorrrrYr]r
rr�<module>r`s7���	�
��	��	�B%�B%�J��
r

Zerion Mini Shell 1.0