403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/jeepney/io/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/jeepney/io/__pycache__/trio.cpython-311.pyc
�

+�c:���ddlZddlmZddlZddlmZddlZddlmZ	ddlm	Z	n#e
$r	ddlm	Z	YnwxYwddlm
Z
mZddlZddlmZddlmZmZdd	lmZdd
lmZmZddlmZmZmZddlmZm Z dd
l!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'm(Z(ej)e*��Z+gd�Z,ed���Z-Gd�de��Z.d"dd�de.fd�Z/Gd�de%��Z0Gd�d��Z1Gd�d��Z2Gd�d e��Z3e	d"dd�d!���Z4dS)#�N)�contextmanager)�count)�Optional)�asynccontextmanager)�Value�Error)�Channel)�
Authenticator�BEGIN)�get_bus)�FileDescriptor�fds_buf_size)�Parser�MessageType�Message)�	ProxyBase�
unwrap_msg)�message_bus�)�MessageFilters�FilterHandle�ReplyMatcher�RouterClosed�check_replyable)�open_dbus_connection�open_dbus_router�Proxyc#��K�	dV�dS#t$ra}|jtjtjhvrt	jd��d�t	jd�|����|�d}~wwxYw)Nzthis socket was already closedzsocket connection broken: {})�OSError�errno�EBADF�ENOTSOCK�trio�ClosedResourceError�BrokenResourceError�format)�excs �1/usr/lib/python3/dist-packages/jeepney/io/trio.py�)_translate_socket_errors_to_stream_errorsr)0s�����	�
������������9���e�n�5�5�5��*�+K�L�L�RV�V��*�.�5�5�c�:�:����
��������s�
�
A5�AA0�0A5c�z�eZdZdZdd�Zdd�defd�Zdefd	�Zdde	fd�Z
defd
�Zd�Zd�Z
d�Zed���ZdS)�DBusConnectiona�A plain D-Bus connection with no matching of replies.

    This doesn't run any separate tasks: sending and receiving are done in
    the task that calls those methods. It's suitable for implementing servers:
    several worker tasks can receive requests and send replies.
    For a typical client pattern, see :class:`DBusRouter`.

    Implements trio's channel interface for Message objects.
    Fc���||_||_t��|_t	d���|_d|_tj��|_	tj��|_
d|_dS)Nr)�start)�socket�
enable_fdsr�parserr�outgoing_serial�unique_namer#�Lock�	send_lock�	recv_lock�_leftover_to_send)�selfr.r/s   r(�__init__zDBusConnection.__init__Is[�����$����h�h���$�1�~�~�~������������������!%�����N��serial�messagec��:K�|j4�d{V��|�t|j��}|jrt	jd��nd}|�||���}|�||���d{V��ddd���d{V��dS#1�d{V��swxYwYdS)z.Serialise and send a :class:`~.Message` objectN�i)�fds)r4�nextr1r/�array�	serialise�
_send_data)r7r<r;r?�datas     r(�sendzDBusConnection.sendSs:�����>�	-�	-�	-�	-�	-�	-�	-�	-��~��d�2�3�3��&*�o�?�%�+�c�"�"�"�4�C��$�$�V��$�5�5�D��/�/�$��,�,�,�,�,�,�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-s�A'B
�

B�BrDc��:K�|jjrtjd���t	��5|jr |�|j���d{V��t|��5}|rE|j�|gtjj	tjj
|fg���d{V��}n |j�|���d{V��}|�||���d{V��ddd��n#1swxYwYddd��dS#1swxYwYdS)Nz!can't send data after sending EOF)r.�did_shutdown_SHUT_WRr#r$r)r6�_send_remainder�
memoryview�sendmsg�
SOL_SOCKET�
SCM_RIGHTSrE)r7rDr?�sents    r(rCzDBusConnection._send_data^s������;�+�	P��*�+N�O�O�O�
6�
8�
8�
	7�
	7��%�
C��*�*�4�+A�B�B�B�B�B�B�B�B�B��D�!�!�
7�T��8�!%��!4�!4�d�V���.���0F��?�>�"�"�������D�D�"&��!1�!1�$�!7�!7�7�7�7�7�7�7�D��*�*�4��6�6�6�6�6�6�6�6�6�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7����
7�
7�
7�
7�
	7�
	7�
	7�
	7�
	7�
	7�
	7�
	7�
	7�
	7�
	7�
	7����
	7�
	7�
	7�
	7�
	7�
	7s6�7D�(BC8�,D�8C<	�<D�?C<	�D�D�Drc��:K�	|t|��krZ||d�5}|j�|���d{V��}ddd��n#1swxYwY||z
}|t|��k�Zd|_dS#tj$r||d�|_�wxYw�N)�lenr.rEr6r#�	Cancelled)r7rD�already_sent�	remainingrMs     r(rHzDBusConnection._send_remainderqs����	���T���*�*��,�-�-�(�=�I�!%��!1�!1�)�!<�!<�<�<�<�<�<�<�D�=�=�=�=�=�=�=�=�=�=�=����=�=�=�=���$����T���*�*�&*�D�"�"�"���~�	�	�	�&*�,�-�-�%8�D�"��	���s.�A:�!A�A:�A�A:�A�"A:�: B�returnc��FK�|j4�d{V��	|j���}|�|cddd���d{V��S|����d{V��\}}|st	jd���|j�||���~#1�d{V��swxYwYdS)z5Return the next available message from the connectionNTzSocket closed at the other end)r5r0�get_next_message�
_read_datar#�EndOfChannel�add_data)r7�msg�br?s    r(�receivezDBusConnection.receivesK�����>�	-�	-�	-�	-�	-�	-�	-�	-�

-��k�2�2�4�4���?��		-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-� $���0�0�0�0�0�0�0�0���3��N��+�,L�M�M�M���$�$�Q��,�,�,�

-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-s�B�AB�
B�Bc��8K�|jr�|j���}t��5|j�|t
�����d{V��\}}}}ddd��n#1swxYwY|ttjdd��zr#|�	��td���|tj|��fSt��5|j�
d���d{V��}ddd��n#1swxYwY|gfS)N�
MSG_CTRUNCrz&Unable to receive all file descriptorsi)r/r0�
bytes_desiredr)r.�recvmsgr�getattrr#�_close�RuntimeErrorr
�from_ancdata�recv)r7�nbytesrD�ancdata�flags�_s      r(rWzDBusConnection._read_data�s������?�	��[�.�.�0�0�F�:�<�<�
�
�04��0C�0C��L�N�N�1�1�+�+�+�+�+�+�'��g�u�a�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��w�t�{�L�!�<�<�<�
M����
�
�
�"�#K�L�L�L���4�W�=�=�=�=�;�<�<�
4�
4�!�[�-�-�d�3�3�3�3�3�3�3�3��
4�
4�
4�
4�
4�
4�
4�
4�
4�
4�
4����
4�
4�
4�
4���8�Os#�3A0�0A4�7A4� !D
�
D�Dc�F�|j���d|_dSrO)r.�closer6�r7s r(rbzDBusConnection._close�s$���������!%����r9c��2K�|���dS)zClose the D-Bus connectionN)rbrls r(�aclosezDBusConnection.aclose�s�������
�
�
�
�
r9c�\K�tj��4�d{V��}t|��}|�|���d{V��	|WV�|����d{V��n#|����d{V��wxYw	ddd���d{V��dS#1�d{V��swxYwYdS)aYTemporarily wrap this connection as a :class:`DBusRouter`

        To be used like::

            async with conn.router() as req:
                reply = await req.send_and_get_reply(msg)

        While the router is running, you shouldn't use :meth:`receive`.
        Once the router is closed, you can use the plain connection again.
        N)r#�open_nursery�
DBusRouterr-rn)r7�nursery�routers   r(rszDBusConnection.router�s_�����$�&�&�	&�	&�	&�	&�	&�	&�	&�'���%�%�F��,�,�w�'�'�'�'�'�'�'�'�'�
&�������m�m�o�o�%�%�%�%�%�%�%�%��f�m�m�o�o�%�%�%�%�%�%�%�%����%�
	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�	&�	&s)�+B�A(�
B�(B�B�
B%�(B%)F)r)�__name__�
__module__�__qualname__�__doc__r8rrE�bytesrCrIrHr\rWrbrnrrs�r9r(r+r+?s���������&�&�&�&�6:�-�-�-�'�-�-�-�-�7�U�7�7�7�7�&��*�����
-�w�
-�
-�
-�
-����"&�&�&�
����&�&���&�&�&r9r+�SESSIONF�r/rTc��zK�t|��}tj|���d{V��}t|���}|D]J}|�|���d{V��|�|����d{V�����K|�t���d{V��t|j	|���}|�
��4�d{V��}|�tj
�����d{V��}|jd|_ddd���d{V��n#1�d{V��swxYwY|S)zHOpen a plain D-Bus connection

    :return: :class:`DBusConnection`
    Nr{r)rr#�open_unix_socketr
�send_all�feed�receive_somerr+r.rs�send_and_get_replyr�Hello�bodyr2)	�busr/�bus_addr�sock�authr�req_data�connrs�replys	         r(rr�s�����
�s�|�|�H�%)�%:�8�%D�%D�D�D�D�D�D�D�D�
�Z�0�0�0�E��.�.���m�m�H�%�%�%�%�%�%�%�%�%�
�
�
��*�*�,�,�,�,�,�,�,�,�-�-�-�-�
�-�-��
�
���������$�+�*�=�=�=�D��{�{�}�}�)�)�)�)�)�)�)���/�/��0A�0C�0C�D�D�D�D�D�D�D�D�� �:�a�=���)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)����)�)�)�)��Ks�?D*�*
D4�7D4c�L��eZdZdef�fd�Zed���Zd�Zd�Zd�Z	�xZ
S)�TrioFilterHandle�filtersc�\��t���|||��||_dSrO)�superr8�send_channel)r7r��rule�send_chn�recv_chn�	__class__s     �r(r8zTrioFilterHandle.__init__�s-���
������$��1�1�1�$����r9c��|jSrO��queuerls r(�receive_channelz TrioFilterHandle.receive_channel�s
���z�r9c��pK�|���|j����d{V��dSrO)rkr�rnrls r(rnzTrioFilterHandle.aclose�s@�����
�
������&�&�(�(�(�(�(�(�(�(�(�(�(r9c��K�|jSrOr�rls r(�
__aenter__zTrioFilterHandle.__aenter__�s�����z�r9c��>K�|����d{V��dSrO)rn)r7�exc_type�exc_val�exc_tbs    r(�	__aexit__zTrioFilterHandle.__aexit__�s,�����k�k�m�m���������r9)rtrurvrr8�propertyr�rnr�r��
__classcell__�r�s@r(r�r��s��������%��%�%�%�%�%�%�����X��)�)�)����������r9r�c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�Futurez4A very simple Future for trio based on `trio.Event`.c�D�d|_tj��|_dSrO)�_outcomer#�Event�_eventrls r(r8zFuture.__init__�s����
��j�l�l����r9c�`�t|��|_|j���dSrO)rr�r��set)r7�results  r(�
set_resultzFuture.set_result�s'���f�
�
��
���������r9c�`�t|��|_|j���dSrO)rr�r�r�)r7r's  r(�
set_exceptionzFuture.set_exception�s'���c�
�
��
���������r9c��vK�|j����d{V��|j���SrO)r��waitr��unwraprls r(�getz
Future.get�s@�����k��� � � � � � � � � ��}�#�#�%�%�%r9N)rtrurvrwr8r�r�r�ryr9r(r�r��sV������>�>�#�#�#�������&�&�&�&�&r9r�c��eZdZdZdZdZdefd�Zed���Z	dd�d�Z
defd	�Zdd
d�de
ejfd
�Zdejfd�Zd�Zdefd�Zejfd�ZdS)rqz�A client D-Bus connection which can wait for replies.

    This runs a separate receiver task and dispatches received messages.
    Nr�c�`�||_t��|_t��|_dSrO)�_connr�_repliesr�_filters)r7r�s  r(r8zDBusRouter.__init__s%����
�$����
�&�(�(��
�
�
r9c��|jjSrO)r�r2rls r(r2zDBusRouter.unique_names
���z�%�%r9r:c��NK�|j�||����d{V��dS)z/Send a message, don't wait for a reply
        r:N)r�rE)r7r<r;s   r(rEzDBusRouter.sends8�����j�o�o�g�f�o�5�5�5�5�5�5�5�5�5�5�5r9rTc��rK�t|��|j�td���t|jj��}|j�|t����5}|�	||����d{V��|�
���d{V��cddd��S#1swxYwYdS)z�Send a method call message and wait for the reply

        Returns the reply message (method return or error message type).
        NzThis DBusRouter has stoppedr:)r�_rcv_cancel_scoperr@r�r1r��catchr�rEr�)r7r<r;�	reply_futs    r(r�zDBusRouter.send_and_get_replys����
	�� � � ��!�)��<�=�=�=��d�j�0�1�1��
�]�
 �
 �����
2�
2�	+�i��)�)�G�F�)�3�3�3�3�3�3�3�3�3�#�-�-�/�/�)�)�)�)�)�)�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s�(7B,�,B0�3B0r)�channel�bufsizer�c�h�|�tj|��\}}nd}t|j|||��S)aCreate a filter for incoming messages

        Usage::

            async with router.filter(rule) as receive_channel:
                matching_msg = await receive_channel.receive()

            # OR:
            send_chan, recv_chan = trio.open_memory_channel(1)
            async with router.filter(rule, channel=send_chan):
                matching_msg = await recv_chan.receive()

        If the channel fills up,
        The sending end of the channel is closed when leaving the ``async with``
        block, whether or not it was passed in.

        :param jeepney.MatchRule rule: Catch messages matching this rule
        :param trio.MemorySendChannel channel: Send matching messages here
        :param int bufsize: If no channel is passed in, create one with this size
        N)r#�open_memory_channelr�r�)r7r�r�r��recv_channels     r(�filterzDBusRouter.filter#s;��*�?�$(�$<�W�$E�$E�!�G�\�\��L���
�t�W�l�K�K�Kr9rrc��K�|j�td���|�|j���d{V��|_dS)Nz+DBusRouter receiver task is already running)r�rcr-�	_receiver)r7rrs  r(r-zDBusRouter.start@sL�����!�-��L�M�M�M�'.�}�}�T�^�'D�'D�!D�!D�!D�!D�!D�!D����r9c��K�|j� |j���d|_tjd���d{V��dS)z Stop the sender & receiver tasksNr)r��cancelr#�sleeprls r(rnzDBusRouter.acloseEsV�����!�-��"�)�)�+�+�+�%)�D�"��j��m�m���������r9rZc���|j�|��rdS|j�|��D]2}	|j�|���#tj$rY�/wxYwdS)zHandle one received messageN)r��dispatchr��matchesr��send_nowaitr#�
WouldBlock)r7rZr�s   r(�	_dispatchzDBusRouter._dispatchRs����=�!�!�#�&�&�	��F��m�+�+�C�0�0�	�	�F�
��#�/�/��4�4�4�4���?�
�
�
���
����	�	s�A�A'�&A'c	�� K�tj��5}d|_|�|��		|j����d{V��}|�|���5#d|_|j���tj	d��5}|j
j���D](}d|_
|j����d{V���)	ddd��w#1swxYwYwxYw#1swxYwYdS)z'Receiver loop - runs in a separate taskTNF�)r#�CancelScope�
is_running�startedr�r\r�r��drop_all�
move_on_afterr�r��values�shieldr�rn)r7�task_status�cscoperZ�
cleanup_scoper�s      r(r�zDBusRouter._receiver]s�����
�
�
�
�	;�6�"�D�O�����'�'�'�
;�(� $�
� 2� 2� 4� 4�4�4�4�4�4�4�C��N�N�3�'�'�'�(��#(����
�&�&�(�(�(��'��*�*�;�m�"&�-�"7�">�">�"@�"@�;�;��/3�
�,�$�1�8�8�:�:�:�:�:�:�:�:�:�:�;�;�;�;�;�;�;�;�;�;�;�;����;�;�;�;�;����	;�	;�	;�	;����	;�	;�	;�	;�	;�	;sG�D�6A*�*5D�AC4	�(D�4C8
�8D�;C8
�<D�D�D�
D)rtrurvrw�_nursery_mgrr�r+r8r�r2rErr�rr#�MemorySendChannelr��Nurseryr-rnr��TASK_STATUS_IGNOREDr�ryr9r(rqrq�s@���������L���)�^�)�)�)�)�
�&�&��X�&�-1�6�6�6�6�6�

+�7�
+�
+�
+�
+�IM�VW�L�L�L�x��0F�'G�L�L�L�L�:E�4�<�E�E�E�E�
	�	�	�	�W�	�	�	�	�+/�*B�;�;�;�;�;�;r9rqc�(��eZdZdZ�fd�Zd�Z�xZS)ra�A trio proxy for calling D-Bus methods

    You can call methods on the proxy object, such as ``await bus_proxy.Hello()``
    to make a method call over D-Bus and wait for a reply. It will either
    return a tuple of returned data, or raise :exc:`.DBusErrorResponse`.
    The methods available are defined by the message generator you wrap.

    :param msggen: A message generator object.
    :param ~trio.DBusRouter router: Router to send and receive messages.
    c���t���|��t|t��st	d���||_dS)Nz)Proxy can only be used with DBusRequester)r�r8�
isinstancerq�	TypeError�_router)r7�msggenrsr�s   �r(r8zProxy.__init__~sH���
������ � � ��&�*�-�-�	I��G�H�H�H�����r9c������fd�}|S)Nc���K��|i|��}|jjtjusJ��j�|���d{V��}t
|��SrO)�header�message_typer�method_callr�r�r)�args�kwargsrZr��make_msgr7s    ��r(�innerz!Proxy._method_call.<locals>.inner�si������(�D�+�F�+�+�C��:�*�k�.E�E�E�E�E��,�9�9�#�>�>�>�>�>�>�>�>�E��e�$�$�$r9ry)r7r�r�s`` r(�_method_callzProxy._method_call�s)����	%�	%�	%�	%�	%�	%��r9)rtrurvrwr8r�r�r�s@r(rrssQ�������	�	������������r9rc�K�t||����d{V��}|4�d{V��|���4�d{V��}|WV�ddd���d{V��n#1�d{V��swxYwYddd���d{V��dS#1�d{V��swxYwYdS)a�Open a D-Bus 'router' to send and receive messages.

    Use as an async context manager::

        async with open_dbus_router() as req:
            ...

    :param str bus: 'SESSION' or 'SYSTEM' or a supported address.
    :return: :class:`DBusRouter`

    This is a shortcut for::

        conn = await open_dbus_connection()
        async with conn:
            async with conn.router() as req:
                ...
    r{N)rrs)r�r/r��rtrs    r(rr�s�����&&�c�j�A�A�A�A�A�A�A�A�A�D�����������;�;�=�=�	�	�	�	�	�	�	�C��I�I�I�I�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	���������������������������������s4�A9�A�A9�
A	�A9�"A	�#A9�9
B�B)rz)5rA�
contextlibrr �	itertoolsr�logging�typingrr�ImportError�async_generator�outcomerrr#�trio.abcr	�jeepney.authr
r�jeepney.busr�jeepney.fdsr
r�jeepney.low_levelrrr�jeepney.wrappersrr�jeepney.bus_messagesr�commonrrrrr�	getLoggerrt�log�__all__r)r+rr�r�rqrrryr9r(�<module>rs+������%�%�%�%�%�%���������������������4�.�.�.�.�.�.�.���4�4�4�3�3�3�3�3�3�3�3�4����!� � � � � � � �����������-�-�-�-�-�-�-�-�������4�4�4�4�4�4�4�4�:�:�:�:�:�:�:�:�:�:�2�2�2�2�2�2�2�2�,�,�,�,�,�,����������������g���!�!������&�
�
���
�{&�{&�{&�{&�{&�W�{&�{&�{&�|�E����n�����4�����|����(&�&�&�&�&�&�&�&�&r;�r;�r;�r;�r;�r;�r;�r;�j�����I����6�����������s�'�5�5

Youez - 2016 - github.com/yon3zu
LinuXploit