
    k7i%                        S SK r S SKJr  S SKJr  SSK7  / SQr\ R                  " S5      rS r	\ R                  " S	5      r
S
 r\ R                  " S5      rS r " S S5      r " S S\5      rS rS"S jrS"S jrS"S jrS"S jr " S S5      r " S S5      r " S S5      r " S S\5      r " S S\5      rS \4S! jrg)#    N)Union)warn   )*)	DBusAddressnew_method_callnew_method_return	new_error
new_signalMessageGenerator
PropertiesIntrospectableDBusErrorResponsezZ([A-Za-z_-][A-Za-z0-9_-]*(\.[A-Za-z_-][A-Za-z0-9_-]*)+|:[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+))$c                     [        U 5      S:  a  U S S S-   n[        SU< S35      e[        R                  U 5      (       d  [        SU < S35      eg )N      ...z
Bus name ( ) is too long (> 255 characters)) is not valid)len
ValueErrorbus_name_patmatchnameabbrs     J/home/james-whalen/.local/lib/python3.13/site-packages/jeepney/wrappers.pycheck_bus_namer      s\    
4y3BQx%:dX-MNOOd##:dX^<== $    z2[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)+$c                     [        U 5      S:  a  U S S S-   n[        SU< S35      e[        R                  U 5      (       d  [        SU < S35      eg )Nr   r   r   zInterface name (r   r   )r   r   interface_patr   r   s     r   check_interfacer"   !   s^    
4y3BQx%+D83STUUt$$+D8>BCC %r   z[A-Za-z_][A-Za-z0-9_]*$c                     [        U 5      S:  a  U S S S-   n[        SU< S35      e[        R                  U 5      (       d  [        SU < S35      eg )Nr   r   r   zMember name (r   z is not valid)r   r   member_name_patr   r   s     r   check_member_namer%   *   s\    
4y3BQx%=0PQRR  &&=>?? 'r   c                   .    \ rS rSrSrSS jrS rS rSrg)	r   2   a-  This identifies the object and interface a message is for.

e.g. messages to display desktop notifications would have this address::

    DBusAddress('/org/freedesktop/Notifications',
                bus_name='org.freedesktop.Notifications',
                interface='org.freedesktop.Notifications')
Nc                     [        5       R                  U5        Xl        Ub  [        U5        X l        Ub  [        U5        X0l        g N)ObjectPathType
check_dataobject_pathr   bus_namer"   	interface)selfr,   r-   r.   s       r   __init__DBusAddress.__init__;   s?    ##K0&8$  I&"r   c                     SR                  [        U 5      R                  U R                  U R                  U R
                  5      $ )Nz'{}({!r}, bus_name={!r}, interface={!r}))formattype__name__r,   r-   r.   r/   s    r   __repr__DBusAddress.__repr__G   s8    8??T
@S@S$$dmmT^^E 	Er   c                 f    [        U5        [        U 5      " U R                  U R                  U5      $ r)   )r"   r4   r,   r-   )r/   r.   s     r   with_interfaceDBusAddress.with_interfaceK   s'    	"Dz$**DMM9EEr   )r-   r.   r,   NN)	r5   
__module____qualname____firstlineno____doc__r0   r7   r:   __static_attributes__ r   r   r   r   2   s    
#EFr   r   c                   ,   ^  \ rS rSrSU 4S jjrSrU =r$ )
DBusObjectO   c                 :   > [         TU ]  XU5        [        SSS9  g )Nz)Deprecated alias, use DBusAddress instead   )
stacklevel)superr0   r   )r/   r,   r-   r.   	__class__s       r   r0   DBusObject.__init__P   s    	:8QGr   rB   r<   )r5   r=   r>   r?   r0   rA   __classcell__)rJ   s   @r   rD   rD   O   s    H Hr   rD   c           
      <    [        [        R                  U SSSS0 S9$ )Nr   r   )flagsprotocol_versionbody_lengthserialfields)Header
Endiannesslittle)msg_types    r   
new_headerrX   T   s$    *##XQ B8 8r   c                 
   [        U5        [        [        R                  5      nU R                  UR
                  [        R                  '   U R                  c  [        S5      eU R                  UR
                  [        R                  '   U R                  b'  U R                  UR
                  [        R                  '   XR
                  [        R                  '   Ub  X$R
                  [        R                  '   [        XC5      $ )a  Construct a new method call message

This is a relatively low-level method. In many cases, this will be called
from a :class:`MessageGenerator` subclass which provides a more convenient
API.

:param DBusAddress remote_obj: The object to call a method on
:param str method: The name of the method to call
:param str signature: The DBus signature of the body data
:param tuple body: Body data (i.e. method parameters)
z3remote_obj.bus_name cannot be None for method calls)r%   rX   MessageTypemethod_callr,   rS   HeaderFieldspathr-   r   destinationr.   member	signatureMessage)
remote_objmethodr`   bodyheaders        r   r   r   X   s     f//0F'1'='=FMM,##$"NOO.8.A.AFMM,**+'0:0D0Dl,,-)/MM,%%&09l,,-6  r   c                    [        [        R                  5      nU R                  R                  UR
                  [        R                  '   U R                  R
                  R                  [        R                  S5      nUb  XCR
                  [        R                  '   Ub  XR
                  [        R                  '   [        X25      $ )zConstruct a new response message

:param Message parent_msg: The method call this is a reply to
:param str signature: The DBus signature of the body data
:param tuple body: Body data
N)rX   rZ   method_returnre   rR   rS   r\   reply_serialgetsenderr^   r`   ra   )
parent_msgr`   rd   re   rj   s        r   r	   r	   r   s     112F/9/@/@/G/GFMM,++,%%)),*=*=tDF28l../09l,,-6  r   c                    [        [        R                  5      nU R                  R                  UR
                  [        R                  '   XR
                  [        R                  '   U R                  R
                  R                  [        R                  S5      nUb  XTR
                  [        R                  '   Ub  X$R
                  [        R                  '   [        XC5      $ )zConstruct a new error response message

:param Message parent_msg: The method call this is a reply to
:param str error_name: The name of the error
:param str signature: The DBus signature of the body data
:param tuple body: Body data
N)rX   rZ   errorre   rR   rS   r\   rh   
error_nameri   rj   r^   r`   ra   )rk   rn   r`   rd   re   rj   s         r   r
   r
      s     ))*F/9/@/@/G/GFMM,++,-7MM,))*%%)),*=*=tDF28l../09l,,-6  r   c                    [        U5        [        [        R                  5      nU R                  UR
                  [        R                  '   U R                  c  [        S5      eU R                  UR
                  [        R                  '   XR
                  [        R                  '   Ub  X$R
                  [        R                  '   [        XC5      $ )zConstruct a new signal message

:param DBusAddress emitter: The object sending the signal
:param str signal: The name of the signal
:param str signature: The DBus signature of the body data
:param tuple body: Body data
z,emitter.interface cannot be None for signals)r%   rX   rZ   signalr,   rS   r\   r]   r.   r   r_   r`   ra   )emitterrp   r`   rd   re   s        r   r   r      s     f**+F'.':':FMM,##$ GHH,3,=,=FMM,(())/MM,%%&09l,,-6  r   c                   :    \ rS rSr% SrSr\\   \S'   S r	S r
Srg)r      zSubclass this to define the methods available on a DBus interface.

jeepney.bindgen can automatically create subclasses using introspection.
Nr.   c                     [        5       R                  U5        [        U5        U R                  b  [	        U R                  5        Xl        X l        g r)   )r*   r+   r   r.   r"   r,   r-   )r/   r,   r-   s      r   r0   MessageGenerator.__init__   s<    ##K0x >>%DNN+& r   c                 v    SR                  [        U 5      R                  U R                  U R                  5      $ )Nz{}({!r}, bus_name={!r}))r3   r4   r5   r,   r-   r6   s    r   r7   MessageGenerator.__repr__   s2    (//T
0C0C040@0@$--Q 	Qr   )r-   r,   )r5   r=   r>   r?   r@   r.   Optionalstr__annotations__r0   r7   rA   rB   r   r   r   r      s"      $Ix}#!Qr   r   c                   *    \ rS rSrSrS rS rS rSrg)	ProxyBase   zA proxy is an IO-aware wrapper around a MessageGenerator

Calling methods on a proxy object will send a message and wait for the
reply. This is a base class for proxy implementations in jeepney.io.
c                     Xl         g r)   _msggen)r/   msggens     r   r0   ProxyBase.__init__   s    r   c                     UR                  S5      (       a  [        U5      e[        U R                  US 5      n[	        U5      (       a  U R                  U5      $ [        U5      e)N__)
startswithAttributeErrorgetattrr   callable_method_call)r/   itemmake_msgs      r   __getattr__ProxyBase.__getattr__   sU    ??4   &&4<<t4H$$X..T""r   c                     [        S5      e)Nz#Needs to be implemented in subclass)NotImplementedError)r/   r   s     r   r   ProxyBase._method_call   s    !"GHHr   r   N)	r5   r=   r>   r?   r@   r0   r   r   rA   rB   r   r   r|   r|      s    
#Ir   r|   c                   B    \ rS rSrSrS\\\4   4S jrS r	S r
S rSrg	)
r      zBuild messages for accessing object properties

If a D-Bus object has multiple interfaces, each interface has its own
set of properties.

This uses the standard DBus interface ``org.freedesktop.DBus.Properties``
objc                 X    Xl         [        UR                  UR                  SS9U l        g )Nzorg.freedesktop.DBus.Properties)r-   r.   )r   r   r,   r-   props_if)r/   r   s     r   r0   Properties.__init__   s#    #COOcll.OQr   c                 ^    [        U R                  SSU R                  R                  U45      $ )z$Get the value of the property *name*Getssr   r   r   r.   )r/   r   s     r   ri   Properties.get   s+    t}}eTHH&&-/ 	/r   c                 \    [        U R                  SSU R                  R                  45      $ )z*Get all property values for this interfaceGetAllsr   r6   s    r   get_allProperties.get_all   s)    t}}h $ 2 246 	6r   c           	      b    [        U R                  SSU R                  R                  XU445      $ )z?Set the property *name* to *value* (with appropriate signature)Setssvr   )r/   r   r`   values       r   setProperties.set   s2    t}}eUHH&&%.@AC 	Cr   )r   r   N)r5   r=   r>   r?   r@   r   r   r   r0   ri   r   r   rA   rB   r   r   r   r      s0    QE+/?"?@ Q
/
6
Cr   r   c                       \ rS rSrSrS rSrg)r      z#org.freedesktop.DBus.Introspectablec                     [        U S5      $ )z3Request D-Bus introspection XML for a remote object
Introspect)r   r6   s    r   r   Introspectable.Introspect   s    t\22r   rB   N)r5   r=   r>   r?   r.   r   rA   rB   r   r   r   r      s    5I3r   r   c                   $    \ rS rSrSrS rS rSrg)r      z?Raised by proxy method calls when the reply is an error messagec                     UR                   R                  R                  [        R                  5      U l        UR                  U l        g r)   )re   rS   ri   r\   rn   r   rd   data)r/   msgs     r   r0   DBusErrorResponse.__init__   s/    JJ%%)),*A*AB	HH	r   c                 N    SR                  U R                  U R                  5      $ )Nz[{}] {})r3   r   r   r6   s    r   __str__DBusErrorResponse.__str__   s    		49955r   )r   r   N)r5   r=   r>   r?   r@   r0   r   rA   rB   r   r   r   r      s    I6r   r   r   c                     U R                   R                  [        R                  :X  a  [	        U 5      eU R
                  $ )zGet the body of a message, raising DBusErrorResponse for error messages

This is to be used with replies to method_call messages, which may be
method_return or error.
)re   message_typerZ   rm   r   rd   )r   s    r   
unwrap_msgr      s0     zz+"3"33$$88Or   )NrB   )retypingr   warningsr   	low_level__all__compiler   r   r!   r"   r$   r%   r   rD   rX   r   r	   r
   r   r   r|   r   r   	Exceptionr   ra   r   rB   r   r   <module>r      s    	   
 zz,
> 

PQD **78@F F:H H
8!4! !$!(Q Q*I I,C C83% 36	 6	G 	r   