%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/dbus/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/dbus/__pycache__/decorators.cpython-312.pyc

�

@iaM<��p�dZdZdZddlZddlmZmZmZddlm	Z	ddl
mZddlm
Z
						dd	�Z		dd
�Zy)
zService-side D-Bus decorators.)�method�signal�restructuredtext�N)�validate_interface_name�	Signature�validate_member_name)�
SignalMessage)�
DBusException)�is_py2c�T����������	�
��t����	���������
�fd�}|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����ttd�r�g}tj|�jj	�D]^}|j
tjjtjjfvs�D|j|j��`ntj|�d}|jd��r^t��tk7rtd��t!��dk7rt#d��|j%�d�|j%�d��r|j%���r|j%���
r|j%�
��r|j%���r|j%���r|j%���	rXtt'�	��}t!|�t!|�kDrt#d��t!|�t!|�krt#d��d|_�|_�|_�	|_�|_�|_�
|_�|_�|_�|_�|_||_tA��	�|_!d
�
vrtd��|S)Nrrz\async_callbacks must be a tuple of (keyword for return callback, keyword for error callback)��z<input signature is longer than the number of arguments takenz=input signature is shorter than the number of arguments takenT)�byte_arrays�utf8_stringsz*unexpected keyword argument 'utf8_strings')"�hasattr�inspect�	signature�
parameters�values�kind�	Parameter�POSITIONAL_ONLY�POSITIONAL_OR_KEYWORD�append�name�
getargspec�pop�type�tuple�	TypeError�len�
ValueError�remover�_dbus_is_method�_dbus_async_callbacks�_dbus_interface�_dbus_in_signature�_dbus_out_signature�_dbus_sender_keyword�_dbus_path_keyword�_dbus_rel_path_keyword�_dbus_destination_keyword�_dbus_message_keyword�_dbus_connection_keyword�
_dbus_args�dict�_dbus_get_args_options)�func�args�arg�in_sig�async_callbacksr�connection_keyword�dbus_interface�destination_keyword�in_signature�kwargs�message_keyword�
out_signature�path_keyword�rel_path_keyword�sender_keywords    �������������1/usr/lib/python3/dist-packages/dbus/decorators.py�	decoratorzmethod.<locals>.decorator�s&����7�K�(��D��(�(��.�9�9�@�@�B�
*���8�8�� 1� 1� A� A��)�)�?�?� A�A��K�K����)�
*�
�%�%�d�+�A�.�D��������O�$��-�� ~����?�#�q�(� �!�A�A��K�K���*�+��K�K���*�+���K�K��'���K�K�(�)���K�K��%���K�K�+�,���K�K��(���K�K�*�+���9�\�2�3�F��6�{�S��Y�&� �!_�`�`��V��s�4�y�(� �!`�a�a�#���%4��"�-���".���#0�� �$2��!�".���&6��#�)<��&�%4��"�(:��%����&*�{�&C��#��V�#��H�I�I���)r)
r9r;r>r7rAr?r:r=r8rr@r<rCs
```````````` rBrr)s"����h�N�+�9�9�v�rDc������t����+ddlm}|td�td����t	d������fd�}|S)a	Factory for decorators used to mark methods of a `dbus.service.Object`
    to emit signals on the D-Bus.

    Whenever the decorated method is called in Python, after the method
    body is executed, a signal with the same name as the decorated method,
    with the given D-Bus interface, will be emitted from this object.

    :Parameters:
        `dbus_interface` : str
            The D-Bus interface whose signal is emitted
        `signature` : str
            The signature of the signal in the usual D-Bus notation

        `path_keyword` : str or None
            A keyword argument to the decorated method. If not None,
            that argument will not be emitted as an argument of
            the signal, and when the signal is emitted, it will appear
            to come from the object path given by the keyword argument.

            Note that when calling the decorated method, you must always
            pass in the object path as a keyword argument, not as a
            positional argument.

            This keyword argument cannot be used on objects where
            the class attribute ``SUPPORTS_MULTIPLE_OBJECT_PATHS`` is true.

            :Deprecated: since 0.82.0. Use `rel_path_keyword` instead.

        `rel_path_keyword` : str or None
            A keyword argument to the decorated method. If not None,
            that argument will not be emitted as an argument of
            the signal.

            When the signal is emitted, if the named keyword argument is given,
            the signal will appear to come from the object path obtained by
            appending the keyword argument to the object's object path.
            This is useful to implement "fallback objects" (objects which
            own an entire subtree of the object-path tree).

            If the object is available at more than one object-path on the
            same or different connections, the signal will be emitted at
            an appropriate object-path on each connection - for instance,
            if the object is exported at /abc on connection 1 and at
            /def and /x/y/z on connection 2, and the keyword argument is
            /foo, then signals will be emitted from /abc/foo and /def/foo
            on connection 1, and /x/y/z/foo on connection 2.

            :Since: 0.82.0
    r)�warnz�dbus.service.signal::path_keyword has been deprecated since dbus-python 0.82.0, and will not work on objects that support multiple object pathsr)�
stacklevelzJdbus.service.signal::path_keyword and rel_path_keyword cannot both be usedc������j�t�������	�
fd�}ttd�r�g}tj��j
j
�D]^}|jtjjtjjfvs�D|j|j��`ntj��d}|jd��	�fD]}|��	|j|���
rXt#t%�
��}t'|�t'|�kDrt!d��t'|�t'|�krt!d���j|_�j(|_d|_�|_�
|_||_|S#t $rt!d|z��wxYw)Nc����d}��m|jrtd��|j�d�}||jk7r5|jj	|dz�std||j��d}��|j�d�}�	|g|��i|��|jD]N}|�|�|dvr|d}n|d|z}n|}t|��
�}|j|d�
i�|dj|��Py)Nz[path_keyword cannot be used on the signals of an object that supports multiple object paths�/zPath %r is not below %r)rJ�rrr)
�SUPPORTS_MULTIPLE_OBJECT_PATHSr!r�__dbus_object_path__�
startswithr#�	locationsr	r�send_message)�selfr4�keywords�abs_path�rel_path�location�object_path�messager9r3�member_namer?r@rs        ������rB�emit_signalz.signal.<locals>.decorator.<locals>.emit_signal!s,����H��'��6�6�#�%<�=�=�$�<�<��d�;���� 9� 9�9��1�1�<�<�X��^�L�$�%>��%)�%>�%>�@�@��H��+�#�<�<�(8�$�?����)��)��)� �N�N�
2���#��'�8�y�+@�&.�q�k��'/�q�k�H�&<��"*�K�'��7E�7B�D������T�:��:����(�(��1�!
2rDrrzfunction has no argument "%s"z@signal signature is longer than the number of arguments providedzAsignal signature is shorter than the number of arguments providedT)�__name__rrrrrrrrrrrrrrr$r#r rr"�__doc__�_dbus_is_signalr'�_dbus_signaturer0)r3rYr4r5�keyword�sigrXr9r?r@rs`     @����rBrCzsignal.<locals>.decorators�����m�m���[�)�#	2�#	2�L�7�K�(��D��(�(��.�9�9�@�@�B�
*���8�8�� 1� 1� A� A��)�)�?�?� A�A��K�K����)�
*�
�%�%�d�+�A�.�D������'��5�	P�G��"�P��K�K��(�	P���	�)�,�-�C��3�x�#�d�)�#� �!c�d�d��S��C��I�%� �!d�e�e�#�}�}���"�l�l���&*��#�&4��#�&/��#�!%������#"�P�$�%D�w�%N�O�O�P�s�:F'�'F?)r�warningsrF�DeprecationWarningr!)r9rr?r@rFrCs````  rBrr�s_���f�N�+���!��
�!8�9� �A�		/�
�'��C�D�
D�K�Z�rD)
NNNNNNNNFN)NNN)r[�__all__�
__docformat__r�dbusrrr�
dbus.lowlevelr	�dbus.exceptionsr
�dbus._compatrrr�rDrB�<module>risP��$�:��"�
��I�I�'�)��=A��GK�48�� �q�h9=� �MrD

Zerion Mini Shell 1.0