Şuanki Dizin: /usr/lib64/python3.9/site-packages/dbus/__pycache__/ |
Şuanki Dosya : //usr/lib64/python3.9/site-packages/dbus/__pycache__/service.cpython-39.pyc |
a 7�^��@s^dZdZddlZddlZddlZddlZzddlmZWneyVddl mZYn0ddl Z ddlmZm Z mZmZmZmZmZddlmZmZddlmZmZmZddlmZmZmZdd lmZdd l m!Z!e�"d�Z#Gdd �d e$�Z%Gdd�de$�Z&dd�Z'dd�Z(dd�Z)Gdd�de*�Z+e+de$fi�Z,e$�Z-Gdd�de,�Z.Gdd�de.�Z/dS))�BusName�Object�FallbackObject�method�signalZrestructuredtext�N)�Sequence)�INTROSPECTABLE_IFACE� ObjectPath� SessionBus� Signature�Struct�validate_bus_name�validate_object_path)rr)� DBusException�NameExistsException�UnknownMethodException)�ErrorMessage�MethodReturnMessage�MethodCallMessage)� LOCAL_PATH)�is_py2zdbus.servicec@s(eZdZdZdd�Zdd�Zer$eZdS)�_VariantSignaturez�A fake method signature which, when iterated, yields an endless stream of 'v' characters representing variants (handy with zip()). It has no string representation. cCs|S)zReturn self.���selfrr�2/usr/lib64/python3.9/site-packages/dbus/service.py�__iter__>sz_VariantSignature.__iter__cCsdS)zReturn 'v' whenever called.�vrrrrr�__next__Bsz_VariantSignature.__next__N)�__name__� __module__�__qualname__�__doc__rrr�nextrrrrr8s rc@sFeZdZdZddd�Zdd�Zdd �Zd d�Zdd �Zdd�Z e Z dS)raaA base class for exporting your own Named Services across the Bus. When instantiated, objects of this class attempt to claim the given well-known name on the given bus for the current process. The name is released when the BusName object becomes unreferenced. If a well-known name is requested multiple times, multiple references to the same BusName object will be returned. :Caveats: - Assumes that named services are only ever requested using this class - if you request names from the bus directly, confusion may occur. - Does not handle queueing. NFc Cs�t|ddd�|dur4ddl}|jdtdd�t�}||jvrH|j|S|rRtjpTd|r^tjp`dB|rltj pndB}|� ||�}|tjkr�n<|tjkr�n0|tj kr�t|��n|tjkr�ntd ||f��t�|�} || _|| _| |j|<| S) aSConstructor, which may either return an existing cached object or a new object. :Parameters: `name` : str The well-known name to be advertised `bus` : dbus.Bus A Bus on which this service will be advertised. Omitting this parameter or setting it to None has been deprecated since version 0.82.1. For backwards compatibility, if this is done, the global shared connection to the session bus will be used. `allow_replacement` : bool If True, other processes trying to claim the same well-known name will take precedence over this one. `replace_existing` : bool If True, this process can take over the well-known name from other processes already holding it. `do_not_queue` : bool If True, this service will not be placed in the queue of services waiting for the requested name if another service already holds it. TF)Zallow_well_knownZallow_uniqueNrzKOmitting the "bus" parameter to dbus.service.BusName.__init__ is deprecated�)� stacklevelz3requesting bus name %s returned unexpected value %s)r �warnings�warn�DeprecationWarningr Z _bus_names�_dbus_bindingsZNAME_FLAG_ALLOW_REPLACEMENTZNAME_FLAG_REPLACE_EXISTINGZNAME_FLAG_DO_NOT_QUEUEZrequest_nameZ REQUEST_NAME_REPLY_PRIMARY_OWNERZREQUEST_NAME_REPLY_IN_QUEUEZREQUEST_NAME_REPLY_EXISTSrZ REQUEST_NAME_REPLY_ALREADY_OWNER�RuntimeError�object�__new__�_bus�_name) �cls�nameZbusZallow_replacementZreplace_existingZdo_not_queuer&Z name_flags�retval�bus_namerrrr,Zs<� ��� zBusName.__new__cOsdS�Nr)r�args�keywordsrrr�__init__�szBusName.__init__cCs|j�|j�dSr3)r-Zrelease_namer.rrrr�__del__�szBusName.__del__cCs|jS)zGet the Bus this Service is on)r-rrrr�get_bus�szBusName.get_buscCs|jS)zGet the name of this service)r.rrrr�get_name�szBusName.get_namecCsd|j|jt|�fS)Nz&<dbus.service.BusName %s on %r at %#x>)r.r-�idrrrr�__repr__�szBusName.__repr__)NFFF)rr r!r"r,r6r7r8r9r;�__str__rrrrrJs OrcCsZd}d}d}|r�|jjD]�}|sx||jvrxd|j|jvrtd|j|jvrt|j|j|krx|}|j|}d}q�qxn|}|r||jvrd|j|jvrd|j|jvr|j|j|kr|j|}d}q�qnR|jjD]H}|s�||jvr�|}|r�||jvr�d|j|jvr�|j|}d}�qq�|�r2|j||fS|�rJtd||f��ntd|��dS)z�Walks the Python MRO of the given class to find the method to invoke. Returns two methods, the one to call, and the one it inherits from which defines its D-Bus interface name, signature, and attributes. NF�_dbus_is_method�_dbus_interfaceTz(%s is not a valid method of interface %sz%s is not a valid method)� __class__�__mro__�__dict__r>r)r�method_nameZdbus_interface� parent_methodZcandidate_classZ successfulr/rrr�_method_lookup�sP� ��� � rDc Gs�t|�}z|j|d|i�Wn�ty�}z~t��|dur�z|�|�d}Wn8ty�}z t�d||j|��WYd}~n d}~00t�d|||j|��WYd}~n d}~00|� �s�|� |�dS)N� signaturez (guessed)z2Unable to guess signature for arguments %r: %s: %sz8Unable to append %r to message with signature %s: %s: %s)r�append� Exception�loggingZbasicConfigZguess_signature�_logger�errorr?�get_no_reply�send_message)� connection�messagerBrEr1�reply�errr�_method_reply_returns&� �rQc Cs�t|dd�}|durn0t|dd�dvr4d|jj}nd|j|jjf}t��\}}}t|t�rn|jsn|� �}n2||ur�d� t�|||��}nd� t� |j|��}t|||�}|��s�|�|�dS)NZ_dbus_error_namer �)rR�__main__zorg.freedesktop.DBus.Python.%sz!org.freedesktop.DBus.Python.%s.%s)�getattrr?rr �sys�exc_info� isinstancerZinclude_tracebackZget_dbus_message�join� traceback�format_exception�format_exception_onlyrrKrL) rMrN� exceptionr0�etZevZetb�contentsrOrrr�_method_reply_errors" �r_cs,eZdZ�fdd�Zdd�Zdd�Z�ZS)� InterfaceTypecs�t|di�}||_i}||jd|<|D]L}|jd|j}t|dd�r,||��D]\}} |�|i�} | �| �qXq,|��D](}t|dd�r�|�|ji�} || |j<q�t t |��|||�dS)N�_dbus_class_table�.Fr>)rTrar r�items� setdefault�update�valuesr>�superr`r6)r/r0�basesZdctZclass_tableZinterface_table�b� base_nameZ interfaceZmethod_tableZour_method_table�func�r?rrr64szInterfaceType.__init__cCs�|j}|jrtt|j��}nt�}|jr4t|j�}ng}d|j}t||�D]}|d|7}qL|D]}|d|7}qb|d7}|S)Nz <method name="%s"> z2 <arg direction="in" type="%s" name="%s" /> z( <arg direction="out" type="%s" /> z </method> )� _dbus_argsZ_dbus_in_signature�tuplerr�_dbus_out_signaturer�zip)r/rkr4Zin_sigZout_sig�reflection_data�pair�typerrr�_reflect_on_methodNs z InterfaceType._reflect_on_methodcCsT|j}|jrtt|j��}nt�}d|j}t||�D]}|d|}q6|d}|S)Nz <signal name="%s"> z" <arg type="%s" name="%s" /> z </signal> )rmZ_dbus_signaturernrrrrp)r/rkr4Zsigrqrrrrr�_reflect_on_signalks z InterfaceType._reflect_on_signal)rr r!r6rtru� __classcell__rrrlrr`3sr`� Interfacec@s�eZdZdZdZdZddd�Zedd��Zedd ��Z ed d��Z dd �Zddd�Zdd�Z dd�Zeeddddd�dd��Zdd�ZeZdS)ra�A base class for exporting your own Objects across the Bus. Just inherit from Object and mark exported methods with the @\ `dbus.service.method` or @\ `dbus.service.signal` decorator. Example:: class Example(dbus.service.object): def __init__(self, object_path): dbus.service.Object.__init__(self, dbus.SessionBus(), path) self._last_input = None @dbus.service.method(interface='com.example.Sample', in_signature='v', out_signature='s') def StringifyVariant(self, var): self.LastInputChanged(var) # emits the signal return str(var) @dbus.service.signal(interface='com.example.Sample', signature='v') def LastInputChanged(self, var): # run just before the signal is actually emitted # just put "pass" if nothing should happen self._last_input = var @dbus.service.method(interface='com.example.Sample', in_signature='', out_signature='v') def GetLastInput(self): return self._last_input FNcCs�|durt|�t|t�r(|}|��}n|dur@|dur@|��}d|_d|_g|_t��|_ d|_ ||_|dur�|dur�td��|dur�|dur�|� ||�dS)aConstructor. Either conn or bus_name is required; object_path is also required. :Parameters: `conn` : dbus.connection.Connection or None The connection on which to export this object. If None, use the Bus associated with the given ``bus_name``. If there is no ``bus_name`` either, the object is not initially available on any Connection. For backwards compatibility, if an instance of dbus.service.BusName is passed as the first parameter, this is equivalent to passing its associated Bus as ``conn``, and passing the BusName itself as ``bus_name``. `object_path` : str or None A D-Bus object path at which to make this Object available immediately. If this is not None, a `conn` or `bus_name` must also be provided. `bus_name` : dbus.service.BusName or None Represents a well-known name claimed by this process. A reference to the BusName object will be held by this Object, preventing the name from being released during this Object's lifetime (unless it's released manually). NFz<If object_path is given, either conn or bus_name is required)rrWrr8�_object_path�_connection� _locations� threading�Lock�_locations_lock� _fallbackr.� TypeError�add_to_connection)r�conn�object_pathr2rrrr6�s$ zObject.__init__cCs:|jturtd|��n|jdur0td|��n|jSdS)z�The object-path at which this object is available. Access raises AttributeError if there is no object path, or more than one object path. Changed in 0.82.0: AttributeError can be raised. zEObject %r has more than one object path: use Object.locations insteadNz Object %r has no object path yet)rx�_MANY�AttributeErrorrrrr�__dbus_object_path__�s � zObject.__dbus_object_path__cCs:|jturtd|��n|jdur0td|��n|jSdS)z�The Connection on which this object is available. Access raises AttributeError if there is no Connection, or more than one Connection. Changed in 0.82.0: AttributeError can be raised. zFObject %r is on more than one Connection: use Object.locations insteadNzObject %r has no Connection yet)ryr�r�rrrrrM�s � zObject.connectioncCs t|j�S)aeAn iterable over tuples representing locations at which this object is available. Each tuple has at least two items, but may have more in future versions of dbus-python, so do not rely on their exact length. The first two items are the dbus.connection.Connection and the object path. :Since: 0.82.0 )�iterrzrrrr� locationsszObject.locationscCs|tkrtdt��|j��z�|jdurL|j|urL|jsLtd||jf��|jdurx|jsx|j|krxtd||jf��|�||j |j |j�|jdur�||_n|j|ur�t|_|jdur�||_n|j|kr�t|_|j �|||jf�W|j��n|j��0dS)aNMake this object accessible via the given D-Bus connection and object path. :Parameters: `connection` : dbus.connection.Connection Export the object on this connection. If the class attribute SUPPORTS_MULTIPLE_CONNECTIONS is False (default), this object can only be made available on one connection; if the class attribute is set True by a subclass, the object can be made available on more than one connection. `path` : dbus.ObjectPath or other str Place the object at this object path. If the class attribute SUPPORTS_MULTIPLE_OBJECT_PATHS is False (default), this object can only be made available at one object path; if the class attribute is set True by a subclass, the object can be made available with more than one object path. :Raises ValueError: if the object's class attributes do not allow the object to be exported in the desired way. :Since: 0.82.0 z3Objects may not be exported on the reserved path %sNz'%r is already exported on connection %rz(%r is already exported at object path %s)r� ValueErrorr}�acquirery�SUPPORTS_MULTIPLE_CONNECTIONSrx�SUPPORTS_MULTIPLE_OBJECT_PATHSZ_register_object_path�_message_cb�_unregister_cbr~r�rzrF�release)rrM�pathrrrr�sH� ��� ��� � zObject.add_to_connectionc Cs"|j���z|jdus"|jdur.td|��|dus>|dur�g}|jD]6}|dus`|d|urH|dust|d|krH|�|�qHn|j}g|_|s�td|||f��|D]Z}z|d�|d�Wnty�Yn0|jr�z|j�|�Wq�t �yYq�0q�W|j� �n|j� �0dS)aMake this object inaccessible via the given D-Bus connection and object path. If no connection or path is specified, the object ceases to be accessible via any connection or path. :Parameters: `connection` : dbus.connection.Connection or None Only remove the object from this Connection. If None, remove from all Connections on which it's exported. `path` : dbus.ObjectPath or other str, or None Only remove the object from this object path. If None, remove from all object paths. :Raises LookupError: if the object was not exported on the requested connection or path, or (if both are None) was not exported at all. :Since: 0.81.1 Nz%r is not exportedr�z1%r is not exported at a location matching (%r,%r))r}r�rxry�LookupErrorrzrFZ_unregister_object_path�remover�r�)rrMr�Zdropped�locationrrr�remove_from_connectionXs< � �� zObject.remove_from_connectioncCst�d||�dS)Nz5Unregistering exported object %r from some path on %r)rI�info)rrMrrrr��s�zObject._unregister_cbc s�t�t�sdS�zl�������}t|�|�\}}�jfi|j��}i}|jdur^t|j��nd�|j r�|j \}} ����fdd�||<��fdd�|| <|j r����||j <|jr� �||j<|j�rb�� �} | }|jD]r}|d�ur�| |dk�rd}�qP|ddk�rq�| �|dd�r�| t|d�d�} t| �t|�kr�| }q�t|�}|||j<|j�rx���||j<|j�r��||j<|j�r��||j<||g|�Ri|��}|j �r�WdS�du�r4t��}t|�dk�r�|dk�r�d}ntd���n4t|�dk�r|f}nt|t��r"ntd ��f��n0|du�rDd}n t|t��r^t|t��s^n|f}t����g|�R�Wn2t�y�}zt��|�WYd}~n d}~00dS) Ncst����g|�R�Sr3)rQ)r1�rMrNrBrErr�<lambda>��z$Object._message_cb.<locals>.<lambda>cst��|�Sr3)r_)r\)rMrNrrr��r�rr��/rz8%s has an empty output signature but did not return NonezK%s has multiple output values in signature %s but did not return a sequence)rWrZ get_memberZ get_interfacerDZ get_args_listZ_dbus_get_args_optionsrorZ_dbus_async_callbacksZ_dbus_sender_keywordZ get_senderZ_dbus_path_keywordZget_pathZ_dbus_rel_path_keywordrz� startswith�lenr Z_dbus_destination_keywordZget_destinationZ_dbus_message_keywordZ_dbus_connection_keywordrnrrrrQrGr_)rrMrNZinterface_nameZcandidate_methodrCr4r5Zreturn_callbackZerror_callbackr�Zrel_pathZexp�suffixr1Zsignature_tupler\rr�rr��s� �� �zObject._message_cbrR�sr�rM)Zin_signatureZ out_signatureZpath_keywordZconnection_keywordcCs�tj}|d|7}|j|jjd|jj}|��D]d\}}|d|7}|��D]>}t|dd�rr||j� |�7}qPt|dd�rP||j� |�7}qP|d7}q4|�|�D]}|d|7}q�|d 7}|S) ziReturn a string of XML encoding this object's supported interfaces, methods and signals. z<node name="%s"> rbz <interface name="%s"> r=FZ_dbus_is_signalz </interface> z <node name="%s"/> z</node> )r)Z)DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODErar?r rrcrfrTrtruZlist_exported_child_objects)rr�rMrqZ interfacesr0Zfuncsrkrrr� Introspect�s zObject.IntrospectcCs>d}|jtur"|jdur"d|j}d|jj|jj|t|�fS)NrRz at %sz<%s.%s%s at %#x>)rxr�r?r rr:)r�whererrrr;s � �zObject.__repr__)NNN)NN)rr r!r"r�r�r6�propertyr�rMr�r�r�r�r�rrr�r;r<rrrrr�s(# = ; 1n� rcs&eZdZdZdZd�fdd� Z�ZS)rzaAn object that implements an entire subtree of the object-path tree. :Since: 0.82.0 TNcsPtt|���d|_|dur.|durLtd��n|dur@td��n|�||�dS)aHConstructor. Note that the superclass' ``bus_name`` __init__ argument is not supported here. :Parameters: `conn` : dbus.connection.Connection or None The connection on which to export this object. If this is not None, an `object_path` must also be provided. If None, the object is not initially available on any Connection. `object_path` : str or None A D-Bus object path at which to make this Object available immediately. If this is not None, a `conn` must also be provided. This object will implements all object-paths in the subtree starting at this object-path, except where a more specific object has been added. TNz)If object_path is given, conn is requiredz)If conn is given, object_path is required)rgrr6r~rr�)rr�r�rlrrr6+s zFallbackObject.__init__)NN)rr r!r"r�r6rvrrrlrr"sr)0�__all__Z __docformat__rUrHr{rY�collections.abcr�ImportError�collectionsr)Zdbusrr r rrr rZdbus.decoratorsrrZdbus.exceptionsrrrZ dbus.lowlevelrrrZdbus.proxiesrZdbus._compatrZ getLoggerrIr+rrrDrQr_rsr`rwr�rrrrrr�<module>s<$ uBM
Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4