Hacked By AnonymousFox

Current Path : /opt/alt/python312/lib64/python3.12/xmlrpc/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/xmlrpc/__pycache__/server.cpython-312.opt-1.pyc

�

�Q�f֏��H�dZddlmZmZmZmZmZddlmZddl	m
Z
ddlmZddl
Z
ddlZddlZddlZddlZddlZddlZddlZ	ddlZd(d�Zd	�ZGd
�d�ZGd�d
e�ZGd�dej6e�ZGd�de�ZGd�de�ZGd�dej>�Z Gd�d�Z!Gd�de�Z"Gd�dee!�Z#Gd�dee!�Z$e%dk(r�ddl&Z&Gd�d �Z'ed!�5Z(e(jSe*�e(jSd"�d#�e(jWe'�d�$�e(jY�e-d%�e-d&�	e(j]�ddd�yy#e$rdZY��'wxYw#e/$re-d'�ej`d�Y�9wxYw#1swYyxYw))aXML-RPC Servers.

This module can be used to create simple XML-RPC servers
by creating a server and either installing functions, a
class instance, or by extending the SimpleXMLRPCServer
class.

It can also be used to handle XML-RPC requests in a CGI
environment using CGIXMLRPCRequestHandler.

The Doc* classes can be used to create XML-RPC servers that
serve pydoc-style documentation in response to HTTP
GET requests. This documentation is dynamically generated
based on the functions and methods registered with the
server.

A list of possible usage patterns follows:

1. Install functions:

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_function(pow)
server.register_function(lambda x,y: x+y, 'add')
server.serve_forever()

2. Install an instance:

class MyFuncs:
    def __init__(self):
        # make all of the sys functions available through sys.func_name
        import sys
        self.sys = sys
    def _listMethods(self):
        # implement this method so that system.listMethods
        # knows to advertise the sys methods
        return list_public_methods(self) + \
                ['sys.' + method for method in list_public_methods(self.sys)]
    def pow(self, x, y): return pow(x, y)
    def add(self, x, y) : return x + y

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_introspection_functions()
server.register_instance(MyFuncs())
server.serve_forever()

3. Install an instance with custom dispatch method:

class Math:
    def _listMethods(self):
        # this method must be present for system.listMethods
        # to work
        return ['add', 'pow']
    def _methodHelp(self, method):
        # this method must be present for system.methodHelp
        # to work
        if method == 'add':
            return "add(2,3) => 5"
        elif method == 'pow':
            return "pow(x, y[, z]) => number"
        else:
            # By convention, return empty
            # string if no help is available
            return ""
    def _dispatch(self, method, params):
        if method == 'pow':
            return pow(*params)
        elif method == 'add':
            return params[0] + params[1]
        else:
            raise ValueError('bad method')

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_introspection_functions()
server.register_instance(Math())
server.serve_forever()

4. Subclass SimpleXMLRPCServer:

class MathServer(SimpleXMLRPCServer):
    def _dispatch(self, method, params):
        try:
            # We are forcing the 'export_' prefix on methods that are
            # callable through XML-RPC to prevent potential security
            # problems
            func = getattr(self, 'export_' + method)
        except AttributeError:
            raise Exception('method "%s" is not supported' % method)
        else:
            return func(*params)

    def export_add(self, x, y):
        return x + y

server = MathServer(("localhost", 8000))
server.serve_forever()

5. CGI script:

server = CGIXMLRPCRequestHandler()
server.register_function(pow)
server.handle_request()
�)�Fault�dumps�loads�gzip_encode�gzip_decode)�BaseHTTPRequestHandler)�partial)�	signatureNTc��|r|jd�}n|g}|D]-}|jd�rtd|z��t||�}�/|S)aGresolve_dotted_attribute(a, 'b.c.d') => a.b.c.d

    Resolves a dotted attribute name to an object.  Raises
    an AttributeError if any attribute in the chain starts with a '_'.

    If the optional allow_dotted_names argument is false, dots are not
    supported and this function operates similar to getattr(obj, attr).
    �.�_z(attempt to access private attribute "%s")�split�
startswith�AttributeError�getattr)�obj�attr�allow_dotted_names�attrs�is     �4/opt/alt/python312/lib64/python3.12/xmlrpc/server.py�resolve_dotted_attributer|sZ����
�
�3������
���<�<��� �:�Q�>��
��#�a�.�C�
��J�c	��t|�D�cgc]*}|jd�stt||��r|��,c}Scc}w)zkReturns a list of attribute strings, found in the specified
    object, which represent callable attributesr
)�dirr�callabler)r�members  r�list_public_methodsr�sH��"%�S��4��v��(�(��-��W�S�&�1�2�
��4�4��4s�/Ac�^�eZdZdZ		dd�Zdd�Zdd�Zd�Zd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zy)�SimpleXMLRPCDispatchera&Mix-in class that dispatches XML-RPC requests.

    This class is used to register XML-RPC method handlers
    and then to dispatch them. This class doesn't need to be
    instanced directly when used by SimpleXMLRPCServer but it
    can be instanced when used by the MultiPathXMLRPCServer
    Nc�R�i|_d|_||_|xsd|_||_y�N�utf-8)�funcs�instance�
allow_none�encoding�use_builtin_types��selfr&r'r(s    r�__init__zSimpleXMLRPCDispatcher.__init__�s+����
���
�$��� �+�G��
�!2��rc� �||_||_y)aRegisters an instance to respond to XML-RPC requests.

        Only one instance can be installed at a time.

        If the registered instance has a _dispatch method then that
        method will be called with the name of the XML-RPC method and
        its parameters as a tuple
        e.g. instance._dispatch('add',(2,3))

        If the registered instance does not have a _dispatch method
        then the instance will be searched to find a matching method
        and, if found, will be called. Methods beginning with an '_'
        are considered private and will not be called by
        SimpleXMLRPCServer.

        If a registered function matches an XML-RPC request, then it
        will be called instead of the registered instance.

        If the optional allow_dotted_names argument is true and the
        instance does not have a _dispatch method, method names
        containing dots are supported and resolved, as long as none of
        the name segments start with an '_'.

            *** SECURITY WARNING: ***

            Enabling the allow_dotted_names options allows intruders
            to access your module's global variables and may allow
            intruders to execute arbitrary code on your machine.  Only
            use this option on a secure, closed network.

        N)r%r)r*r%rs   r�register_instancez(SimpleXMLRPCDispatcher.register_instance�s��B!��
�"4��rc�r�|�t|j|��S|�|j}||j|<|S)z�Registers a function to respond to XML-RPC requests.

        The optional name argument can be used to set a Unicode name
        for the function.
        )�name)r	�register_function�__name__r$)r*�functionr/s   rr0z(SimpleXMLRPCDispatcher.register_function�s@�����4�1�1��=�=��<��$�$�D�#��
�
�4���rc�~�|jj|j|j|jd��y)z�Registers the XML-RPC introspection methods in the system
        namespace.

        see http://xmlrpc.usefulinc.com/doc/reserved.html
        )zsystem.listMethodszsystem.methodSignaturezsystem.methodHelpN)r$�update�system_listMethods�system_methodSignature�system_methodHelp�r*s r� register_introspection_functionsz7SimpleXMLRPCDispatcher.register_introspection_functions�s7��	
�
�
���$�2I�2I�15�1L�1L�,0�,B�,B�D�	Erc�R�|jjd|ji�y)z�Registers the XML-RPC multicall method in the system
        namespace.

        see http://www.xmlrpc.com/discuss/msgReader$1208zsystem.multicallN)r$r4�system_multicallr8s r�register_multicall_functionsz3SimpleXMLRPCDispatcher.register_multicall_functions�s"��	
�
�
���-��0E�0E�F�Grc	��	t||j��\}}|�
|||�}n|j||�}|f}t|d|j|j
��}|j|j
d�S#t$r,}t||j|j
��}Yd}~�Ld}~wt$rD}tt
dt|��d|���|j
|j��}Yd}~��d}~wwxYw)	a�Dispatches an XML-RPC method from marshalled (XML) data.

        XML-RPC methods are dispatched from the marshalled (XML) data
        using the _dispatch method and the result is returned as
        marshalled data. For backwards compatibility, a dispatch
        function can be provided as an argument (see comment in
        SimpleXMLRPCRequestHandler.do_POST) but overriding the
        existing method through subclassing is the preferred means
        of changing method dispatch behavior.
        )r(N�)�methodresponser&r')r&r'�:�r'r&�xmlcharrefreplace)
rr(�	_dispatchrr&r'r�
BaseException�type�encode)	r*�data�dispatch_method�path�params�method�response�fault�excs	         r�_marshaled_dispatchz*SimpleXMLRPCDispatcher._marshaled_dispatch�s���	�"�4�4�;Q�;Q�R�N�F�F��*�*�6�6�:���>�>�&�&�9�� �{�H��X�a�(,���$�-�-�Q�H����t�}�}�.A�B�B���	5��U�t���&*�m�m�5�H���	���a�D��I�s�3�4����4�?�?��H��	�s$�AA<�<	C<�"B,�,C<�8:C7�7C<c�r�t|jj��}|j�~t	|jd�r1|t|jj��z}t|�St	|jd�s!|tt
|j��z}t|�S)zwsystem.listMethods() => ['add', 'subtract', 'multiple']

        Returns a list of the methods supported by the server.�_listMethodsrC)�setr$�keysr%�hasattrrQr�sorted)r*�methodss  rr5z)SimpleXMLRPCDispatcher.system_listMethodss���
�d�j�j�o�o�'�(���=�=�$��t�}�}�n�5��3�t�}�}�9�9�;�<�<���g����T�]�]�K�8��3�2�4�=�=�A�B�B���g��rc��y)a#system.methodSignature('add') => [double, int, int]

        Returns a list describing the signature of the method. In the
        above example, the add method takes two integers as arguments
        and returns a double result.

        This server does NOT support system.methodSignature.zsignatures not supported�)r*�method_names  rr6z-SimpleXMLRPCDispatcher.system_methodSignature)s��*rc�z�d}||jvr|j|}nu|j�it|jd�r|jj|�St|jd�s"	t	|j||j
�}|�ytj|�S#t$rY�#wxYw)z�system.methodHelp('add') => "Adds two integers together"

        Returns a string containing documentation for the specified method.N�_methodHelprC�)	r$r%rTr[rrr�pydoc�getdoc)r*rYrKs   rr7z(SimpleXMLRPCDispatcher.system_methodHelp6s���
���$�*�*�$��Z�Z��,�F�
�]�]�
&��t�}�}�m�4��}�}�0�0��=�=��T�]�]�K�8��5� $�
�
� +� $� 7� 7�"�F��>���<�<��'�'��&����s�5!B.�.	B:�9B:c�T�g}|D]/}|d}|d}	|j|j||�g��1|S#t$r2}|j|j|jd��Yd}~�jd}~wt
$r,}|jdt
|��d|��d��Yd}~��d}~wwxYw)z�system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => [[4], ...]

        Allows the caller to package multiple XML-RPC calls into a single
        request.

        See http://www.xmlrpc.com/discuss/msgReader$1208
        �
methodNamerJ)�	faultCode�faultStringNr>r@)�appendrCrrarbrDrE)r*�	call_list�results�callrYrJrMrNs        rr;z'SimpleXMLRPCDispatcher.system_multicallUs������D��|�,�K��(�^�F�

�������{�F� C�D�E��$����
����#(�?�?�%*�%6�%6�8����!�
����#$�04�S�	�3�%?�A����
�s!�"9�	B'�(A/�/B'�;"B"�"B'c�r�	|j|}|�||�Std|z��#t$rYnwxYw|j�jt	|jd�r|jj||�S	t
|j||j�}|�||�S#t$rYnwxYwtd|z��)a�Dispatches the XML-RPC method.

        XML-RPC calls are forwarded to a registered function that
        matches the called XML-RPC method name. If no such function
        exists then the call is forwarded to the registered instance,
        if available.

        If the registered instance has a _dispatch method then that
        method will be called with the name of the XML-RPC method and
        its parameters as a tuple
        e.g. instance._dispatch('add',(2,3))

        If the registered instance does not have a _dispatch method
        then the instance will be searched to find a matching method
        and, if found, will be called.

        Methods beginning with an '_' are considered private and will
        not be called.
        zmethod "%s" is not supportedrC)	r$�	Exception�KeyErrorr%rTrCrrr)r*rKrJ�funcs    rrCz SimpleXMLRPCDispatcher._dispatchts���*	E��:�:�f�%�D����V�}�$��:�V�C�D�D���	��	���=�=�$��t�}�}�k�2��}�}�.�.�v�v�>�>�

)�/��M�M���+�+����#���=�(��	"�
��
���6��?�@�@s�&�	2�2�4!B�	B(�'B(�FNF)F�NN)r1�
__module__�__qualname__�__doc__r+r-r0r9r<rOr5r6r7r;rCrXrrr r �sL���37�#(�3�"5�H� 	E�H�!C�F�$*�(�>�>1Arr c��eZdZdZdZdZdZdZejdejejz�Zd�Z
d�Zd	�Zd
�Zd�Zdd�Zy
)�SimpleXMLRPCRequestHandlerz�Simple XML-RPC request handler class.

    Handles all HTTP POST requests and attempts to decode them as
    XML-RPC requests.
    )�/z/RPC2�
/pydoc.cssix���Tz�
                            \s* ([^\s;]+) \s*            #content-coding
                            (;\s* q \s*=\s* ([0-9\.]+))? #q
                            c��i}|jjdd�}|jd�D]T}|jj	|�}|s�!|jd�}|rt
|�nd}|||jd�<�V|S)NzAccept-Encodingr\�,�g�?r>)�headers�getr�	aepattern�match�group�float)r*�r�ae�er{�vs      r�accept_encodingsz+SimpleXMLRPCRequestHandler.accept_encodings�sz����
�\�\�
�
�/��
4�����#��A��N�N�(�(��+�E���K�K��N�� !�E�!�H�s��$%��%�+�+�a�.�!���rc�L�|jr|j|jvSy)NT)�	rpc_pathsrIr8s r�is_rpc_path_validz,SimpleXMLRPCRequestHandler.is_rpc_path_valid�s!���>�>��9�9����.�.�rc�>�|j�s|j�y	d}t|jd�}g}|rOt	||�}|j
j
|�}|sn%|j|�|t|d�z}|r�Odj|�}|j|�}|�y|jj|t|dd�|j�}|jd�|j!dd	�|j"�Xt|�|j"kDr@|j%�j'd
d�}|r	t)|�}|j!dd
�|j!d
t-t|���|j/�|j0j3|�y#t*$rY�[wxYw#t4$r�}	|jd�t7|jd�rs|jj8r]|j!dt-|	��t;j<�}
t-|
j?dd�d�}
|j!d|
�|j!d
d�|j/�Yd}	~	yd}	~	wwxYw)z�Handles the HTTP POST request.

        Attempts to interpret all HTTP POST requests as XML-RPC calls,
        which are forwarded to the server's _dispatch method for handling.
        Ni�zcontent-lengthrtrrC���Content-typeztext/xml�gziprzContent-Encoding�Content-lengthi��_send_traceback_headerzX-exception�ASCII�backslashreplacezX-traceback�0) r��
report_404�intrx�min�rfile�readrc�len�join�decode_request_content�serverrOrrI�
send_response�send_header�encode_thresholdr�ryr�NotImplementedError�str�end_headers�wfile�writerhrTr��	traceback�
format_excrF)r*�max_chunk_size�size_remaining�L�
chunk_size�chunkrGrL�qr��traces           r�do_POSTz"SimpleXMLRPCRequestHandler.do_POST�sM���%�%�'��O�O���9	'�
*�N� ����.>�!?�@�N��A� � ���@�
��
�
���
�3����������#�a��e�*�,��
!��8�8�A�;�D��.�.�t�4�D��|���{�{�6�6��'�$��T�:�D�I�I��H�$
���s�#����^�Z�8��$�$�0��x�=�4�#8�#8�8��-�-�/�3�3�F�A�>�A��!�'2�8�'<�H� �,�,�-?��H�
���-�s�3�x�=�/A�B������J�J���X�&��	 3�!� �!��1�
	����s�#��t�{�{�$<�=��K�K�6�6�� � ���A��7�!�,�,�.���E�L�L��2D�E�w�O��� � ���6����-�s�3�������
	�s7�A,G
�$G
�52G
�F>�>	G
�	G
�
	J�B<J�Jc�v�|jjdd�j�}|dk(r|S|dk(r	t|�S|jdd|z�|jdd	�|j�y#t$r|jdd|z�Y�Ct$r|jdd�Y�_wxYw)
Nzcontent-encoding�identityr�i�zencoding %r not supported�zerror decoding gzip contentr�r�)	rxry�lowerrr�r��
ValueErrorr�r�)r*rGr's   rr�z1SimpleXMLRPCRequestHandler.decode_request_contents����<�<�#�#�$6�
�C�I�I�K���z�!��K��v��
G�"�4�(�(�
���s�$?�(�$J�K����)�3�/������'�
P��"�"�3�(C�h�(N�O��
G��"�"�3�(E�F�
G�s�
A;�;B8�B8�7B8c���|jd�d}|jdd�|jdtt|���|j	�|j
j
|�y)Ni�sNo such pager�z
text/plainr�)r�r�r�r�r�r�r��r*rLs  rr�z%SimpleXMLRPCRequestHandler.report_404*s]�����3��"�������6����)�3�s�8�}�+=�>������
�
����"rc�`�|jjrtj|||�yy)z$Selectively log an accepted request.N)r��logRequestsr�log_request)r*�code�sizes   rr�z&SimpleXMLRPCRequestHandler.log_request3s(���;�;�"�"�"�.�.�t�T�4�@�#rN)�-r�)r1rmrnror�r��wbufsize�disable_nagle_algorithm�re�compile�VERBOSE�
IGNORECASErzr�r�r�r�r�r�rXrrrqrq�sm���-�I����H�"����
�
� �"$���b�m�m�!;�=�I�
	��E'�N�"#�Arrqc�,�eZdZdZdZdZedddddfd�Zy)�SimpleXMLRPCServeragSimple XML-RPC server.

    Simple XML-RPC server that allows functions and a single instance
    to be installed to handle requests. The default implementation
    attempts to dispatch XML-RPC calls to the functions or instance
    installed in the server. Override the _dispatch method inherited
    from SimpleXMLRPCDispatcher to change this behavior.
    TFNc��||_tj||||�tjj||||�y�N)r�r r+�socketserver�	TCPServer�r*�addr�requestHandlerr�r&r'�bind_and_activater(s        rr+zSimpleXMLRPCServer.__init__Ls<��'����'�'��j�(�DU�V����'�'��d�N�DU�Vr)r1rmrnro�allow_reuse_addressr�rqr+rXrrr�r�9s,�����#��,F�!�e�d�#'�5�Wrr�c�8�eZdZdZedddddfd�Zd�Zd�Zd	d�Zy)
�MultiPathXMLRPCServera\Multipath XML-RPC Server
    This specialization of SimpleXMLRPCServer allows the user to create
    multiple Dispatcher instances and assign them to different
    HTTP request paths.  This makes it possible to run two or more
    'virtual XML-RPC servers' at the same port.
    Make sure that the requestHandler accepts the paths in question.
    TFNc
�n�tj||||||||�i|_||_|xsd|_yr")r�r+�dispatchersr&r'r�s        rr+zMultiPathXMLRPCServer.__init__]sA��	�#�#�D�$���Z�$,�.?�AR�	T����$��� �+�G��
rc�$�||j|<|Sr��r�)r*rI�
dispatchers   r�add_dispatcherz$MultiPathXMLRPCServer.add_dispatchergs��!+�������rc� �|j|Sr�r�)r*rIs  r�get_dispatcherz$MultiPathXMLRPCServer.get_dispatcherks������%�%rc	�"�	|j|j|||�}|S#t$ra}tt	dt|��d|���|j|j��}|j|jd�}Yd}~|Sd}~wwxYw)Nr>r@rArB)	r�rOrDrrrEr'r&rF)r*rGrHrIrLrNs      rrOz)MultiPathXMLRPCServer._marshaled_dispatchns���
	K��'�'��-�A�A��_�d�,�H�����	K���a�D��I�s�3�4����4�?�?�D�H� ���t�}�}�6I�J�H����	K�s� $�	B�AB	�	Brl)	r1rmrnrorqr+r�r�rOrXrrr�r�Us-���-G�!�e�d�#'�5�,��&�rr�c�,�eZdZdZdd�Zd�Zd�Zdd�Zy)	�CGIXMLRPCRequestHandlerz3Simple handler for XML-RPC data passed through CGI.Nc�4�tj||||�yr�)r r+r)s    rr+z CGIXMLRPCRequestHandler.__init__s���'�'��j�(�DU�Vrc�\�|j|�}td�tdt|�z�t�tjj�tjjj|�tjjj�y)zHandle a single XML-RPC requestzContent-Type: text/xml�Content-Length: %dN)rO�printr��sys�stdout�flush�bufferr�)r*�request_textrLs   r�
handle_xmlrpcz%CGIXMLRPCRequestHandler.handle_xmlrpc�sr���+�+�L�9��
�&�'�
�"�S��]�2�3�
���
�
�����
�
������)��
�
�����!rc�$�d}tj|\}}tjj|||d�z}|jd�}t
d||fz�t
dtjjz�t
dt|�z�t
�tjj�tjjj|�tjjj�y)z�Handle a single HTTP GET request.

        Default implementation indicates an error because
        XML-RPC uses the POST method.
        r�)r��message�explainr#z
Status: %d %szContent-Type: %sr�N)r�	responses�httpr��DEFAULT_ERROR_MESSAGErFr��DEFAULT_ERROR_CONTENT_TYPEr�r�r�r�r�r�)r*r�r�r�rLs     r�
handle_getz"CGIXMLRPCRequestHandler.handle_get�s�����1�;�;�D�A�����;�;�4�4�� � �
����?�?�7�+��
�o��w��/�0�
� �4�;�;�#I�#I�I�J�
�"�S��]�2�3�
���
�
�����
�
������)��
�
�����!rc�V�|�4tjjdd�dk(r|j�y	t	tjjdd��}|�tjj|�}|j|�y#t
tf$rd}Y�FwxYw)z�Handle a single XML-RPC request passed through a CGI post method.

        If no XML data is given then it is read from stdin. The resulting
        XML-RPC response is printed to stdout along with the correct HTTP
        headers.
        N�REQUEST_METHOD�GET�CONTENT_LENGTHrt)�os�environryr�r�r��	TypeErrorr��stdinr�r�)r*r��lengths   r�handle_requestz&CGIXMLRPCRequestHandler.handle_request�s������J�J�N�N�+�T�2�e�;��O�O��
��R�Z�Z�^�^�,<�d�C�D���#�"�y�y�~�~�f�5�����|�,���	�*�
���
�s�)B�B(�'B(rkr�)r1rmrnror+r�r�r�rXrrr�r�|s��=�W�
"�"�2-rr�c�>�eZdZdZdiiifd�Zdiiidfd�Zd�Zd�Zy)�
ServerHTMLDocz7Class used to generate pydoc HTML document for a serverNc�|�|xs|j}g}d}tjd�}|j||�x}	�rT|	j	�\}
}|j||||
��|	j
�\}}
}}}}|
r1||�jdd�}|jd|�d|�d��n�|r-dt|�z}|jd|�d||��d��n�|r-d	t|�z}|jd|�d||��d��ng|||d
zdk(r$|j|j||||��n8|r|jd|z�n!|j|j||��|}|j||�x}	r��T|j|||d
��dj|�S)z�Mark up some plain text, given a context of symbols to look for.
        Each context dictionary maps object names to anchor names.rzS\b((http|https|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?((?:\w|\.)+))\b�"z&quot;z	<a href="z">z</a>z(https://www.rfc-editor.org/rfc/rfc%d.txtz!https://peps.python.org/pep-%04d/r>�(zself.<strong>%s</strong>Nr\)�escaper�r��search�spanrc�groups�replacer��namelinkr�)r*�textr�r$�classesrVre�here�patternr{�start�end�all�scheme�rfc�pep�selfdotr/�urls                   r�markupzServerHTMLDoc.markup�s����&�4�;�;�������*�*�<�=���~�~�d�D�1�1�e�1�����J�E�3��N�N�6�$�t�E�"2�3�4�38�<�<�>�0�C���c�7�D���S�k�)�)�#�x�8������S�A�B��@�3�s�8�K������V�C�[�I�J��9�C��H�D������V�C�[�I�J��c�#�a�%��C�'����t�}�}�T�7�E�7�K�L�����9�D�@�A����t�}�}�T�7�;�<��D�)�~�~�d�D�1�1�e�1�*	���v�d�4�5�k�*�+��w�w�w��rc���|xr|jxsddz|z}d}	d|j|��d|j|��d�}
t|�rtt	|��}nd}t|t�r|dxs|}|dxsd}ntj|�}|
|z|	xr|jd	|	z�z}
|j||j|||�}|xrd
|z}d|
�d|�d
�S)z;Produce HTML documentation for a function or method object.r\r�z	<a name="z
"><strong>z
</strong></a>z(...)rr>z'<font face="helvetica, arial">%s</font>z<dd><tt>%s</tt></dd>z<dl><dt>z</dt>z</dl>
)r1r�rr�r
�
isinstance�tupler]r^�greyr�	preformat)r*�objectr/�modr$r�rV�cl�anchor�note�title�argspec�	docstring�decl�docs               r�
docroutinezServerHTMLDoc.docroutine�s����$����*��c�1�D�8����
�K�K������T�!2�4���F���)�F�+�,�G��G��f�e�$��Q�i�*�7�G��q�	��R�I����V�,�I��w��$�#A�4�9�9�8�4�?�,A�B���k�k��t�~�~�u�g�w�@���2�,�s�2��-1�3�7�7rc���i}|j�D]\}}d|z||<||||<�|j|�}d|z}|j|�}|j||j|�}	|	xrd|	z}	|d|	zz}g}
t|j��}|D](\}}|
j
|j|||����*||jdddj|
��z}|S)	z1Produce HTML documentation for an XML-RPC server.z#-z)<big><big><strong>%s</strong></big></big>z<tt>%s</tt>z
<p>%s</p>
)r$�Methods�	functionsr\)
�itemsr��headingrr
rUrcr�
bigsectionr�)r*�server_name�package_documentationrV�fdict�key�value�head�resultr�contents�method_itemss            r�	docserverzServerHTMLDoc.docservers�����!�-�-�/�J�C�����E�#�J� ��:�E�%�L�*��k�k�+�.��:�[�H�����d�#���k�k�/�����G���)�m�c�)���-�#�-�-�����g�m�m�o�.��&�J�C���O�O�D�O�O�E�3�e�O�D�E�'��$�/�/��{�B�G�G�H�$5�7�7���
rc�(�d}d|z}d|�d|�d|�d�S)zFormat an HTML page.rsz1<link rel="stylesheet" type="text/css" href="%s">zI<!DOCTYPE>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Python: z	</title>
z
</head><body>z</body></html>rX)r*rr&�css_path�css_links     r�pagezServerHTMLDoc.page"s,����?��
�	�',�X�x�
A�	Ar)r1rmrnrorrr(r,rXrrr�r��s2��A�"&�b�"�b�% �N,0��R���8�:�4Arr�c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�XMLRPCDocGeneratorz�Generates documentation for an XML-RPC server.

    This class is designed as mix-in and should not
    be constructed directly.
    c�.�d|_d|_d|_y)NzXML-RPC Server DocumentationzGThis server exports the following methods through the XML-RPC protocol.)r�server_documentation�server_titler8s rr+zXMLRPCDocGenerator.__init__7s!��9���
�	
�!�;��rc��||_y)z8Set the HTML title of the generated server documentationN)r1)r*r1s  r�set_server_titlez#XMLRPCDocGenerator.set_server_title?s��)��rc��||_y)z7Set the name of the generated HTML server documentationN)r)r*rs  r�set_server_namez"XMLRPCDocGenerator.set_server_nameDs��'��rc��||_y)z3Set the documentation string for the entire server.N)r0)r*r0s  r�set_server_documentationz+XMLRPCDocGenerator.set_server_documentationIs��%9��!rc���i}|j�D]�}||jvr|j|}n�|j��ddg}t|jd�r|jj	|�|d<t|jd�r|jj|�|d<t
|�}|dk7r|}n1t|jd�s	t|j|�}n|}	||<��t�}|j|j|j|�}|jtj|j �|�S#t$r|}Y�twxYw)agenerate_html_documentation() => html documentation for the server

        Generates HTML documentation for the server using introspection for
        installed functions and instances that do not implement the
        _dispatch method. Alternatively, instances can choose to implement
        the _get_method_argstring(method_name) method to provide the
        argument string used in the documentation and the
        _methodHelp(method_name) method to provide the help text used
        in the documentation.N�_get_method_argstringrr[r>rlrC)r5r$r%rTr9r[rrrr�r(rr0r,�htmlr�r1)r*rVrYrK�method_info�
documenter�
documentations       r�generate_html_documentationz.XMLRPCDocGenerator.generate_html_documentationNsM�����2�2�4�K��d�j�j�(����K�0�����*�#�T�l���4�=�=�*A�B�%)�]�]�%H�%H��%U�K��N��4�=�=�-�8�%)�]�]�%>�%>�{�%K�K��N�#�K�0���,�.�(�F� �����<�-�!9�$(�M�M�$/�"&��)�F�
$*�G�K� �75�:#�_�
�"�,�,� $� 0� 0� $� 9� 9� '��
����t�{�{�4�+<�+<�=�}�M�M��#*�-�!,��-�s�E�E%�$E%N)	r1rmrnror+r3r5r7r>rXrrr.r.0s!���;�)�
'�
9�
1Nrr.c��eZdZdZd�Zd�Zy)�DocXMLRPCRequestHandlerz�XML-RPC and documentation request handler class.

    Handles all HTTP POST requests and attempts to decode them as
    XML-RPC requests.

    Handles all HTTP GET requests and interprets them as requests
    for documentation.
    c�,�tjjtjjt��}tjj|ddd�}t
|d��5}|j�cddd�S#1swYyxYw)Nz..�
pydoc_dataz
_pydoc.css�rb)�mode)r�rI�dirname�realpath�__file__r��openr�)r*r�	path_herer*�fps     r�_get_cssz DocXMLRPCRequestHandler._get_css�sa���G�G�O�O�B�G�G�$4�$4�X�$>�?�	��7�7�<�<�	�4��|�L��
�(��
&�"��7�7�9�	�	�
&�
&�s�0B
�
Bc��|j�s|j�y|jjd�rd}|j	|j�}n+d}|j
j
�jd�}|jd�|jdd|z�|jd	tt|���|j�|jj|�y)
�}Handles the HTTP GET request.

        Interpret all HTTP GET requests as requests for server
        documentation.
        Nz.cssztext/cssz	text/htmlr#r�zContent-Typez%s; charset=UTF-8r�)r�r�rI�endswithrKr�r>rFr�r�r�r�r�r�r�)r*�content_typerLs   r�do_GETzDocXMLRPCRequestHandler.do_GET�s����%�%�'��O�O����9�9���f�%�%�L��}�}�T�Y�Y�/�H�&�L��{�{�>�>�@�G�G��P�H����3������)<�|�)K�L����)�3�s�8�}�+=�>������
�
����"rN)r1rmrnrorKrPrXrrr@r@�s����#rr@c�$�eZdZdZedddddfd�Zy)�DocXMLRPCServerz�XML-RPC and HTML documentation server.

    Adds the ability to serve server documentation to the capabilities
    of SimpleXMLRPCServer.
    TFNc
�f�tj||||||||�tj|�yr�)r�r+r.r�s        rr+zDocXMLRPCServer.__init__�s5��	�#�#�D�$���$.��:K�$5�	7�	�#�#�D�)r)r1rmrnror@r+rXrrrRrR�s���-D�!�e�d�#'�5�*rrRc��eZdZdZd�Zd�Zy)�DocCGIXMLRPCRequestHandlerzJHandler for XML-RPC data and documentation requests passed through
    CGIc�x�|j�jd�}td�tdt|�z�t�tj
j
�tj
jj|�tj
jj
�y)rMr#zContent-Type: text/htmlr�N)	r>rFr�r�r�r�r�r�r�r�s  rr�z%DocCGIXMLRPCRequestHandler.handle_get�s{���3�3�5�<�<�W�E��
�'�(�
�"�S��]�2�3�
���
�
�����
�
������)��
�
�����!rc�X�tj|�tj|�yr�)r�r+r.r8s rr+z#DocCGIXMLRPCRequestHandler.__init__�s���(�(��.��#�#�D�)rN)r1rmrnror�r+rXrrrUrU�s���"� *rrU�__main__c�&�eZdZd�ZGd�d�Zy)�ExampleServicec��y)N�42rXr8s r�getDatazExampleService.getData�s��rc��eZdZed��Zy)�ExampleService.currentTimec�>�tjj�Sr�)�datetime�nowrXrr�getCurrentTimez)ExampleService.currentTime.getCurrentTime�s���(�(�,�,�.�.rN)r1rmrn�staticmethodrcrXrr�currentTimer_�s��
�
/��
/rreN)r1rmrnr]rerXrrrZrZ�s��	�	/�	/rrZ)�	localhosti@c��||zSr�rX)�x�ys  r�<lambda>rj�s��Q�q�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)1ro�
xmlrpc.clientrrrrr�http.serverr�	functoolsr	�inspectr
r:r�r�r�r�r�r]r��fcntl�ImportErrorrrr rqr�r�r�r��HTMLDocr�r.r@rRrUr1rarZr�r0�powr-r<r��
serve_forever�KeyboardInterrupt�exitrXrr�<module>rws���e�TH�G�.������
�	�	������04�IA�IA�VPA�!7�PA�dW��/�/�/�W�8%�.�%�N?-�4�?-�JmA�E�M�M�mA�^ON�ON�b&#�8�&#�P*�*�*�*� *�$;�$6�*�4�z���/�/�
�/�	0�F�� � ��%�� � ��%�8�� � ��!1�d� �K��+�+�-�
�6�7�
�[�\�	�� � �"�
1�	0���u���E���^!�	��;�<��C�H�H�Q�K�	��
1�	0�s=�E%�-AF�E3�%E0�/E0�3F�F�F�F�F!

Hacked By AnonymousFox1.0, Coded By AnonymousFox