o
    Uh/                      @   s   d Z ddlmZmZmZ ddlmZmZ g dZG dd dZ	G dd deZ
e
 ZG d	d
 d
eZG dd deZG dd dZdS )zcMessages for talking to the DBus daemon itself

Generated by jeepney.bindgen and modified by hand.
   )MessageMessageTypeHeaderFields)MessageGeneratornew_method_call)DBusNameFlagsDBusmessage_bus
MonitoringStats	MatchRulec                   @   s   e Zd ZdZdZdZdS )r   r         N)__name__
__module____qualname__allow_replacementreplace_existingdo_not_queue r   r   h/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/jeepney/bus_messages.pyr      s    r   c                       s   e Zd ZdZdZ		d- fdd	Zdd Zd.d	d
Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Z  ZS )/r   z(Messages to talk to the message bus
    org.freedesktop.DBus/org/freedesktop/DBusc                       t  j||d d S N)object_pathbus_namesuper__init__selfr   r   	__class__r   r   r         zDBus.__init__c                 C   
   t | dS )NHellor   r!   r   r   r   r&         
z
DBus.Hello    c                 C   s   t | dd||fS )NRequestNamesur'   )r!   nameflagsr   r   r   r+   "   s   zDBus.RequestNamec                 C      t | dd|fS )NReleaseNamesr'   r!   r-   r   r   r   r0   %      zDBus.ReleaseNamec                 C      t | dd|dfS )NStartServiceByNamer,   r*   r'   r2   r   r   r   r5   (   s   zDBus.StartServiceByNamec                 C   r/   )NUpdateActivationEnvironmentza{ss}r'   )r!   envr   r   r   r6   ,      z DBus.UpdateActivationEnvironmentc                 C   r/   )NNameHasOwnerr1   r'   r2   r   r   r   r9   0   r3   zDBus.NameHasOwnerc                 C   r%   )N	ListNamesr'   r(   r   r   r   r:   3   r)   zDBus.ListNamesc                 C   r%   )NListActivatableNamesr'   r(   r   r   r   r;   6   r)   zDBus.ListActivatableNamesc                 C   "   t |tr	| }t| dd|fS )z4*rule* can be a str or a :class:`MatchRule` instanceAddMatchr1   
isinstancer   	serialiser   r!   ruler   r   r   r=   9   s   
zDBus.AddMatchc                 C   r<   )NRemoveMatchr1   r>   rA   r   r   r   rC   ?   s   
zDBus.RemoveMatchc                 C   r/   )NGetNameOwnerr1   r'   r2   r   r   r   rD   D   r3   zDBus.GetNameOwnerc                 C   r/   )NListQueuedOwnersr1   r'   r2   r   r   r   rE   G   r3   zDBus.ListQueuedOwnersc                 C   r/   )NGetConnectionUnixUserr1   r'   r2   r   r   r   rF   J   r3   zDBus.GetConnectionUnixUserc                 C   r/   )NGetConnectionUnixProcessIDr1   r'   r2   r   r   r   rG   M   r3   zDBus.GetConnectionUnixProcessIDc                 C   r/   )NGetAdtAuditSessionDatar1   r'   r2   r   r   r   rH   P   r3   zDBus.GetAdtAuditSessionDatac                 C   r/   )N#GetConnectionSELinuxSecurityContextr1   r'   r2   r   r   r   rI   S   r8   z(DBus.GetConnectionSELinuxSecurityContextc                 C   r%   )NReloadConfigr'   r(   r   r   r   rJ   W   r)   zDBus.ReloadConfigc                 C   r%   )NGetIdr'   r(   r   r   r   rK   Z   r)   z
DBus.GetIdc                 C   r/   )NGetConnectionCredentialsr1   r'   r2   r   r   r   rL   ]   r3   zDBus.GetConnectionCredentialsr   r   )r*   )r   r   r   __doc__	interfacer   r&   r+   r0   r5   r6   r9   r:   r;   r=   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   __classcell__r   r   r"   r   r      s2    
r   c                       s.   e Zd ZdZ		d fdd	Zdd Z  ZS )	r
   zorg.freedesktop.DBus.Monitoringr   r   c                    r   r   r   r    r"   r   r   r   e   r$   zMonitoring.__init__c                 C   r4   )z:Convert this connection to a monitor connection (advanced)BecomeMonitorasur*   r'   )r!   rulesr   r   r   rQ   i   s   zMonitoring.BecomeMonitorrM   )r   r   r   rO   r   rQ   rP   r   r   r"   r   r
   b   s    r
   c                       s>   e Zd ZdZ		d fdd	Zdd Zdd	 Zd
d Z  ZS )r   z org.freedesktop.DBus.Debug.Statsr   r   c                    r   r   r   r    r"   r   r   r   p   r$   zStats.__init__c                 C   r%   )NGetStatsr'   r(   r   r   r   rT   t   r)   zStats.GetStatsc                 C   r/   )NGetConnectionStatsr1   r'   )r!   arg0r   r   r   rU   w   r8   zStats.GetConnectionStatsc                 C   r%   )NGetAllMatchRulesr'   r(   r   r   r   rW   {   r)   zStats.GetAllMatchRulesrM   )	r   r   r   rO   r   rT   rU   rW   rP   r   r   r"   r   r   m   s    r   c                	   @   s`   e Zd ZdZdddddddddddZdded	efd
dZdefddZde	de
fddZdS )r   a>  Construct a match rule to subscribe to DBus messages.
    
    e.g.::
    
        mr = MatchRule(
            interface='org.freedesktop.DBus',
            member='NameOwnerChanged',
            type='signal'
        )
        msg = message_bus.AddMatch(mr)
        # Send this message to subscribe to the signal
    NF)typesenderrO   memberpathpath_namespacedestination	eavesdropc          
      C   sR   t |tr	t| }|| _|||||d}	dd |	 D | _|| _|| _i | _d S )N)rY   rO   rZ   r[   r]   c                 S   s   i | ]\}}|d ur||qS )Nr   .0kvr   r   r   
<dictcomp>   s    z&MatchRule.__init__.<locals>.<dictcomp>)	r?   strr   message_typeitemsheader_fieldsr\   r^   arg_conditions)
r!   rX   rY   rO   rZ   r[   r\   r]   r^   fieldsr   r   r   r      s   

zMatchRule.__init__stringargnovaluec                 C   s@   |dvrt d||dkr|dkrt d||f| j|< dS )zAdd a condition for a particular argument
        
        argno: int, 0-63
        kind: 'string', 'path', 'namespace'
        >   r[   rj   	namespacez	kind={!r}rm   r*   z$argno must be 0 for kind='namespace'N)
ValueErrorformatrh   )r!   rk   rl   kindr   r   r   add_arg_condition   s
   zMatchRule.add_arg_conditionreturnc                 C   s   t | j }| jr|d| jjf | jr|d| jf | jr&|d | j D ]\}\}}|dkr7d}|d| | |f q+d	dd	 |D S )
zAConvert to a string to use in an AddMatch call to the message busrX   r\   )r^   truerj    arg,c                 s   s(    | ]\}}d  ||ddV  qdS )z{}='{}''z'\''N)ro   replacer_   r   r   r   	<genexpr>   s    
z&MatchRule.serialise.<locals>.<genexpr>)
listrg   rf   re   appendr-   r\   r^   rh   join)r!   pairsrk   valrp   r   r   r   r@      s   

zMatchRule.serialisemsgc           
      C   sV  |j }| jdur|j| jkrdS | j D ]\}}|jt| d|kr' dS q| jdurH|jtjd}| j	d}||ksH|
|d sHdS | j D ][\}\}}|t|jkr] dS |j| }	t|	tsj dS |dkrv|	|kru dS qM|dkr|	|ks|dr|	
|s|	dr|
|	s dS qM|dkr|	|ks|	
|d s dS qMd	S )
z%Returns True if msg matches this ruleNF /rj   r[   rm   .T)headerre   rg   rf   ri   getr   r\   r[   rstrip
startswithrh   lenbodyr?   rd   endswith)
r!   r   hfieldexpectedr[   path_nsrk   rp   ru   r   r   r   matches   sR   


zMatchRule.matches)rj   )r   r   r   rN   r   intrd   rq   r@   r   boolr   r   r   r   r   r      s    r   N)rN   	low_levelr   r   r   wrappersr   r   __all__r   r   r	   r
   r   r   r   r   r   r   <module>   s    	J