
    af+              
       t   d dl Z d dlZd dlZd dlZd dlmZ 	 d dlmZ n1# e$ r)  ed            ed            ej	        d           Y nw xY wd dl
mZmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlZ ej                      ej        d          Ze                    dddd           e                    ddddd           e                    dddde j                            dd                     e                    dddd           e                    ddd d           e                    d!d"ded#d $           e                    d%d&'          Ze                     d(d)*          Z!e!                    d+e"d,-           e!                    d.d/d01           e!                    d2d3d4d56           e                     d7d8*          Z#e#                    d+e"d9-           e#                    d:d/d01           e#                    d2d3d4d56           e                     d;d<*          Z$e$                    d+e"d,-           e$                    d=ed d>?           e$                    d@e"d/dAB           e                     dCdD*          Z%e%                    d+e"d,-           e%                    d=ed d>?           e%                    dEe"dFdFdGgdHI           dJ Z&edK             Z'edL             Z(edM             Z)edN             Z*dO Z+edP             Z,e-dQk    r e+             dS dS )R    N)copy)	Componentz.The 'wamp' command-line tool requires Twisted.z  pip install autobahn[twisted]   )DeferredinlineCallbacks)react)ProcessProtocol)ApplicationError)PublishOptions)SubscribeOptionswamp)progz--urlstorezLA WAMP URL to connect to, like ws://127.0.0.1:8080/ws or rs://localhost:1234T)actionhelprequiredz--realmz-rzThe realm to joindefault)r   r   r   z--private-keyz-kzCHex-encoded private key (via WAMP_PRIVATE_KEY if not provided here)WAMP_PRIVATE_KEYz--authidz$The authid to use, if authenticatingz
--authrolez"The role to use, if authenticatingz--max-failuresz-mz%Failures before giving up (0 forever))r   typer   r   subcommandssubcommand_name)titledestcallz&Do a WAMP call() and print any results)r   urizA WAMP URI to call)r   r   	call_args*z,All additional arguments are positional args)nargsr   z	--keyword   appendz.Specify a keyword argument to send: name value)r   r   r   publishz/Do a WAMP publish() with the given args, kwargszA WAMP URI to publishpublish_argsregisterz2Do a WAMP register() and run a command when calledz--timesz=Listen for this number of events, then exit. Default: forever)r   r   r   commandzTakes one or more args: the executable to call, and any positional arguments. As well, the following environment variables are set: WAMP_ARGS, WAMP_KWARGS and _JSON variants.)r   r   r   	subscribez:Do a WAMP subscribe() and print one line of JSON per eventz--matchexactprefixz4Massed in the SubscribeOptions, how to match the URI)r   r   choicesr   c                 b   | j                             d          rd}n,| j                             d          rd}nt          d          t                      }| j        r.| j        st          d          | j        | j        | j        d|d<   t          || j         d	g|r|nd
| j                  S )zX
    Configure and return a Component instance according to the given
    `options`
    zws://	websocketzrs://	rawsocketz$URL should start with ws:// or rs://zRRequire --authid and --authrole if --private-key (or WAMP_PRIVATE_KEY) is provided)authidauthroleprivkey
cryptosign)r   urlN)
transportsauthenticationrealm)	r0   
startswith
ValueErrordictprivate_keyr,   r-   r   r3   )optionskindr2   s      C/var/www/html/env/lib/python3.11/site-packages/autobahn/__main__.py_create_componentr;      s    
 {g&& 
				(	( 
2
 
 	
 VVN 	
~ 	d   n(*(
 (
|$ ;
 
  *8A~~Tm       c              #      K   t          |j                  }t                      }|j        d |j        D             } |j        |j        g|R i |V }t          d                    |                     d S )Nc                     i | ]\  }}||	S  r?   .0kvs      r:   
<dictcomp>zdo_call.<locals>.<dictcomp>   s.     
 
 
1 q
 
 
r<   z
result: {})listr   r6   keywordr   r   printformat)reactorsessionr8   r   call_kwargsresultss         r:   do_callrM      s      W&''I&&K"
 

 
 

 !GLHyHHHKHHHHG	,

g
&
&'''''r<   c              #      K   t          |j                  }|j        i nd |j        D             } |j        |j        g|R dt          d          i|V  d S )Nc                     i | ]\  }}||	S r?   r?   r@   s      r:   rD   zdo_publish.<locals>.<dictcomp>  s.     9 9 9Aq 	
19 9 9r<   r8   T)acknowledge)rE   r"   rF   r!   r   r   )rI   rJ   r8   r"   publish_kwargss        r:   
do_publishrR      s      ,--L"?2RR 9 9O9 9 9N
 '/	   4000 	      r<   c              #       K   t                      j        gt           fd            }|                    |j                  V  V  dS )z-
    run a command-line upon an RPC call
    c               ?   b  K   t          d                    | |          t          j                   t	          t
          j                  }d                    |           |d<   t          j	        |           |d<   d                    d |
                                D                       |d<   t          j	        |          |d<   t
          j                            
j        d	                   }
j        } t                       G fd
dt                    } |            }                    ||| |d           V }|d	k    r"t          d                    |                     	d	         r:	d	xx         dz  cc<   	d	         d	k    r                     d	j        d            d S d S d S )Nzcalled: args={}, kwargs={}file 	WAMP_ARGSWAMP_ARGS_JSONc              3   H   K   | ]\  }}d                      ||          V  dS )z{}={}N)rH   r@   s      r:   	<genexpr>z.do_register.<locals>.called.<locals>.<genexpr>  s4      %R%Rtq!gnnQ&:&:%R%R%R%R%R%Rr<   WAMP_KWARGSWAMP_KWARGS_JSONr   c                   &    e Zd Zd Zd Z fdZdS )/do_register.<locals>.called.<locals>.DumpOutputc                 j    t           j                            |                    d                     d S Nutf8)sysstdoutwritedecodeselfdatas     r:   outReceivedz;do_register.<locals>.called.<locals>.DumpOutput.outReceived%  *    
  V!4!455555r<   c                 j    t           j                            |                    d                     d S ra   )rc   stderrre   rf   rg   s     r:   errReceivedz;do_register.<locals>.called.<locals>.DumpOutput.errReceived(  rk   r<   c                 F                         |j        j                   d S )N)callbackvalueexitCode)rh   reasondones     r:   processExitedz=do_register.<locals>.called.<locals>.DumpOutput.processExited+  s     fl344444r<   N)__name__
__module____qualname__rj   rn   ru   )rt   s   r:   
DumpOutputr_   $  sL        6 6 66 6 65 5 5 5 5 5 5r<   ry   .)envpathzFailed with exit-code {}r   )rG   rH   rc   rm   r   osenvironjoinjsondumpsitemsr|   abspathr$   r   r	   spawnProcess	callLaterrp   )argskwr{   exery   protocodert   all_done	countdownr8   rI   s          @r:   calledzdo_register.<locals>.called  s     *11$;;#*MMMM2:88D>>K $
4 0 0 XX%R%Rrxxzz%R%R%RRRM"&*R..googoa011zz	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 
3#C 	 	
 	
 	
 zz199,33D99:::Q< 	>aLLLALLL|q  !!!X%6=====	> 	>  r<   N)r   timesr   r#   r   )rI   rJ   r8   r   r   r   s   ` ` @@r:   do_registerr     s~       zzHI!> !> !> !> !> !> !> _!>F 

67;
/
////
NNNNNr<   c              #       K   t                      |j        gt           fd            }|                    ||j        t          |j                            V  V  dS )z3
    print events (one line of JSON per event)
    c                      t          t          j        | |d                     d         r:dxx         dz  cc<   d         dk    r                     dj        d            d S d S d S )N)r   kwargsr   r   )rG   r   r   r   rp   )r   r   r   r   rI   s     r:   	publishedzdo_subscribe.<locals>.publishedH  s    J   	
 	
 	
 Q< 	>aLLLALLL|q  !!!X%6=====	> 	>  r<   )match)r8   N)r   r   r   r%   r   r   r   )rI   rJ   r8   r   r   r   s   `   @@r:   do_subscriber   ?  s       zzHI
> 
> 
> 
> 
> 
> _
> 

Iw{<LSZS`<a<a<a

b
bbbb
NNNNNr<   c                  .    t          t                     dS )zi
    This is a magic name for `python -m autobahn`, and specified as
    our entry_point in setup.py
    N)r   
_real_mainr?   r<   r:   _mainr   Y  s    
 
*r<   c              #   `   K   t                                           t                    }j        #t	          d           t          j        d           j        dk    rωj        d         }t          j	        
                    |          sBt	          d                    |          t
          j                   t          j        d           t          j	                            |          sBt	          d                    |          t
          j                   t          j        d           t          t          t           t"          d	}|j                 dg|j        t&           fd
                        }g |j         fd            }|                               V  dS )zJ
    Sanity check options, create a connection and run our subcommand
    NzMust select a subcommandr   r#   r   z/Full path to the executable required. Found: {}rU   zExecutable not found: {})r   r#   r%   r!   c           	   3     K   t          d                    |j        |j                  t          j                   	  |           V  n\# t          $ rO}t          d                    |j        d                    |j	                                       dd<   Y d }~nd }~ww xY w| 
                                V  d S )Nz$connected: authrole={} authmethod={}rU   z
{}: {}
    r   )rG   rH   r-   
authmethodrc   rm   r
   errorr   r   leave)rJ   detailse
command_fn	exit_coder8   rI   s      r:   _z_real_main.<locals>._  s       	4;;G<LgN`aahkhrssss	*Wgw777777 	 	 	,%%agrwwqv??@@@IaLLLLLL	 mmoos   A 
B'AB""B'c                 J   t          d                    |                                         |           j        dk    r]t	                    j        k    rGt          d                    t	                                                                          d S d S d S )Nzconnect failure: {}r   zToo many failures ({}). Exiting)rG   rH   r    max_failureslenstop)compfailfailuresr8   rI   s     r:   r   z_real_main.<locals>._  s    #**400111!##H8L(L(L3::3x==IIJJJLLNNNNN $#(L(Lr<   )top
parse_argsr;   r   rG   rc   exitr$   r}   r|   isabsrH   rm   existsrM   r   r   rR   on_joinr   on_connectfailurestart)	rI   	componentr   r   r   r   r   r   r8   s	   `    @@@@r:   r   r   a  s     
 nnG!'**I&()))*,,oa w}}S!! 	CJJ3OOVYV`aaaaHQKKKw~~c"" 	,33C88szJJJJHQKKK !	 K W45JI       _  H       !  //'
"
""""""r<   __main__).r}   rc   argparser   r   autobahn.twisted.componentr   ImportErrorrG   r   twisted.internet.deferr   r   twisted.internet.taskr   twisted.internet.protocolr	   autobahn.wamp.exceptionr
   autobahn.wamp.typesr   r   txaiouse_twistedArgumentParserr   add_argumentr~   getintadd_subparserssub
add_parserr   strr!   r#   r%   r;   rM   rR   r   r   r   r   rv   r?   r<   r:   <module>r      s  < 
			 



        4444444   	E
:;;;	E
+,,,CHQKKKKK
 = < < < < < < < ' ' ' ' ' ' 5 5 5 5 5 5 4 4 4 4 4 4 . . . . . . 0 0 0 0 0 0       h6***   	W	       t		       T	NJNN-t44	       	/	       	-	       d		0     

	    ~~
	1      			    
   
	7    
   
	9	     ..	:      			     
   
	7    
   
	9	     >>	=    	  			    
 	  		H	     	  	
	5  	 	 	 NN	E   	 
  			    
 
  		H	     
  	h	?    ! ! !H 
( 
( 
(    - - -`   2   3# 3# 3#n z	EGGGGG s    +AA