관리-도구
편집 파일: decorators.cpython-36.opt-1.pyc
3 �f�Vg; � @ sd d Z d ZdZddlZddlmZmZmZ ddlm Z ddl mZ dd lm Z ddd�Zddd�ZdS )zService-side D-Bus decorators.�method�signalZrestructuredtext� N)�validate_interface_name� Signature�validate_member_name)� SignalMessage)� DBusException)�is_py2Fc s. t �� � ��������� � �fdd�}|S )a� Factory for decorators used to mark methods of a `dbus.service.Object` to be exported on the D-Bus. The decorated method will be exported over D-Bus as the method of the same name on the given D-Bus interface. :Parameters: `dbus_interface` : str Name of a D-Bus interface `in_signature` : str or None If not None, the signature of the method parameters in the usual D-Bus notation `out_signature` : str or None If not None, the signature of the return value in the usual D-Bus notation `async_callbacks` : tuple containing (str,str), or None If None (default) the decorated method is expected to return values matching the `out_signature` as usual, or raise an exception on error. If not None, the following applies: `async_callbacks` contains the names of two keyword arguments to the decorated function, which will be used to provide a success callback and an error callback (in that order). When the decorated method is called via the D-Bus, its normal return value will be ignored; instead, a pair of callbacks are passed as keyword arguments, and the decorated method is expected to arrange for one of them to be called. On success the success callback must be called, passing the results of this method as positional parameters in the format given by the `out_signature`. On error the decorated method may either raise an exception before it returns, or arrange for the error callback to be called with an Exception instance as parameter. `sender_keyword` : str or None If not None, contains the name of a keyword argument to the decorated function, conventionally ``'sender'``. When the method is called, the sender's unique name will be passed as this keyword argument. `path_keyword` : str or None If not None (the default), the decorated method will receive the destination object path as a keyword argument with this name. Normally you already know the object path, but in the case of "fallback paths" you'll usually want to use the object path in the method's implementation. For fallback objects, `rel_path_keyword` (new in 0.82.2) is likely to be more useful. :Since: 0.80.0? `rel_path_keyword` : str or None If not None (the default), the decorated method will receive the destination object path, relative to the path at which the object was exported, as a keyword argument with this name. For non-fallback objects the relative path will always be '/'. :Since: 0.82.2 `destination_keyword` : str or None If not None (the default), the decorated method will receive the destination bus name as a keyword argument with this name. Included for completeness - you shouldn't need this. :Since: 0.80.0? `message_keyword` : str or None If not None (the default), the decorated method will receive the `dbus.lowlevel.MethodCallMessage` as a keyword argument with this name. :Since: 0.80.0? `connection_keyword` : str or None If not None (the default), the decorated method will receive the `dbus.connection.Connection` as a keyword argument with this name. This is generally only useful for objects that are available on more than one connection. :Since: 0.82.0 `utf8_strings` : bool If False (default), D-Bus strings are passed to the decorated method as objects of class dbus.String, a unicode subclass. If True, D-Bus strings are passed to the decorated method as objects of class dbus.UTF8String, a str subclass guaranteed to be encoded in UTF-8. This option does not affect object-paths and signatures, which are always 8-bit strings (str subclass) encoded in ASCII. :Since: 0.80.0 `byte_arrays` : bool If False (default), a byte array will be passed to the decorated method as an `Array` (a list subclass) of `Byte` objects. If True, a byte array will be passed to the decorated method as a `ByteArray`, a str subclass. This is usually what you want, but is switched off by default to keep dbus-python's API consistent. :Since: 0.80.0 c s� t td�rLg }xJtj| �jj� D ]&}|jtjjtjjfkr |j |j � q W ntj| �d }|jd� � r�t � �tkr|td��t� �dkr�td��|j� d � |j� d � �r�|j�� � r�|j� � � r�|j� � �r�|j�� �r�|j�� ��r|j�� ��rJtt���}t|�t|�k�r0td��nt|�t|�k �rJtd��d| _� | _�| _�| _�| _�| _� | _� | _�| _�| _�| _|| _t �d �| _!t"�r��j#d d�| j!d <