o
    •ºé`Ì  ã                   @   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   ú6/usr/lib/python3/dist-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 )z€Add 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 ¡ D ]\}\}}|dkr,d}| d|› |› �|f¡ q d dd„ |D ƒ¡S )	zAConvert to a string to use in an AddMatch call to the message busrX   )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^   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