| 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 : /usr/lib/python3.9/site-packages/dasbus/server/__pycache__/ |
Upload File : |
a
�ic�V � @ s� d dl Z d dlZd dl mZ d dlmZ d dlmZ d dlmZ d dl m
Z
mZ d dlm
Z
mZmZmZ d dlmZ g d �Zd
ZdZdZd
d� Zdd� Zdd� ZG dd� de�Zddd�Zdd� Zdd� ZG dd� de�ZdS )� N)� Parameter)�get_type_hints)�
get_dbus_name)�Signal)�DBusSpecificationError�DBusSpecification)�
get_dbus_type�is_base_type�get_type_arguments�Tuple)�XMLGenerator)�
dbus_class�dbus_interface�dbus_signal�get_xml�accepts_additional_arguments�"are_additional_arguments_supportedZ__dbus_xml__Z*__dbus_method_returns_multiple_arguments__Z-__dbus_handler_accepts_additional_arguments__c C s t | td� | S )a� Decorator for returning multiple arguments from a DBus method.
The decorator allows to generate multiple output arguments in the
XML specification of the decorated DBus method. Otherwise, there
will be only one output argument in the specification.
Define a DBus method with multiple output arguments:
.. code-block:: python
@returns_multiple_arguments
def Method(self) -> Tuple[Int, Bool]:
return 0, False
The generated XML specification of the example:
.. code-block:: xml
<method name="Method">
<arg direction="out" name="return_0" type="i"/>
<arg direction="out" name="return_1" type="b"/>
</method>
If the XML specification is not generated by the dbus_interface
decorator, the returns_multiple_arguments decorator has no effect.
:param method: a DBus method
:return: a DBus method with a flag
T)�setattr�$RETURNS_MULTIPLE_ARGUMENTS_ATTRIBUTE��method� r �;/usr/lib/python3.9/site-packages/dasbus/server/interface.py�returns_multiple_arguments: s r c C s t | td� | S )a[ Decorator for accepting extra arguments in a DBus method.
The decorator allows the server object handler to propagate
additional information about the DBus call into the decorated
method.
Use a dictionary of keyword arguments:
.. code-block:: python
@accepts_additional_arguments
def Method(x: Int, y: Str, **info):
pass
Or use keyword only parameters:
.. code-block:: python
@accepts_additional_arguments
def Method(x: Int, y: Str, *, call_info):
pass
At this moment, the library provides only the call_info argument
generated by GLibServer.get_call_info, but the additional arguments
can be customized in the _get_additional_arguments method of the
server object handler.
:param method: a DBus method
:return: a DBus method with a flag
T)r �&ACCEPTS_ADDITIONAL_ARGUMENTS_ATTRIBUTEr r r r r \ s r c C s t | td�S )zyDoes the given DBus method accept additional arguments?
:param method: a DBus method
:return: True or False
F)�getattrr r r r r r s r c @ s6 e Zd ZdZdefdd�Zdd� Zdd� Zd d
� ZdS )r a� DBus signal.
Can be used as:
.. code-block:: python
Signal = dbus_signal()
Or as a method decorator:
.. code-block:: python
@dbus_signal
def Signal(x: Int, y: Double):
pass
Signal is defined by the type hints of a decorated method.
This method is accessible as: signal.definition
If the signal is not defined by a method, it is expected to
have no arguments and signal.definition is equal to None.
Nc C s || _ || _d| _dS )z�Create a signal descriptor.
:param definition: a definition of the emit function
:param factory: a signal factory
N)�
definition�factory�name)�selfr r r r r �__init__� s zdbus_signal.__init__c C s. | j durdS d�t| �j�� |�� �| _ dS )aV Set a name of the descriptor
The descriptor has been assigned to the specified name.
Generate a name of a private attribute that will be set
to a signal in the ``__get__`` method.
For example: ``__dbus_signal_my_name``
:param owner: the owning class
:param name: the descriptor name
Nz__{}_{})r �format�type�__name__�lower)r �ownerr r r r �__set_name__� s
�zdbus_signal.__set_name__c C s<