U
    [e                     @   s   d Z ddlmZmZmZ ddlmZmZ dddddd	g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__Zallow_replacementZreplace_existingZdo_not_queue r   r   V/var/www/html/services/stratfitenv/lib/python3.8/site-packages/jeepney/bus_messages.pyr      s   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                    s   t  j||d d S N)object_pathbus_namesuper__init__selfr   r   	__class__r   r   r      s    zDBus.__init__c                 C   s
   t | dS )NHellor   r   r   r   r   r       s    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   s   t | dd|fS )NReleaseNamesr!   r   r&   r   r   r   r(   %   s    zDBus.ReleaseNamec                 C   s   t | dd|dfS )NStartServiceByNamer%   r#   r!   r*   r   r   r   r+   (   s    zDBus.StartServiceByNamec                 C   s   t | dd|fS )NUpdateActivationEnvironmentza{ss}r!   )r   envr   r   r   r,   ,   s    z DBus.UpdateActivationEnvironmentc                 C   s   t | dd|fS )NNameHasOwnerr)   r!   r*   r   r   r   r.   0   s    zDBus.NameHasOwnerc                 C   s
   t | dS )N	ListNamesr!   r"   r   r   r   r/   3   s    zDBus.ListNamesc                 C   s
   t | dS )NListActivatableNamesr!   r"   r   r   r   r0   6   s    zDBus.ListActivatableNamesc                 C   s"   t |tr| }t| dd|fS )z4*rule* can be a str or a :class:`MatchRule` instanceAddMatchr)   
isinstancer   	serialiser   r   ruler   r   r   r1   9   s    
zDBus.AddMatchc                 C   s"   t |tr| }t| dd|fS )NRemoveMatchr)   r2   r5   r   r   r   r7   ?   s    
zDBus.RemoveMatchc                 C   s   t | dd|fS )NGetNameOwnerr)   r!   r*   r   r   r   r8   D   s    zDBus.GetNameOwnerc                 C   s   t | dd|fS )NListQueuedOwnersr)   r!   r*   r   r   r   r9   G   s    zDBus.ListQueuedOwnersc                 C   s   t | dd|fS )NGetConnectionUnixUserr)   r!   r*   r   r   r   r:   J   s    zDBus.GetConnectionUnixUserc                 C   s   t | dd|fS )NGetConnectionUnixProcessIDr)   r!   r*   r   r   r   r;   M   s    zDBus.GetConnectionUnixProcessIDc                 C   s   t | dd|fS )NGetAdtAuditSessionDatar)   r!   r*   r   r   r   r<   P   s    zDBus.GetAdtAuditSessionDatac                 C   s   t | dd|fS )N#GetConnectionSELinuxSecurityContextr)   r!   r*   r   r   r   r=   S   s    z(DBus.GetConnectionSELinuxSecurityContextc                 C   s
   t | dS )NReloadConfigr!   r"   r   r   r   r>   W   s    zDBus.ReloadConfigc                 C   s
   t | dS )NGetIdr!   r"   r   r   r   r?   Z   s    z
DBus.GetIdc                 C   s   t | dd|fS )NGetConnectionCredentialsr)   r!   r*   r   r   r   r@   ]   s    zDBus.GetConnectionCredentials)r   r   )r#   )r   r   r   __doc__	interfacer   r    r$   r(   r+   r,   r.   r/   r0   r1   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   __classcell__r   r   r   r   r      s0     
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                    s   t  j||d d S r   r   r   r   r   r   r   e   s    zMonitoring.__init__c                 C   s   t | dd|dfS )z:Convert this connection to a monitor connection (advanced)BecomeMonitorZasur#   r!   )r   rulesr   r   r   rD   i   s    zMonitoring.BecomeMonitor)r   r   )r   r   r   rB   r   rD   rC   r   r   r   r   r
   b   s
     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                    s   t  j||d d S r   r   r   r   r   r   r   p   s    zStats.__init__c                 C   s
   t | dS )NGetStatsr!   r"   r   r   r   rF   t   s    zStats.GetStatsc                 C   s   t | dd|fS )NGetConnectionStatsr)   r!   )r   Zarg0r   r   r   rG   w   s    zStats.GetConnectionStatsc                 C   s
   t | dS )NGetAllMatchRulesr!   r"   r   r   r   rH   {   s    zStats.GetAllMatchRules)r   r   )	r   r   r   rB   r   rF   rG   rH   rC   r   r   r   r   r   m   s     c                	   @   s\   e Zd ZdZdddddddddddZdeedd	d
ZedddZe	e
d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senderrB   memberpathpath_namespacedestination	eavesdropc          
      C   sR   t |trt| }|| _|||||d}	dd |	 D | _|| _|| _i | _d S )N)rJ   rB   rK   rL   rN   c                 S   s   i | ]\}}|d k	r||qS )Nr   .0kvr   r   r   
<dictcomp>   s      z&MatchRule.__init__.<locals>.<dictcomp>)	r3   strr   message_typeitemsheader_fieldsrM   rO   arg_conditions)
r   rI   rJ   rB   rK   rL   rM   rN   rO   fieldsr   r   r   r      s    
zMatchRule.__init__string)argnovaluec                 C   s@   |dk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'
        >   rL   	namespacer[   z	kind={!r}r^   r#   z$argno must be 0 for kind='namespace'N)
ValueErrorformatrY   )r   r\   r]   kindr   r   r   add_arg_condition   s
    zMatchRule.add_arg_condition)returnc                 C   s   t | j }| jr&|d| jjf | jr6|d | j D ]0\}\}}|dkrXd}|d| | |f q@ddd |D S )	zAConvert to a string to use in an AddMatch call to the message busrI   )rO   truer[    arg,c                 s   s&   | ]\}}d  ||ddV  qdS )z{}='{}''z'\''N)r`   replacerP   r   r   r   	<genexpr>   s    z&MatchRule.serialise.<locals>.<genexpr>)	listrX   rW   rV   appendr&   rO   rY   join)r   pairsr\   valra   r   r   r   r4      s    

zMatchRule.serialise)msgrc   c           
      C   sb  |j }| jdk	r |j| jkr dS | j D ]$\}}|jt| d|kr* dS q*| jdk	r|jtjd}| j	d}||ks|
|d sdS | j D ]\}\}}|t|jkr dS |j| }	t|	ts dS |dkr|	|kr dS q|dkr8|	|ks\|dr|	
|s\|	dr0|
|	s\ dS q|dkr|	|ks|	
|d s dS qd	S )
z%Returns True if msg matches this ruleNF /r[   rL   r^   .T)headerrV   rX   rW   rZ   getr   rM   rL   rstrip
startswithrY   lenbodyr3   rU   endswith)
r   rp   hfieldexpectedrL   Zpath_nsr\   ra   rf   r   r   r   matches   sN    



zMatchRule.matches)r[   )r   r   r   rA   r   intrU   rb   r4   r   boolr~   r   r   r   r   r      s     N)rA   Z	low_levelr   r   r   Zwrappersr   r   __all__r   r   r	   r
   r   r   r   r   r   r   <module>   s   	J