403Webshell
Server IP : 77.50.203.18  /  Your IP : 192.168.0.10
Web Server : Apache/2.4.62 (CentOS Stream) OpenSSL/3.5.7 mpm-itk/2.4.7-04 PHP/8.4.23
System : Linux web2 5.14.0-722.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 6 09:07:51 UTC 2026 x86_64
User : warsnews.ru ( 1001)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.9/site-packages/dasbus/server/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/dasbus/server/__pycache__/handler.cpython-39.pyc
a

�icwL�@s�ddlZddlmZmZddlmZddlmZddlm	Z	ddl
mZmZddl
mZmZddlmZmZmZddlZe�d	d
�ddlmZe�e�Zgd�ZGd
d�de�ZGdd�ded�ZGdd�de�ZdS)�N)�ABCMeta�abstractmethod)�partial)�ErrorMapper)�Signal)�get_xml�"are_additional_arguments_supported)�DBusSpecification�DBusSpecificationError)�get_variant�unwrap_variant�is_tuple_of_one�Gioz2.0)r)�
GLibServer�AbstractServerObjectHandler�ServerObjectHandlerc@steZdZdZeddd��Zeddd��Zedd	��Zed
d��Zedd
��Z	edd��Z
edd��Zedd��ZdS)rz0The low-level DBus server library based on GLib.NcCs|�|||||�dS)zEmit a DBus signal.N)�emit_signal)�cls�
connection�object_path�interface_name�signal_name�
parametersZdestination�r�9/usr/lib/python3.9/site-packages/dasbus/server/handler.pyr/s�zGLibServer.emit_signalrcCsftj�|�}t|j||fd�}g}|js0td��|jD] }	|�||	|dd�}
|�|
�q6t|j	||�S)zRegister an object on DBus.)�	user_dataz$No DBus interfaces for registration.N)
rZDBusNodeInfoZnew_for_xmlr�_object_callbackZ
interfacesr
�register_object�append�_unregister_object)rrrZ
object_xml�callback�
callback_argsZ	node_infoZmethod_call_closure�
registrationsZinterface_info�registration_idrrrr;s4���
��zGLibServer.register_objectcCs|D]}|�|�qdS)zUnregister an object from DBus.N)Zunregister_object)rrr"r#rrrr]szGLibServer._unregister_objectc	Cs"|\}	}
|	||||g|
�R�dS)Nr)rr�senderrr�method_namer�
invocationrr r!rrrrcs��zGLibServer._object_callbackcCsd|��iS)a9Get information about the DBus call.

        Supported items:

            sender str: The bus name that invoked the method

        There can be more supported items in the future.

        :param invocation: an invocation of a DBus call
        :return: a dictionary of information about the DBus call
        r$)Z
get_sender)rr&rrr�
get_call_infoss�zGLibServer.get_call_infocCs|�||�dS)z�Set the error of the DBus call.

        :param invocation: an invocation of a DBus call
        :param error_name: a DBus name of the error
        :param error_message: an error message
        N)Zreturn_dbus_error)rr&�
error_nameZ
error_messagerrr�set_call_error�szGLibServer.set_call_errorcCs|�||�}|�|�dS)z�Set the reply of the DBus call.

        :param invocation: an invocation of a DBus call
        :param out_type: a type of the reply
        :param out_value: a value of the reply
        N)�_get_reply_valueZreturn_value)rr&�out_type�	out_valueZreply_valuerrr�set_call_reply�szGLibServer.set_call_replycCs$|durdSt|�r|f}t||�S)z%Get the reply value of the DBus call.N)r
r)rr+r,rrrr*�s
zGLibServer._get_reply_value)N)r)
�__name__�
__module__�__qualname__�__doc__�classmethodrrrrr'r)r-r*rrrrr,s&��!



	

rc@s�eZdZdZgd�Zdd�Zedd��Zdd�Ze	d	d
��Z
e	dd��Ze	d
d��Ze	dd��Z
e	dd��Zdd�Zdd�Zdd�Zdd�Ze	dd��ZdS)rz+The abstract handler of a published object.��_message_bus�_object_path�_object�_specificationcCs||_||_||_d|_dS)z�Create a new handler.

        :param message_bus: a message bus
        :param object_path: a DBus path of the object
        :param obj: a Python instance of the object
        Nr3)�self�message_busr�objrrr�__init__�sz$AbstractServerObjectHandler.__init__cCs|js|��|_|jS)zDBus specification.)r7�_get_specification�r8rrr�
specification�s
z)AbstractServerObjectHandler.specificationcCst�|���S)zKGet the DBus specification.

        :return: a DBus specification
        )r	Zfrom_xml�_get_xml_specificationr=rrrr<�s�z.AbstractServerObjectHandler._get_specificationcCsdS)�IGet the XML specification.

        :return: a XML specification
        �rr=rrrr?�sz2AbstractServerObjectHandler._get_xml_specificationcCsdS)z�Connect the object to DBus.

        Handle emitted signals of the object with the _emit_signal
        method and handle incoming DBus calls with the _handle_call
        method.
        Nrr=rrr�connect_object�sz*AbstractServerObjectHandler.connect_objectcCsdS)zdDisconnect the object from DBus.

        Unregister the object and disconnect all signals.
        Nrr=rrr�disconnect_object�sz-AbstractServerObjectHandler.disconnect_objectcCsdS)z�Connect a DBus signal.

        :param interface_name: a DBus interface name
        :param signal_name: a DBus signal name
        Nr�r8rrrrr�_connect_signal�sz+AbstractServerObjectHandler._connect_signalcGsdS)z�Handle a DBus signal.

        :param interface_name: a DBus interface name
        :param signal_name: a DBus name of the signal
        :param parameters: a signal parameters
        Nr)r8rrrrrr�_emit_signal�sz(AbstractServerObjectHandler._emit_signalcOs&|�||�}t|�si}||i|��S)a*Handle a DBus call.

        :param interface_name: a name of the interface
        :param method_name: a name of the called method
        :param parameters: parameters of the call
        :param additional_args: additional arguments of the call
        :return: a result of the DBus call
        )�
_find_handlerr)r8rr%r�additional_args�handlerrrr�_handle_call�s
z(AbstractServerObjectHandler._handle_callcCs|j�||�S)z�Find a specification of the DBus member.

        :param interface_name: a name of the interface
        :param member_name: a name of the member
        :return: a specification of the member
        )r>Z
get_member�r8r�member_namerrr�_find_member_specs�z-AbstractServerObjectHandler._find_member_speccCs0|�||�p|�||�}|s,td�||���|S)z�Find a handler of a DBus member.

        :param interface_name: a name of the interface
        :param member_name: a name of the method
        :return: a handler
        z The member {}.{} has no handler.)�_find_object_handler�_find_default_handler�AttributeError�format)r8rrLrIrrrrGs
��z)AbstractServerObjectHandler._find_handlercCst|j|d�S)aeGet an object handler of a DBus call.

        By default, DBus interfaces with members of the same name are
        not supported, so the given interface name is not used to find
        the object handler.

        :param interface_name: a name of the interface.
        :param member_name: a name of the member
        :return: a handler or None
        N)�getattrr6rKrrrrN'sz0AbstractServerObjectHandler._find_object_handlercCsdS)��Find a default handler of a DBus call.

        :param interface_name: a name of the interface
        :param member_name: a name of the member
        :return: a handler or None
        NrrKrrrrO4sz1AbstractServerObjectHandler._find_default_handlerN)r.r/r0r1�	__slots__r;�propertyr>r<rr?rBrCrErFrJrMrGrNrOrrrrr�s,
	

	


	
r)�	metaclasscs�eZdZdZgd�Zdeef�fdd�	Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zed(d)��Z�ZS)*rz+The handler of an object published on DBus.)�_server�_signal_factory�
_error_mapper�_registrationsNcs2t��|||�||_||_|p$t�|_g|_dS)aACreate a new handler.

        :param message_bus: a message bus
        :param object_path: a DBus path of the object
        :param obj: a Python instance of the object
        :param error_mapper: a DBus error mapper
        :param server: a DBus server library
        :param signal_factory: a signal factory
        N)�superr;rWrXrrYrZ)r8r9rr:Zerror_mapperZserverZsignal_factory��	__class__rrr;Is
zServerObjectHandler.__init__cCs
t|j�S)r@)rr6r=rrrr?Zsz*ServerObjectHandler._get_xml_specificationcCs|��|��dS)zConnect the object to DBus.N)�_register_object�_connect_signalsr=rrrrBasz"ServerObjectHandler.connect_objectcCs|jr|j��}|�qdS)z Disconnect the object from DBus.N)rZ�pop)r8r rrrrCfs
z%ServerObjectHandler.disconnect_objectcCs.|j�|jj|j|��|j�}|j�|�dS)zLRegister to DBus calls.

        :return: an unregistering callback
        N)	rWrr4rr5r?�_method_callbackrZr)r8Z
unregisterrrrr^ls�z$ServerObjectHandler._register_objectcCs0|jjD]"}t|tj�sq|�|j|j�qdS)zConnect all DBus signals.N)r>�members�
isinstancer	rrEr�name)r8�memberrrrr_zs�z$ServerObjectHandler._connect_signalscCs>|�||�}|�||�}|�|�t|j|�}|j�|�dS)z�Connect a DBus signal.

        :param interface_name: a DBus interface name
        :param signal_name: a DBus signal name
        :return: a disconnecting callback
        N)�
_find_emitterrGZconnectr�
disconnectrZr)r8rrr �signalrgrrrrE�s

z#ServerObjectHandler._connect_signalcCst|j||�S)z�Find an emitter of a DBus signal.

        :param interface_name: a DBus interface name
        :param signal_name: a DBus signal name
        :return: a callback
        )rrFrDrrrrf�sz!ServerObjectHandler._find_emittercGsH|�||�}|sd}|jdur*t|j|�}|j�|jj|j|||�dS)z�Handle a DBus signal.

        :param interface_name: a DBus interface name
        :param signal_name: a DBus signal name
        :param parameters: a signal parameters
        N)rM�typerrWrr4rr5)r8rrrrerrrrF�s
�z ServerObjectHandler._emit_signalc	
Cs�zL|�||||�}|�||�}|j||gt|��Ri|��}|�|||�Wn4ty�}z|�||||�WYd}~n
d}~00dS)z�The callback for a DBus call.

        :param invocation: an invocation of the DBus call
        :param interface_name: a DBus interface name
        :param method_name: a DBus method name
        :param parameters: a variant of DBus arguments
        N)�_get_additional_argumentsrMrJr�_handle_method_result�	Exception�_handle_method_error)	r8r&rr%rrHre�result�errorrrrra�s>	�������z$ServerObjectHandler._method_callbackcCsd|j�|�iS)aBGet additional arguments of a DBus call.

        Supported items:

            call_info dict: Information about the DBus call

        This method is useful for customizations. It shouldn't be changed
        in this library unless we make sure that the change won't break
        the existing use cases.

        :param invocation: an invocation of the DBus call
        :param interface_name: a DBus interface name
        :param method_name: a DBus method name
        :param parameters: a variant of DBus arguments
        :return: a dictionary of additional info
        Z	call_info)rWr')r8r&rr%rrrrrj�s�z-ServerObjectHandler._get_additional_argumentscCs:tjd||dd�|j�t|��}|j�||t|��dS)aHandle an error of a DBus call.

        :param invocation: an invocation of the DBus call
        :param interface_name: a DBus interface name
        :param method_name: a DBus method name
        :param error: an exception raised during the call
        z,The call %s.%s has failed with an exception:T)�exc_infoN)�logZwarningrYZget_error_namerirWr)�str)r8r&rr%ror(rrrrm�s	���z(ServerObjectHandler._handle_method_errorcCs|j�||j|�dS)z�Handle a result of a DBus call.

        :param invocation: an invocation of a DBus call
        :param method_spec: a method specification
        :param method_reply: a method reply
        N)rWr-r+)r8r&Zmethod_specZmethod_replyrrrrks
�z)ServerObjectHandler._handle_method_resultcCsD|dkr@|dkr|jS|dkr$|jS|dkr2|jS|dkr@|jSdS)rSzorg.freedesktop.DBus.PropertiesZGet�SetZGetAllZPropertiesChangedN)�
_get_property�
_set_property�_get_all_properties�_properties_changedrKrrrrOsz)ServerObjectHandler._find_default_handlercCs:|�||�}|js"td�||���t|j|�}t|j|�S)z�The default handler of the Get method.

        :param interface_name: an interface name
        :param property_name: a property name
        :return: a variant with a property value
        z#The property {}.{} is not readable.)rM�readablerPrQrRr6rri)r8r�
property_namere�valuerrrrt&s�z!ServerObjectHandler._get_propertycCs8|�||�}|js"td�||���t|j|t|��dS)z�The default handler of the Set method.

        :param interface_name: an interface name
        :param property_name: a property name
        :param property_value: a variant with a property value
        z#The property {}.{} is not writable.N)rM�writablerPrQ�setattrr6r)r8rryZproperty_valuererrrru7s�z!ServerObjectHandler._set_propertycs�fdd�|jjD�S)z�Find all properties of the given interface.

        :param interface_name: an interface name
        :return: a list of property names
        cs.g|]&}t|tj�r|j�kr|jr|j�qSr)rcr	ZPropertyrrxrd)�.0re�rrr�
<listcomp>Ms

�z<ServerObjectHandler._find_all_properties.<locals>.<listcomp>)r>rb�r8rrr~r�_find_all_propertiesGs
�z(ServerObjectHandler._find_all_propertiescs��fdd�����D�S)z�The default handler of the GetAll method.

        :param interface_name: an interface name
        :return: a dictionary of properties
        csi|]}|���|��qSr)rt)r}ry�rr8rr�
<dictcomp>Zs�z;ServerObjectHandler._get_all_properties.<locals>.<dictcomp>)r�r�rr�rrvTs�z'ServerObjectHandler._get_all_propertiescCs|��S)zXThe default handler of the PropertiesChanged method.

        :return: a signal
        )rXr=rrrrw_sz'ServerObjectHandler._properties_changed)r.r/r0r1rTrrr;r?rBrCr^r_rErfrFrarjrmrkrOrtrur�rvrUrw�
__classcell__rrr\rr?s0�	'

r) Zlogging�abcrr�	functoolsrZdasbus.errorrZ
dasbus.signalrZdasbus.server.interfacerrZdasbus.specificationr	r
Z
dasbus.typingrrr
ZgiZrequire_versionZ
gi.repositoryrZ	getLoggerr.rq�__all__�objectrrrrrrr�<module>s 
y

Youez - 2016 - github.com/yon3zu
LinuXploit