AlkantarClanX12

Your IP : 18.117.158.124


Current Path : /opt/alt/python310/lib64/python3.10/xmlrpc/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/xmlrpc/__pycache__/server.cpython-310.opt-2.pyc

o

6��f@��	@s6	ddlmZmZmZmZmZddlmZddlm	Z	ddl
mZddlZddlZ
ddlZddlZddlZddlZddlZddlZzddlZWneyRdZYnwd*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"��KZ'e'�(e)�e'�(d#d$�d%�e'j*e&�dd&�e'�+�e,d'�e,d(�ze'�-�Wne.y�e,d)�e�/d�Yn	wWd�dSWd�dS1�swYdSdS)+�)�Fault�dumps�loads�gzip_encode�gzip_decode)�BaseHTTPRequestHandler)�partial)�	signatureNTcCsF	|r	|�d�}n|g}|D]}|�d�rtd|��t||�}q|S)N�.�_z(attempt to access private attribute "%s")�split�
startswith�AttributeError�getattr)�obj�attr�allow_dotted_namesZattrs�i�r�4/opt/alt/python310/lib64/python3.10/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@sreZdZ			ddd�Zddd�Zddd�Zd	d
�Zdd�Zdd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�SimpleXMLRPCDispatcherFNcCs&i|_d|_||_|pd|_||_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_instancecCs4	|durt|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_multicallr2rrr�register_multicall_functions�sz3SimpleXMLRPCDispatcher.register_multicall_functionscCs�	z(t||jd�\}}|dur|||�}n|�||�}|f}t|d|j|jd�}WnEtyD}zt||j|jd�}WYd}~n/d}~wt��\}}	}
zttdd||	f�|j|jd�}Wd}}	}
nd}}	}
wY|�	|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�s0
����z*SimpleXMLRPCDispatcher._marshaled_dispatchcCsf	t|j���}|jdur/t|jd�r |t|j���O}t|�St|jd�s/|tt|j��O}t|�S)N�_listMethodsr:)�setr!�keysr"�hasattrrIr�sorted)r'�methodsrrrr/s
�z)SimpleXMLRPCDispatcher.system_listMethodscCs	dS)Nzsignatures not supportedr)r'�method_namerrrr0/s
z-SimpleXMLRPCDispatcher.system_methodSignaturecCs�	d}||jvr|j|}n+|jdur9t|jd�r|j�|�St|jd�s9z
t|j||j�}Wn	ty8Ynw|dur?dSt�|�S)N�_methodHelpr:�)	r!r"rLrPrrr�pydoc�getdoc)r'rOrBrrrr1<s(

��
z(SimpleXMLRPCDispatcher.system_methodHelpc
Cs�	g}|D]Y}|d}|d}z|�|�||�g�Wqty7}z|�|j|jd��WYd}~qd}~wt��\}}}	z|�dd||fd��Wd}}}	nd}}}	wYq|S)NZ
methodNamerA)�	faultCode�faultStringr6r7)�appendr:rrTrUr;r<)
r'Z	call_list�resultsZcallrOrArDrErFrGrrrr4[s0	���
�� z'SimpleXMLRPCDispatcher.system_multicallcCs�	z|j|}Wn	tyYnw|dur||�Std|��|jdurNt|jd�r2|j�||�Sz
t|j||j�}Wn	tyEYn	w|durN||�Std|��)Nzmethod "%s" is not supportedr:)	r!�KeyError�	Exceptionr"rLr:rrr)r'rBrA�funcrrrr:s0�
��z SimpleXMLRPCDispatcher._dispatch�FNF)F�NN)r-�
__module__�__qualname__r(r*r,r3r5rHr/r0r1r4r:rrrrr�s
�

$
)
$rc@sdeZdZ	dZdZdZdZe�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�}|r#t|�nd}|||�d�<q|S)NzAccept-EncodingrQ�,�g�?r6)�headers�getr�	aepattern�match�group�float)r'�rZae�erg�vrrr�accept_encodings�s
�z+SimpleXMLRPCRequestHandler.accept_encodingscCs|jr	|j|jvSdS)NT)�	rpc_pathsr@r2rrr�is_rpc_path_valid�sz,SimpleXMLRPCRequestHandler.is_rpc_path_validc
Cs�	|��s|��dSzJd}t|jd�}g}|r6t||�}|j�|�}|s'n|�|�|t|d�8}|sd�	|�}|�
|�}|durGWdS|j�|t
|dd�|j�}WnGty�}z;|�d�t|jd�r�|jjr�|�dt|��t��}	t|	�d	d
�d	�}	|�d|	�|�dd
�|��WYd}~dSd}~ww|�d�|�dd�|jdur�t|�|jkr�|���dd�}
|
r�zt|�}|�dd�Wn	ty�Ynw|�dtt|���|��|j�|�dS)Ni�zcontent-lengthra�r:i��_send_traceback_headerzX-exception�ASCII�backslashreplacezX-traceback�Content-length�0���Content-typeztext/xml�gziprzContent-Encoding) ro�
report_404�intrd�minZrfile�readrV�len�join�decode_request_content�serverrHrr@rY�
send_responserLrq�send_header�str�	traceback�
format_excr=�end_headers�encode_thresholdrmrer�NotImplementedError�wfile�write)r'Zmax_chunk_sizeZsize_remaining�LZ
chunk_size�chunkr>rCrkZtrace�qrrr�do_POST�sf

�

�
���

�z"SimpleXMLRPCRequestHandler.do_POSTcCs�|j�dd���}|dkr|S|dkr8zt|�WSty)|�dd|�Ynty7|�dd�Yn	w|�dd|�|�dd	�|��dS)
Nzcontent-encodingZidentityrxi�zencoding %r not supported�zerror decoding gzip contentrtru)	rdre�lowerrr�r��
ValueErrorr�r�)r'r>r$rrrr$s
�z1SimpleXMLRPCRequestHandler.decode_request_contentcCsF|�d�d}|�dd�|�dtt|���|��|j�|�dS)Ni�sNo such pagerwz
text/plainrt)r�r�r�r}r�r�r��r'rCrrrry5s
z%SimpleXMLRPCRequestHandler.report_404�-cCs 	|jjrt�|||�dSdSr))r��logRequestsr�log_request)r'�code�sizerrrr�>s�z&SimpleXMLRPCRequestHandler.log_requestN)r�r�)r-r]r^rnr�ZwbufsizeZdisable_nagle_algorithm�re�compile�VERBOSE�
IGNORECASErfrmror�rryr�rrrrr_�s
�G	r_c@s,eZdZ	dZdZedddddfdd�ZdS)�SimpleXMLRPCServerTFNcCs,||_t�||||�tj�||||�dSr))r�rr(�socketserver�	TCPServer�r'ZaddrZrequestHandlerr�r#r$Zbind_and_activater%rrrr(WszSimpleXMLRPCServer.__init__)r-r]r^Zallow_reuse_addressrqr_r(rrrrr�Ds	�r�c@s>eZdZ	edddddfdd�Zdd�Zdd	�Zdd
d�ZdS)
�MultiPathXMLRPCServerTFNc
Cs2t�||||||||�i|_||_|pd|_dSr)r�r(�dispatchersr#r$r�rrrr(hs�zMultiPathXMLRPCServer.__init__cCs||j|<|Sr)�r�)r'r@�
dispatcherrrr�add_dispatcherrs
z$MultiPathXMLRPCServer.add_dispatchercCs
|j|Sr)r�)r'r@rrr�get_dispatchervs
z$MultiPathXMLRPCServer.get_dispatchercCs�z
|j|�|||�}W|St��dd�\}}zttdd||f�|j|jd�}|�|jd�}Wd}}Y|Sd}}w)N�r6r7r8r9)	r�rHr;r<rrr$r#r=)r'r>r?r@rCrErFrrrrHys 
���

�z)MultiPathXMLRPCServer._marshaled_dispatchr\)r-r]r^r_r(r�r�rHrrrrr�`s
�
r�c@s2eZdZ	ddd�Zdd�Zdd�Zdd	d
�ZdS)
�CGIXMLRPCRequestHandlerFNcCst�||||�dSr))rr(r&rrrr(�sz CGIXMLRPCRequestHandler.__init__cCsR	|�|�}td�tdt|��t�tj��tjj�|�tjj��dS)NzContent-Type: text/xml�Content-Length: %d)rH�printr}r;�stdout�flush�bufferr�)r'�request_textrCrrr�
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�httpr�ZDEFAULT_ERROR_MESSAGEr=r�ZDEFAULT_ERROR_CONTENT_TYPEr}r;r�r�r�r�)r'r�r�r�rCrrr�
handle_get�s"��

z"CGIXMLRPCRequestHandler.handle_getc	Cs|	|durtj�dd�dkr|��dSzttj�dd��}Wn
ttfy,d}Ynw|dur7tj�	|�}|�
|�dS)NZREQUEST_METHODZGETZCONTENT_LENGTHra)�os�environrer�rzr��	TypeErrorr;�stdinr|r�)r'r�Zlengthrrr�handle_request�s�z&CGIXMLRPCRequestHandler.handle_requestr[r))r-r]r^r(r�r�r�rrrrr��s
r�c@s<eZdZ	diiifdd�Zdiiidfdd�Zdd�ZdS)�
ServerHTMLDocNcCsX	|p|j}g}d}t�d�}	|�||�}	|	sn�|	��\}
}|�||||
���|	��\}}
}}}}|
rH||��dd�}|�d||f�nQ|r\dt|�}|�d|||�f�n=|rpdt|�}|�d|||�f�n)|||d�d	kr�|�|�	||||��n|r�|�d
|�n	|�|�	||��|}q|�|||d���d�
|�S)NrzS\b((http|https|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?((?:\w|\.)+))\br6�"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/�(zself.<strong>%s</strong>rQ)�escaper�r��search�spanrV�groups�replacerzZnamelinkr~)r'�textr�r!�classesrNrW�here�patternrg�start�end�allZschemeZrfcZpepZselfdotr+Zurlrrr�markup�s:

�
zServerHTMLDoc.markupcCs�	|r|jpdd|}d}	d|�|�|�|�f}
t|�r%tt|��}nd}t|t�r9|dp1|}|dp7d}nt�|�}|
||	oI|�	d|	�}
|�
||j|||�}|oZd|}d	|
|fS)
NrQr�z$<a name="%s"><strong>%s</strong></a>z(...)rr6z'<font face="helvetica, arial">%s</font>z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
)r-r�rr�r	�
isinstance�tuplerRrSZgreyr��	preformat)r'�objectr+�modr!r�rNZclZanchorZnote�titleZargspecZ	docstringZdecl�docrrr�
docroutine�s*�

��zServerHTMLDoc.docroutinec	Cs�	i}|��D]\}}d|||<||||<q|�|�}d|}|�|dd�}|�||j|�}	|	o5d|	}	|d|	}g}
t|���}|D]\}}|
�|j|||d��qF||�ddd	d
�	|
��}|S)Nz#-z)<big><big><strong>%s</strong></big></big>z#ffffffz#7799eez<tt>%s</tt>z
<p>%s</p>
)r!ZMethodsz#eeaa77rQ)
�itemsr�Zheadingr�r�rMrVr�Z
bigsectionr~)r'�server_nameZpackage_documentationrNZfdict�key�value�head�resultr��contentsZmethod_itemsrrr�	docservers&
�zServerHTMLDoc.docserver)r-r]r^r�r�r�rrrrr��s)
�r�c@s6eZdZ	dd�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_titler2rrrr(:s�
zXMLRPCDocGenerator.__init__cC�	||_dSr))r�)r'r�rrr�set_server_titleB�
z#XMLRPCDocGenerator.set_server_titlecCr�r))r�)r'r�rrr�set_server_nameGr�z"XMLRPCDocGenerator.set_server_namecCr�r))r�)r'r�rrr�set_server_documentationLr�z+XMLRPCDocGenerator.set_server_documentationc	Cs�	i}|��D]]}||jvr|j|}nL|jdur`ddg}t|jd�r+|j�|�|d<t|jd�r9|j�|�|d<t|�}|dkrD|}nt|jd�s^zt|j|�}Wn
ty]|}Ynw|}|||<qt	�}|�
|j|j|�}|�
t�|j�|�S)N�_get_method_argstringrrPr6r\r:)r/r!r"rLr�rPr�rrr�r�r�r�Zpage�htmlr�r�)r'rNrOrBZmethod_infoZ
documenterZ
documentationrrr�generate_html_documentationQs@


��
�z.XMLRPCDocGenerator.generate_html_documentationN)r-r]r^r(r�r�r�r�rrrrr�3sr�c@seZdZ	dd�ZdS)�DocXMLRPCRequestHandlercCsh	|��s|��dS|j���d�}|�d�|�dd�|�dtt|���|�	�|j
�|�dS)Nr rvrwz	text/htmlrt)roryr�r�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$eZdZ	edddddfdd�ZdS)�DocXMLRPCServerTFNc
Cs&t�||||||||�t�|�dSr))r�r(r�r�rrrr(�s
�zDocXMLRPCServer.__init__)r-r]r^r�r(rrrrr��s�r�c@seZdZ	dd�Zdd�ZdS)�DocCGIXMLRPCRequestHandlercCsV	|���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�r2rrrr(�s
z#DocCGIXMLRPCRequestHandler.__init__N)r-r]r^r�r(rrrrr��sr��__main__c@s"eZdZdd�ZGdd�d�ZdS)�ExampleServicecCsdS)NZ42rr2rrr�getData�szExampleService.getDatac@seZdZedd��ZdS)zExampleService.currentTimecCs
tj��Sr))�datetimeZnowrrrr�getCurrentTime�s
z)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>�sr��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�rRr�Zfcntl�ImportErrorrrrr_r�r�r�r�ZHTMLDocr�r�r�r�r�r-r�r�r�r,�powr*r5r�Z
serve_forever�KeyboardInterrupt�exitrrrr�<module>sxj�
�,EbQ��

	
���$��