%PDF- %PDF-
| Direktori : /lib/python3.9/site-packages/dasbus/server/__pycache__/ |
| Current File : //lib/python3.9/site-packages/dasbus/server/__pycache__/interface.cpython-39.opt-1.pyc |
a
F
�`�K � @ s� d dl Z d dlZd dl mZ d dlmZ d dlmZ d dlmZ d dl m
Z
mZ d dlm
Z
d dlmZ g d �Zd
ZdZdd
� 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)�XMLGenerator)�
dbus_class�dbus_interface�dbus_signal�get_xml�accepts_additional_arguments�"are_additional_arguments_supportedZ__dbus_xml__Z-__dbus_handler_accepts_additional_arguments__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)�setattr�&ACCEPTS_ADDITIONAL_ARGUMENTS_ATTRIBUTE��method� r �;/usr/lib/python3.9/site-packages/dasbus/server/interface.pyr 5 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 X 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__x 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<