AlkantarClanX12

Your IP : 3.15.17.60


Current Path : /proc/self/root/opt/alt/python39/lib64/python3.9/xmlrpc/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python39/lib64/python3.9/xmlrpc/__pycache__/server.cpython-39.opt-2.pyc

a

R�f@��	@s ddlmZmZmZmZmZddlmZddlm	Z	ddl
mZddlZddlZ
ddlZddlZddlZddlZddlZddlZzddlZWney�dZYn0d*dd�Zd	d
�ZGdd�d�ZGd
d�de�ZGdd�deje�ZGdd�de�ZGdd�de�ZGdd�dej�ZGdd�d�Z Gdd�de�Z!Gdd�dee �Z"Gdd�dee �Z#e$dk�rddl%Z%Gd d!�d!�Z&ed"���Z'e'�(e)�e'�(d#d$�d%�e'j*e&�dd&�e'�+�e,d'�e,d(�ze'�-�Wn&e.�y�e,d)�e�/d�Yn0Wd�n1�s0YdS)+�)�Fault�dumps�loads�gzip_encode�gzip_decode)�BaseHTTPRequestHandler)�partial)�	signatureNTcCsF|r|�d�}n|g}|D]&}|�d�r6td|��qt||�}q|S)N�.�_z(attempt to access private attribute "%s")�split�
startswith�AttributeError�getattr)�obj�attr�allow_dotted_names�attrs�i�r�2/opt/alt/python39/lib64/python3.9/xmlrpc/server.py�resolve_dotted_attribute|s

�rcs�fdd�t��D�S)Ncs(g|] }|�d�stt�|��r|�qS)r)r
�callabler)�.0�member�rrr�
<listcomp>�s
�z'list_public_methods.<locals>.<listcomp>)�dirrrrr�list_public_methods�src@sleZdZddd�Zddd�Zddd�Zd	d
�Zdd�Zdd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�SimpleXMLRPCDispatcherFNcCs&i|_d|_||_|pd|_||_dS�N�utf-8)�funcs�instance�
allow_none�encoding�use_builtin_types��selfr$r%r&rrr�__init__�s

zSimpleXMLRPCDispatcher.__init__cCs||_||_dS�N)r#r)r(r#rrrr�register_instance�s!z(SimpleXMLRPCDispatcher.register_instancecCs2|durt|j|d�S|dur$|j}||j|<|S)N)�name)r�register_function�__name__r")r(Zfunctionr,rrrr-�s
z(SimpleXMLRPCDispatcher.register_functioncCs|j�|j|j|jd��dS)N)zsystem.listMethodszsystem.methodSignaturezsystem.methodHelp)r"�update�system_listMethods�system_methodSignature�system_methodHelp�r(rrr� register_introspection_functions�s
�z7SimpleXMLRPCDispatcher.register_introspection_functionscCs|j�d|ji�dS)Nzsystem.multicall)r"r/�system_multicallr3rrr�register_multicall_functions�sz3SimpleXMLRPCDispatcher.register_multicall_functionscCs�zPt||jd�\}}|dur(|||�}n|�||�}|f}t|d|j|jd�}Wn�ty�}zt||j|jd�}WYd}~nbd}~0t��\}}	}
z0ttdd||	f�|j|jd�}Wd}}	}
nd}}	}
0Yn0|�	|jd�S)N)r&�)Zmethodresponser$r%)r$r%�%s:%s�r%r$�xmlcharrefreplace)
rr&�	_dispatchrr$r%r�sys�exc_info�encode)r(�data�dispatch_method�path�params�method�response�fault�exc_type�	exc_value�exc_tbrrr�_marshaled_dispatch�s,�
��"z*SimpleXMLRPCDispatcher._marshaled_dispatchcCs^t|j���}|jdurVt|jd�r8|t|j���O}nt|jd�sV|tt|j��O}t|�S)N�_listMethodsr;)�setr"�keysr#�hasattrrJr�sorted)r(�methodsrrrr0s
z)SimpleXMLRPCDispatcher.system_listMethodscCsdS)Nzsignatures not supportedr)r(�method_namerrrr1/sz-SimpleXMLRPCDispatcher.system_methodSignaturecCs�d}||jvr|j|}nV|jdurpt|jd�r<|j�|�St|jd�spzt|j||j�}WntynYn0|dur|dSt�|�SdS)N�_methodHelpr;�)	r"r#rMrQrrr�pydoc�getdoc)r(rPrCrrrr2<s$

�z(SimpleXMLRPCDispatcher.system_methodHelpc
Cs�g}|D]�}|d}|d}z|�|�||�g�Wqtyl}z |�|j|jd��WYd}~qd}~0t��\}}}	z(|�dd||fd��Wd}}}	nd}}}	0Yq0q|S)NZ
methodNamerB)�	faultCode�faultStringr7r8)�appendr;rrUrVr<r=)
r(Z	call_list�resultsZcallrPrBrErFrGrHrrrr5[s,
��
��$z'SimpleXMLRPCDispatcher.system_multicallcCs�z|j|}Wnty Yn0|dur2||�Std|��|jdur�t|jd�rb|j�||�Szt|j||j�}Wnty�Yn0|dur�||�Std|��dS)Nzmethod "%s" is not supportedr;)	r"�KeyError�	Exceptionr#rMr;rrr)r(rCrB�funcrrrr;s*
�z SimpleXMLRPCDispatcher._dispatch)FNF)F)NN)NN)r.�
__module__�__qualname__r)r+r-r4r6rIr0r1r2r5r;rrrrr�s	�

$

)
$rc@sbeZdZdZdZdZdZe�dej	ej
B�Zdd�Zdd	�Z
d
d�Zdd
�Zdd�Zddd�ZdS)�SimpleXMLRPCRequestHandler)�/z/RPC2ix���Tz�
                            \s* ([^\s;]+) \s*            #content-coding
                            (;\s* q \s*=\s* ([0-9\.]+))? #q
                            cCs^i}|j�dd�}|�d�D]<}|j�|�}|r|�d�}|rFt|�nd}|||�d�<q|S)NzAccept-EncodingrR�,�g�?r7)�headers�getr�	aepattern�match�group�float)r(�rZae�erf�vrrr�accept_encodings�s
z+SimpleXMLRPCRequestHandler.accept_encodingscCs|jr|j|jvSdSdS)NT)�	rpc_pathsrAr3rrr�is_rpc_path_valid�sz,SimpleXMLRPCRequestHandler.is_rpc_path_validc
Cs�|��s|��dSz�d}t|jd�}g}|rht||�}|j�|�}|sLqh|�|�|t|d�8}q,d�	|�}|�
|�}|dur�WdS|j�|t
|dd�|j�}Wn�t�y8}zx|�d�t|jd��r|jj�r|�dt|��t��}	t|	�d	d
�d	�}	|�d|	�|�dd
�|��WYd}~n�d}~00|�d�|�dd�|jdu�r�t|�|jk�r�|���dd�}
|
�r�zt|�}|�dd�Wnt�y�Yn0|�dtt|���|��|j�|�dS)Ni�zcontent-lengthr`�r;i��_send_traceback_headerzX-exception�ASCII�backslashreplacezX-traceback�Content-length�0���Content-typeztext/xml�gziprzContent-Encoding) rn�
report_404�intrc�minZrfile�readrW�len�join�decode_request_content�serverrIrrArZ�
send_responserMrp�send_header�str�	traceback�
format_excr>�end_headers�encode_thresholdrlrdr�NotImplementedError�wfile�write)r(Zmax_chunk_sizeZsize_remaining�LZ
chunk_size�chunkr?rDrjZtrace�qrrr�do_POST�s\



�
�
z"SimpleXMLRPCRequestHandler.do_POSTcCs�|j�dd���}|dkr|S|dkrrz
t|�WStyR|�dd|�Yq�tyn|�dd�Yq�0n|�dd|�|�dd	�|��dS)
Nzcontent-encodingZidentityrwi�zencoding %r not supported�zerror decoding gzip contentrsrt)	rcrd�lowerrr�r��
ValueErrorr�r�)r(r?r%rrrr~$s
z1SimpleXMLRPCRequestHandler.decode_request_contentcCsF|�d�d}|�dd�|�dtt|���|��|j�|�dS)Ni�sNo such pagervz
text/plainrs)r�r�r�r|r�r�r��r(rDrrrrx5s
z%SimpleXMLRPCRequestHandler.report_404�-cCs|jjrt�|||�dSr*)r�logRequestsr�log_request)r(�code�sizerrrr�>sz&SimpleXMLRPCRequestHandler.log_requestN)r�r�)r.r\r]rmr�ZwbufsizeZdisable_nagle_algorithm�re�compile�VERBOSE�
IGNORECASErerlrnr�r~rxr�rrrrr^�s	
�G	r^c@s*eZdZdZdZedddddfdd�ZdS)�SimpleXMLRPCServerTFNcCs,||_t�||||�tj�||||�dSr*)r�rr)�socketserver�	TCPServer�r(ZaddrZrequestHandlerr�r$r%Zbind_and_activater&rrrr)WszSimpleXMLRPCServer.__init__)r.r\r]Zallow_reuse_addressrpr^r)rrrrr�Ds�r�c@s<eZdZedddddfdd�Zdd�Zdd	�Zdd
d�ZdS)
�MultiPathXMLRPCServerTFNc
Cs2t�||||||||�i|_||_|p*d|_dSr )r�r)�dispatchersr$r%r�rrrr)hs�zMultiPathXMLRPCServer.__init__cCs||j|<|Sr*�r�)r(rA�
dispatcherrrr�add_dispatcherrs
z$MultiPathXMLRPCServer.add_dispatchercCs
|j|Sr*r�)r(rArrr�get_dispatchervsz$MultiPathXMLRPCServer.get_dispatchercCs�z|j|�|||�}Wnft��dd�\}}z:ttdd||f�|j|jd�}|�|jd�}Wd}}n
d}}0Yn0|S)N�r7r8r9r:)	r�rIr<r=rrr%r$r>)r(r?r@rArDrFrGrrrrIys
��z)MultiPathXMLRPCServer._marshaled_dispatch)NN)r.r\r]r^r)r�r�rIrrrrr�`s�

r�c@s0eZdZddd�Zdd�Zdd�Zdd	d
�ZdS)
�CGIXMLRPCRequestHandlerFNcCst�||||�dSr*)rr)r'rrrr)�sz CGIXMLRPCRequestHandler.__init__cCsP|�|�}td�tdt|��t�tj��tjj�|�tjj��dS)NzContent-Type: text/xml�Content-Length: %d)rI�printr|r<�stdout�flush�bufferr�)r(�request_textrDrrr�
handle_xmlrpc�s

z%CGIXMLRPCRequestHandler.handle_xmlrpccCs�d}tj|\}}tjj|||d�}|�d�}td||f�tdtjj�tdt|��t�t	j
��t	j
j�
|�t	j
j��dS)Nr�)r��message�explainr!z
Status: %d %szContent-Type: %sr�)rZ	responses�httprZDEFAULT_ERROR_MESSAGEr>r�ZDEFAULT_ERROR_CONTENT_TYPEr|r<r�r�r�r�)r(r�r�r�rDrrr�
handle_get�s ��

z"CGIXMLRPCRequestHandler.handle_getc	Csx|dur$tj�dd�dkr$|��nPzttj�dd��}WnttfyTd}Yn0|durjtj�	|�}|�
|�dS)NZREQUEST_METHODZGETZCONTENT_LENGTHr`)�os�environrdr�ryr��	TypeErrorr<�stdinr{r�)r(r�Zlengthrrr�handle_request�s�

z&CGIXMLRPCRequestHandler.handle_request)FNF)N)r.r\r]r)r�r�r�rrrrr��s
r�c@s:eZdZdiiifdd�Zdiiidfdd�Zdd�ZdS)�
ServerHTMLDocNcCsZ|p|j}g}d}t�d�}|�||�}	|	s0�q:|	��\}
}|�||||
���|	��\}}
}}}}|
r�||��dd�}|�d||f�n�|r�dt|�}|�d|||�f�n~|r�dt|�}|�d|||�f�nV|||d�d	k�r|�|�	||||��n(|�r"|�d
|�n|�|�	||��|}q|�|||d���d�
|�S)NrzS\b((http|https|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?((?:\w|\.)+))\b�"z&quot;z<a href="%s">%s</a>z'http://www.rfc-editor.org/rfc/rfc%d.txtz)https://www.python.org/dev/peps/pep-%04d/r7�(zself.<strong>%s</strong>rR)�escaper�r��search�spanrW�groups�replaceryZnamelinkr})r(�textr�r"�classesrOrX�here�patternrf�start�end�allZschemeZrfcZpepZselfdotr,Zurlrrr�markup�s4

zServerHTMLDoc.markupcCs�|r
|jpdd|}d}	d|�|�|�|�f}
t|�rHtt|��}nd}t|t�rp|dp`|}|dpld}n
t�|�}|
||	o�|�	d|	�}
|�
||j|||�}|o�d|}d	|
|fS)
NrRr�z$<a name="%s"><strong>%s</strong></a>z(...)rr7z'<font face="helvetica, arial">%s</font>z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
)r.r�rr�r	�
isinstance�tuplerSrTZgreyr��	preformat)r(�objectr,�modr"r�rOZclZanchorZnote�titleZargspecZ	docstringZdecl�docrrr�
docroutine�s(�

��zServerHTMLDoc.docroutinec	Cs�i}|��D] \}}d|||<||||<q|�|�}d|}|�|dd�}|�||j|�}	|	ohd|	}	|d|	}g}
t|���}|D]\}}|
�|j|||d��q�||�ddd	d
�	|
��}|S)Nz#-z)<big><big><strong>%s</strong></big></big>z#ffffffz#7799eez<tt>%s</tt>z
<p>%s</p>
)r"ZMethodsz#eeaa77rR)
�itemsr�Zheadingr�r�rNrWr�Z
bigsectionr})r(�server_nameZpackage_documentationrOZfdict�key�value�head�resultr��contentsZmethod_itemsrrr�	docservers$
�zServerHTMLDoc.docserver)r.r\r]r�r�r�rrrrr��s
)�
r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�XMLRPCDocGeneratorcCsd|_d|_d|_dS)NzXML-RPC Server DocumentationzGThis server exports the following methods through the XML-RPC protocol.)r��server_documentation�server_titler3rrrr):s�zXMLRPCDocGenerator.__init__cCs
||_dSr*)r�)r(r�rrr�set_server_titleBsz#XMLRPCDocGenerator.set_server_titlecCs
||_dSr*)r�)r(r�rrr�set_server_nameGsz"XMLRPCDocGenerator.set_server_namecCs
||_dSr*)r�)r(r�rrr�set_server_documentationLsz+XMLRPCDocGenerator.set_server_documentationc	Cs�i}|��D]�}||jvr&|j|}n�|jdur�ddg}t|jd�rT|j�|�|d<t|jd�rp|j�|�|d<t|�}|dkr�|}q�t|jd�s�zt|j|�}Wq�ty�|}Yq�0q�|}n|||<qt	�}|�
|j|j|�}|�
t�|j�|�S)N�_get_method_argstringrrQr7)NNr;)r0r"r#rMr�rQr�rrr�r�r�r�Zpage�htmlr�r�)r(rOrPrCZmethod_infoZ
documenterZ
documentationrrr�generate_html_documentationQs<

�
�z.XMLRPCDocGenerator.generate_html_documentationN)r.r\r]r)r�r�r�r�rrrrr�3s
r�c@seZdZdd�ZdS)�DocXMLRPCRequestHandlercCsf|��s|��dS|j���d�}|�d�|�dd�|�dtt|���|�	�|j
�|�dS)Nr!rurvz	text/htmlrs)rnrxrr�r>r�r�r�r|r�r�r�r�rrr�do_GET�s
zDocXMLRPCRequestHandler.do_GETN)r.r\r]r�rrrrr��s
r�c@s"eZdZedddddfdd�ZdS)�DocXMLRPCServerTFNc
Cs&t�||||||||�t�|�dSr*)r�r)r�r�rrrr)�s
�zDocXMLRPCServer.__init__)r.r\r]r�r)rrrrr��s�r�c@seZdZdd�Zdd�ZdS)�DocCGIXMLRPCRequestHandlercCsT|���d�}td�tdt|��t�tj��tjj�|�tjj��dS)Nr!zContent-Type: text/htmlr�)	r�r>r�r|r<r�r�r�r�r�rrrr��s
z%DocCGIXMLRPCRequestHandler.handle_getcCst�|�t�|�dSr*)r�r)r�r3rrrr)�s
z#DocCGIXMLRPCRequestHandler.__init__N)r.r\r]r�r)rrrrr��sr��__main__c@s"eZdZdd�ZGdd�d�ZdS)�ExampleServicecCsdS)NZ42rr3rrr�getData�szExampleService.getDatac@seZdZedd��ZdS)zExampleService.currentTimecCs
tj��Sr*)�datetimeZnowrrrr�getCurrentTime�sz)ExampleService.currentTime.getCurrentTimeN)r.r\r]�staticmethodr�rrrr�currentTime�sr�N)r.r\r]r�r�rrrrr��sr�)Z	localhosti@cCs||Sr*r)�x�yrrr�<lambda>�ror��add)rz&Serving XML-RPC on localhost port 8000zKIt is advisable to run this example server within a secure, closed network.z&
Keyboard interrupt received, exiting.)T)0Z
xmlrpc.clientrrrrrZhttp.serverr�	functoolsr�inspectr	r�r�r�r<r�r�rSr�Zfcntl�ImportErrorrrrr^r�r�r�r�ZHTMLDocr�r�r�r�r�r.r�r�rr-�powr+r6r�Z
serve_forever�KeyboardInterrupt�exitrrrr�<module>ksf

�,EbQ��