
bc           @   s  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Td d l Z d d l Z d d l Z y d d l	 Z	 Wn e
 k
 r d Z	 n Xy e Wn e k
 r d Z n Xy d d l Z Wn e
 k
 r d Z n Xy e j j d k Z Wn e k
 r	d Z n Xe j d  j d  Z e j d  Z e rCd	   Z n	 d
   Z d Z dX Z dZ Z d Z d Z d Z d Z d Z  d Z! d Z" d Z# d Z$ d Z% d Z& d Z' d e( f d     YZ) d e) f d     YZ* d e) f d     YZ+ d e) f d      YZ, d d! l- m. Z. e. e j/ Z0 e rBe1 Z2 Z3 e4 e0 d" <e e0 d# <nE d$ d[ d%     YZ3 e3 d  e0 d" <e3 d  e0 d# <e e4 f d&  Z2 [. [0 d'   Z5 d( d\ d)     YZ6 d*   Z7 d+   Z8 d d l9 Z9 y d d l: Z; Wn e
 k
 rd d l; Z; n Xd, d] d-     YZ< d.   Z= e6 e< f Z> e s5e> e3 f Z> n  y" d d l? Z? e? j@ ZA e? jB ZC Wn! eD e
 f k
 rzd ZA ZC n Xy d d l? Z? e? jE ZF Wn eD e
 f k
 rd ZF n Xy, d d/ lG mH ZH eI eH d0  se
  n  Wn e
 k
 rd ZJ n Xd1 d^ d2     YZJ d3 d_ d4     YZK d5 d` d6     YZE d7 da d8     YZB d9 db d:     YZL d; dc d<     YZM d= dd d>     YZN d d?  ZO d d d d d@  ZP d dA  ZQ dB   ZR dC dD  ZS dE e	 re	 jT n eU f dF     YZV dG de dH     YZW dI df dJ     YZX dK eX f dL     YZY dM dg dN     YZZ eZ Z[ e dO k reZ dP  Z\ e\ GHeN e\  Z] e] j^ dQ dR  e] j_ dS d  e] j_ dT dU  y x e]   D] Z` e` GHqWWqe) k
 rZa dV Gea GHqXn  d S(h   s~  
An XML-RPC client interface for Python.

The marshalling and response parser code can also be used to
implement XML-RPC servers.

Exported exceptions:

  Error          Base class for client errors
  ProtocolError  Indicates an HTTP protocol error
  ResponseError  Indicates a broken response package
  Fault          Indicates an XML-RPC fault package

Exported classes:

  ServerProxy    Represents a logical connection to an XML-RPC server

  MultiCall      Executor of boxcared xmlrpc requests
  Boolean        boolean wrapper to generate a "boolean" XML-RPC value
  DateTime       dateTime wrapper for an ISO 8601 string or time tuple or
                 localtime integer value to generate a "dateTime.iso8601"
                 XML-RPC value
  Binary         binary data wrapper

  SlowParser     Slow but safe standard parser (based on xmllib)
  Marshaller     Generate an XML-RPC params chunk from a Python data structure
  Unmarshaller   Unmarshal an XML-RPC response from incoming XML event message
  Transport      Handles an HTTP transaction to an XML-RPC server
  SafeTransport  Handles an HTTPS transaction to an XML-RPC server

Exported constants:

  True
  False

Exported functions:

  boolean        Convert any Python value to an XML-RPC boolean
  getparser      Create instance of the fastest available parser & attach
                 to an unmarshalling object
  dumps          Convert an argument tuple or a Fault instance to an XML-RPC
                 request (or response, if the methodresponse option is used).
  loads          Convert an XML-RPC packet to unmarshalled data plus a method
                 name (None if not present).
iN(   t   *t   booli    s   [-]c         C   s.   t  r* | r* | |   r* t  |  |  }  n  |  S(   N(   t   unicode(   t   datat   encodingt   is8bit(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   _decode   s    c         C   s4   | |  d d  }  | |  d d  }  | |  d d  S(   Nt   &s   &amp;t   <s   &lt;t   >s   &gt;(    (   t   st   replace(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   escape   s    c         C   s*   y |  j  d  SWn t k
 r% |  SXd  S(   Nt   ascii(   t   encodet   UnicodeError(   t   string(    (    s   /usr/lib/python2.7/xmlrpclib.pyt
   _stringify   s    c         C   s   |  S(   N(    (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR      s    s   1.0.1l    i   i   iDiiipiԁiCiBiiit   Errorc           B   s   e  Z d  Z d   Z RS(   s   Base class for client errors.c         C   s
   t  |   S(   N(   t   repr(   t   self(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __str__   s    (   t   __name__t
   __module__t   __doc__R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR      s   t   ProtocolErrorc           B   s    e  Z d  Z d   Z d   Z RS(   s!   Indicates an HTTP protocol error.c         C   s5   t  j |   | |  _ | |  _ | |  _ | |  _ d  S(   N(   R   t   __init__t   urlt   errcodet   errmsgt   headers(   R   R   R   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR      s
    			c         C   s   d |  j  |  j |  j f S(   Ns   <ProtocolError for %s: %s %s>(   R   R   R   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __repr__   s    (   R   R   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR      s   	t   ResponseErrorc           B   s   e  Z d  Z RS(   s$   Indicates a broken response package.(   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR      s   t   Faultc           B   s    e  Z d  Z d   Z d   Z RS(   s#   Indicates an XML-RPC fault package.c         K   s#   t  j |   | |  _ | |  _ d  S(   N(   R   R   t	   faultCodet   faultString(   R   R"   R#   t   extra(    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    	c         C   s   d |  j  t |  j  f S(   Ns   <Fault %s: %s>(   R"   R   R#   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    (   R   R   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR!     s   	(   t   modulest   Truet   Falset   Booleanc           B   sG   e  Z d  Z d d  Z d   Z d   Z d   Z d   Z d   Z RS(   sa   Boolean-value wrapper.

        Use True or False to generate a "boolean" XML-RPC value.
        i    c         C   s   t  j |  |  _ d  S(   N(   t   operatort   trutht   value(   R   R+   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR   3  s    c         C   s   | j  d |  j  d  S(   Ns%   <value><boolean>%d</boolean></value>
(   t   writeR+   (   R   t   out(    (    s   /usr/lib/python2.7/xmlrpclib.pyR   6  s    c         C   s+   t  | t  r | j } n  t |  j |  S(   N(   t
   isinstanceR(   R+   t   cmp(   R   t   other(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __cmp__9  s    c         C   s)   |  j  r d t |   Sd t |   Sd  S(   Ns   <Boolean True at %x>s   <Boolean False at %x>(   R+   t   id(   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR   >  s    	c         C   s   |  j  S(   N(   R+   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __int__D  s    c         C   s   |  j  S(   N(   R+   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __nonzero__G  s    (	   R   R   R   R   R   R1   R   R3   R4   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR(   -  s   				c         C   s   | t  j |   S(   s.   Convert any Python value to XML-RPC 'boolean'.(   R)   R*   (   R+   t
   _truefalse(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   booleanX  s    c         C   s   t  rG t |  t  j   rG d |  j |  j |  j |  j |  j |  j f Sn  t |  t t	 j
 f  s |  d k rz t	 j	   }  n  t	 j |   }  n  d |  d  S(   Ns   %04d%02d%02dT%02d:%02d:%02di    i   (   t   datetimeR.   t   yeart   montht   dayt   hourt   minutet   secondt	   TupleTypet   timet   struct_timet	   localtime(   R+   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt	   _strftimek  s    t   DateTimec           B   s   e  Z d  Z d d  Z d   Z d   Z d   Z d   Z d   Z d   Z	 d	   Z
 d
   Z d   Z d   Z d   Z d   Z d   Z RS(   s   DateTime wrapper for an ISO 8601 string or time tuple or
    localtime integer value to generate 'dateTime.iso8601' XML-RPC
    value.
    i    c         C   s.   t  | t  r | |  _ n t |  |  _ d  S(   N(   R.   t
   StringTypeR+   RB   (   R   R+   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    c         C   s   t  | t  r$ |  j } | j } n t rW t  | t j  rW |  j } | j d  } n t  | t  rx |  j } | } nm t | d  r |  j   } | j   } nC t | d  r | j j	 p t
 |  } t d |  j j	 | f   | | f S(   Ns   %Y%m%dT%H:%M:%St	   timetuplet	   __class__s   Can't compare %s and %s(   R.   RC   R+   R7   t   strftimet
   basestringt   hasattrRE   RF   R   t   typet	   TypeError(   R   R0   R
   t   ot   otype(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   make_comparable  s$    				c         C   s   |  j  |  \ } } | | k  S(   N(   RN   (   R   R0   R
   RL   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __lt__  s    c         C   s   |  j  |  \ } } | | k S(   N(   RN   (   R   R0   R
   RL   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __le__  s    c         C   s   |  j  |  \ } } | | k S(   N(   RN   (   R   R0   R
   RL   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __gt__  s    c         C   s   |  j  |  \ } } | | k S(   N(   RN   (   R   R0   R
   RL   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __ge__  s    c         C   s   |  j  |  \ } } | | k S(   N(   RN   (   R   R0   R
   RL   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __eq__  s    c         C   s   |  j  |  \ } } | | k S(   N(   RN   (   R   R0   R
   RL   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __ne__  s    c         C   s   t  j |  j d  S(   Ns   %Y%m%dT%H:%M:%S(   R?   t   strptimeR+   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyRE     s    c         C   s"   |  j  |  \ } } t | |  S(   N(   RN   R/   (   R   R0   R
   RL   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR1     s    c         C   s   |  j  S(   N(   R+   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    c         C   s   d t  |  j  t |   f S(   Ns   <DateTime %s at %x>(   R   R+   R2   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    c         C   s"   t  |  } t j |  |  _ d  S(   N(   t   strR   t   stripR+   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   decode  s    c         C   s.   | j  d  | j  |  j  | j  d  d  S(   Ns   <value><dateTime.iso8601>s   </dateTime.iso8601></value>
(   R,   R+   (   R   R-   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    (   R   R   R   R   RN   RO   RP   RQ   RR   RS   RT   RE   R1   R   R   RX   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyRC   y  s   													c         C   s   t    } | j |   | S(   N(   RC   RX   (   R   R+   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt	   _datetime  s    	c         C   s)   t  j |  d  } t j t |  d    S(   Ns   %Y%m%dT%H:%M:%Si   (   R?   RU   R7   t   tuple(   R   t   t(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   _datetime_type  s    t   Binaryc           B   s>   e  Z d  Z d d  Z d   Z d   Z d   Z d   Z RS(   s   Wrapper for binary data.c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    c         C   s   |  j  p d S(   Nt    (   R   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    c         C   s+   t  | t  r | j } n  t |  j |  S(   N(   R.   R]   R   R/   (   R   R0   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR1     s    c         C   s   t  j |  |  _ d  S(   N(   t   base64t   decodestringR   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyRX     s    c         C   s:   | j  d  t j t j |  j  |  | j  d  d  S(   Ns   <value><base64>
s   </base64></value>
(   R,   R_   R   t   StringIOR   (   R   R-   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    N(	   R   R   R   t   NoneR   R   R1   RX   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR]     s   			c         C   s   t    } | j |   | S(   N(   R]   RX   (   R   R+   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   _binary  s    	(   t   expatt   ParserCreatet   ExpatParserc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   sr   t  j d  d   |  _ } | |  _ | j | _ | j | _ | j	 | _
 d  } | j s^ d } n  | j | d   d  S(   Ns   utf-8(   Rd   Re   Rb   t   _parsert   _targett   startt   StartElementHandlert   endt   EndElementHandlerR   t   CharacterDataHandlert   returns_unicodet   xml(   R   t   targett   parserR   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR   "  s    			c         C   s   |  j  j | d  d  S(   Ni    (   Rg   t   Parse(   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   feed-  s    c         C   sA   y |  j  } Wn t k
 r  n X|  ` |  `  | j d d  d  S(   NR^   i   (   Rg   t   AttributeErrorRh   Rr   (   R   Rq   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   close0  s    (   R   R   R   Rs   Ru   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyRf      s   		t
   SlowParserc           B   s   e  Z d  Z d   Z RS(   s/   Default XML parser (based on xmllib.XMLParser).c         C   s   d d  l  } | j t j k r0 | j f t _ n  | j |  _ | j |  _ | j |  _	 | j |  _
 | j |  _ y | j j |  d d Wn! t k
 r | j j |   n Xd  S(   Nit   accept_utf8i   (   t   xmllibt	   XMLParserRv   t	   __bases__Ro   t
   handle_xmlRi   t   unknown_starttagR   t   handle_datat   handle_cdataRk   t   unknown_endtagR   RK   (   R   Rp   Rx   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR   <  s    (   R   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyRv   9  s   t
   Marshallerc           B   s7  e  Z d  Z d d d  Z i  Z d   Z d   Z d   Z e e e	 <d   Z
 e
 e e <e ru d   Z e e e <n  d   Z e e e <d	   Z e e e <e d
  Z e e e <e r e d  Z e e e <n  d   Z e e e <e e e <e d  Z e e e <e r"d   Z e e e j <n  d   Z  e  e e! <RS(   sv  Generate an XML-RPC params chunk from a Python data structure.

    Create a Marshaller instance for each set of parameters, and use
    the "dumps" method to convert your data (represented as a tuple)
    to an XML-RPC params chunk.  To write a fault response, pass a
    Fault instance instead.  You may prefer to use the "dumps" module
    function for this purpose.
    i    c         C   s(   i  |  _  d  |  _ | |  _ | |  _ d  S(   N(   t   memoRb   R   R   t
   allow_none(   R   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR   a  s    			c         C   s   g  } | j  } |  j } t | t  r_ | d  | i | j d 6| j d 6|  | d  nF | d  x/ | D]' } | d  | | |  | d  qp W| d  t j | d	  } | S(
   Ns   <fault>
R"   R#   s	   </fault>
s	   <params>
s   <param>
s	   </param>
s
   </params>
R^   (   t   appendt   _Marshaller__dumpR.   R!   R"   R#   R   t   join(   R   t   valuesR-   R,   t   dumpt   vt   result(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   dumpsi  s"    		




c         C   s   y |  j  t |  } Wn t k
 r y | j Wn t d t |   n XxB t |  j D]1 } | |  j  j   k r_ t d t |   q_ q_ W|  j  t } n X| |  | |  d  S(   Ns   cannot marshal %s objects(   t   dispatchRJ   t   KeyErrort   __dict__RK   t   __mro__t   keyst   InstanceType(   R   R+   R,   t   ft   type_(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __dump  s    c         C   s#   |  j  s t d  n  | d  d  S(   Ns0   cannot marshal None unless allow_none is enableds   <value><nil/></value>(   R   RK   (   R   R+   R,   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   dump_nil  s    	c         C   sL   | t  k s | t k  r$ t d  n  | d  | t |   | d  d  S(   Ns   int exceeds XML-RPC limitss   <value><int>s   </int></value>
(   t   MAXINTt   MININTt   OverflowErrorRV   (   R   R+   R,   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   dump_int  s
    
c         C   s.   | d  | | r d p d  | d  d  S(   Ns   <value><boolean>t   1t   0s   </boolean></value>
(    (   R   R+   R,   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt	   dump_bool  s    
c         C   sR   | t  k s | t k  r$ t d  n  | d  | t t |    | d  d  S(   Ns   long int exceeds XML-RPC limitss   <value><int>s   </int></value>
(   R   R   R   RV   t   int(   R   R+   R,   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt	   dump_long  s
    
c         C   s(   | d  | t  |   | d  d  S(   Ns   <value><double>s   </double></value>
(   R   (   R   R+   R,   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   dump_double  s    
c         C   s(   | d  | | |   | d  d  S(   Ns   <value><string>s   </string></value>
(    (   R   R+   R,   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   dump_string  s    
c         C   s7   | d  | | |  j  |  j d   | d  d  S(   Ns   <value><string>t   xmlcharrefreplaces   </string></value>
(   R   R   (   R   R+   R,   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   dump_unicode  s    
c         C   s}   t  |  } | |  j k r' t d  n  d  |  j | <|  j } | d  x | D] } | | |  qN W| d  |  j | =d  S(   Ns"   cannot marshal recursive sequencess   <value><array><data>
s   </data></array></value>
(   R2   R   RK   Rb   R   (   R   R+   R,   t   iR   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt
   dump_array  s    	

c         C   s  t  |  } | |  j k r' t d  n  d  |  j | <|  j } | d  x | j   D] \ } } | d  t |  t k r | |  } n? t r t |  t	 k r | |  j
 |  j d  } n	 t d  | d |  | | |  | d  qT W| d  |  j | =d  S(	   Ns%   cannot marshal recursive dictionariess   <value><struct>
s	   <member>
R   s   dictionary key must be strings   <name>%s</name>
s
   </member>
s   </struct></value>
(   R2   R   RK   Rb   R   t   itemsRJ   RD   R   t   UnicodeTypeR   R   (   R   R+   R,   R   R   R   t   kR   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   dump_struct  s$    	

	
c         C   s(   | d  | t  |   | d  d  S(   Ns   <value><dateTime.iso8601>s   </dateTime.iso8601></value>
(   RB   (   R   R+   R,   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   dump_datetime  s    
c         C   sE   | j  t k r. | |  _ | j |   |  ` n |  j | j |  d  S(   N(   RF   t   WRAPPERSR,   R   R   R   (   R   R+   R,   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   dump_instance  s
    		N("   R   R   R   Rb   R   R   R   R   R   t   NoneTypeR   t   IntTypet   _bool_is_builtinR   R   R   t   LongTypeR   t	   FloatTypeR   R   RD   R   R   R   R   R>   t   ListTypeR   t   DictTypeR7   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR   T  s>   			
	
		
	

	


			t   Unmarshallerc           B   sz  e  Z d  Z d d  Z d   Z d   Z d   Z d   Z d   Z e	 j
 d  Z d	   Z i  Z d
   Z e e d <d   Z e e d <d   Z e e d <e e d <e e d <d   Z e e d <d   Z e e d <e e d <d   Z e e d <d   Z e e d <d   Z e e d <d   Z e e d <d   Z e e d  <d!   Z e e d" <d#   Z e e d$ <d%   Z e e d& <RS('   s  Unmarshal an XML-RPC response, based on incoming XML event
    messages (start, data, end).  Call close() to get the resulting
    data structure.

    Note that this reader is fairly tolerant, and gladly accepts bogus
    XML-RPC data without complaining (but not bogus XML).
    i    c         C   st   d  |  _ g  |  _ g  |  _ g  |  _ t |  _ d  |  _ d |  _ |  j j	 |  _	 | |  _
 | rp t rp t d  n  d  S(   Ns   utf-8s$   the datetime module is not available(   Rb   t   _typet   _stackt   _markst   _dataR'   t   _valuet   _methodnamet	   _encodingR   t   _use_datetimeR7   t
   ValueError(   R   t   use_datetime(    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    								c         C   sV   |  j  d  k s |  j r$ t    n  |  j  d k rI t |  j d    n  t |  j  S(   Nt   faulti    (   R   Rb   R   R    R!   R   RZ   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyRu     s
    c         C   s   |  j  S(   N(   R   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   getmethodname#  s    c         C   s   | |  _  d  S(   N(   R   (   R   R   t
   standalone(    (    s   /usr/lib/python2.7/xmlrpclib.pyRo   )  s    c         C   s{   | d k s | d k r4 |  j  j t |  j   n  g  |  _ |  j rh | |  j k rh t d |   n  | d k |  _ d  S(   Nt   arrayt   structs   unknown tag %rR+   (   R   R   t   lenR   R   R   R   R    (   R   t   tagt   attrs(    (    s   /usr/lib/python2.7/xmlrpclib.pyRi   -  s    	c         C   s   |  j  j |  d  S(   N(   R   R   (   R   t   text(    (    s   /usr/lib/python2.7/xmlrpclib.pyR   6  s    c         C   sB   y |  j  | } Wn t k
 r$ n X| |  | |  j d   Sd  S(   NR^   (   R   R   R   (   R   R   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyRk   9  s
    c         C   s6   y |  j  | } Wn t k
 r$ n X| |  |  Sd  S(   N(   R   R   (   R   R   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   end_dispatchE  s
    c         C   s   |  j  d   d |  _ d  S(   Ni    (   R   Rb   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   end_nilS  s    t   nilc         C   sN   | d k r |  j  t  n% | d k r8 |  j  t  n	 t d  d |  _ d  S(   NR   R   s   bad boolean valuei    (   R   R'   R&   RK   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   end_booleanX  s    	R6   c         C   s    |  j  t |   d |  _ d  S(   Ni    (   R   R   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   end_intb  s    t   i4t   i8R   c         C   s    |  j  t |   d |  _ d  S(   Ni    (   R   t   floatR   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt
   end_doublei  s    t   doublec         C   s>   |  j  r t | |  j   } n  |  j t |   d |  _ d  S(   Ni    (   R   R   R   R   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt
   end_stringn  s    	R   t   namec         C   s3   |  j  j   } |  j | g |  j | )d |  _ d  S(   Ni    (   R   t   popR   R   (   R   R   t   mark(    (    s   /usr/lib/python2.7/xmlrpclib.pyt	   end_arrayv  s    R   c         C   s~   |  j  j   } i  } |  j | } x< t d t |  d  D]" } | | d | t | |  <q; W| g |  j | )d |  _ d  S(   Ni    i   i   (   R   R   R   t   rangeR   R   R   (   R   R   R   t   dictR   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt
   end_struct}  s     R   c         C   s0   t    } | j |  |  j |  d |  _ d  S(   Ni    (   R]   RX   R   R   (   R   R   R+   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt
   end_base64  s    	R_   c         C   s?   t    } | j |  |  j r. t |  } n  |  j |  d  S(   N(   RC   RX   R   R\   R   (   R   R   R+   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   end_dateTime  s
    		s   dateTime.iso8601c         C   s   |  j  r |  j |  n  d  S(   N(   R   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt	   end_value  s    	R+   c         C   s   d |  _  d  S(   Nt   params(   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt
   end_params  s    R   c         C   s   d |  _  d  S(   NR   (   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt	   end_fault  s    R   c         C   s4   |  j  r t | |  j   } n  | |  _ d |  _ d  S(   Nt
   methodName(   R   R   R   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   end_methodName  s    		R   (   R   R   R   R   Ru   R   Ro   Ri   R   R   R   Rk   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     sN   								
	
	


	
	

	
		
	
	
	
	
	
	t   _MultiCallMethodc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   t   _MultiCallMethod__call_listt   _MultiCallMethod__name(   R   t	   call_listR   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    	c         C   s   t  |  j d |  j | f  S(   Ns   %s.%s(   R   R   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __getattr__  s    c         G   s   |  j  j |  j | f  d  S(   N(   R   R   R   (   R   t   args(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __call__  s    (   R   R   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s   		t   MultiCallIteratorc           B   s    e  Z d  Z d   Z d   Z RS(   sa   Iterates over the results of a multicall. Exceptions are
    raised in response to xmlrpc faults.c         C   s   | |  _  d  S(   N(   t   results(   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    c         C   sl   |  j  | } t |  t i   k r? t | d | d   n) t |  t g   k r_ | d St d  d  S(   NR"   R#   i    s#   unexpected type in multicall result(   R   RJ   R!   R   (   R   R   t   item(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __getitem__  s    (   R   R   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s   	t	   MultiCallc           B   s8   e  Z d  Z d   Z d   Z e Z d   Z d   Z RS(   s~  server -> an object used to boxcar method calls

    server should be a ServerProxy object.

    Methods can be added to the MultiCall using normal
    method call syntax e.g.:

    multicall = MultiCall(server_proxy)
    multicall.add(2,3)
    multicall.get_address("Guido")

    To execute the multicall, call the MultiCall object e.g.:

    add_result, address = multicall()
    c         C   s   | |  _  g  |  _ d  S(   N(   t   _MultiCall__servert   _MultiCall__call_list(   R   t   server(    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    	c         C   s   d t  |   S(   Ns   <MultiCall at %x>(   R2   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    c         C   s   t  |  j |  S(   N(   R   R   (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    c         C   sT   g  } x2 |  j  D]' \ } } | j i | d 6| d 6 q Wt |  j j j |   S(   NR   R   (   R   R   R   R   t   systemt	   multicall(   R   t   marshalled_listR   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    (   R   R   R   R   R   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s   			c         C   s   |  r t  r t d  n  t ra t ra |  r4 t } n t } t t t t | t	  } t |  } nE t
 d |   } t r t |  } n! t r t |  } n t |  } | | f S(   s   getparser() -> parser, unmarshaller

    Create an instance of the fastest available parser, and attach it
    to an unmarshalling object.  Return both objects.
    s$   the datetime module is not availableR   (   R7   R   t
   FastParsert   FastUnmarshallerR\   RY   R&   R'   Rc   R!   R   Rf   Rv   (   R   t
   mkdatetimeRp   Rq   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt	   getparser  s    	c         C   sS  t  |  t  s* t  |  t  s* t d   t  |  t  rB d } n6 | rx t  |  t  rx t |   d k sx t d   n  | s d } n  t r t |  } n t | |  } | j |   } | d k r d t |  } n d } | r$t  | t	  s	| j
 | d  } n  | d | d	 | d
 f } n | r?| d | d f } n | St j | d  S(   s  data [,options] -> marshalled data

    Convert an argument tuple or a Fault instance to an XML-RPC
    request (or response, if the methodresponse option is used).

    In addition to the data object, the following options can be given
    as keyword arguments:

        methodname: the method name for a methodCall packet

        methodresponse: true to create a methodResponse packet.
        If this option is used with a tuple, the tuple must be
        a singleton (i.e. it can contain only one element).

        encoding: the packet encoding (default is UTF-8)

    All 8-bit strings in the data structure are assumed to use the
    packet encoding.  Unicode strings are automatically converted,
    where necessary.
    s(   argument must be tuple or Fault instancei   s"   response tuple must be a singletons   utf-8s$   <?xml version='1.0' encoding='%s'?>
s   <?xml version='1.0'?>
R   s   <methodCall>
<methodName>s   </methodName>
s   </methodCall>
s   <methodResponse>
s   </methodResponse>
R^   (   R.   R>   R!   t   AssertionErrorR   t   FastMarshallerR   R   RV   RD   R   R   R   (   R   t
   methodnamet   methodresponseR   R   t   mR   t	   xmlheader(    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s<    !		!	c         C   sB   t  d |  \ } } | j |   | j   | j   | j   f S(   s   data -> unmarshalled data, method name

    Convert an XML-RPC packet to unmarshalled data plus a method
    name (None if not present).

    If the XML-RPC packet represents a fault condition, this function
    raises a Fault exception.
    R   (   R   Rs   Ru   R   (   R   R   t   pt   u(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   loadsn  s    	
c         C   sj   t  s t  n  t j   } t  j d d d | d d  } | j |   | j   | j   } | j   | S(   sh   data -> gzip encoded data

    Encode data using the gzip content encoding as described in RFC 1952
    t   modet   wbt   fileobjt   compressleveli   (   t   gzipt   NotImplementedErrorRa   t   GzipFileR,   Ru   t   getvalue(   R   R   t   gzft   encoded(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   gzip_encode  s    	

i  @c         C   s   t  s t  n  t j |   } t  j d d d |  } y2 | d k  rT | j   } n | j | d  } Wn t k
 r t d   n X| j   | j   | d k r t |  | k r t d   n  | S(   sr   gzip encoded data -> unencoded data

    Decode data using the gzip content encoding as described in RFC 1952
    R   t   rbR  i    i   s   invalid datas#   max gzipped payload length exceeded(	   R  R  Ra   R  t   readt   IOErrorR   Ru   R   (   R   t
   max_decodeR   R  t   decoded(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   gzip_decode  s    	

t   GzipDecodedResponsec           B   s    e  Z d  Z d   Z d   Z RS(   sh   a file-like object to decode a response encoded with the gzip
    method, as described in RFC 1952.
    c         C   sJ   t  s t  n  t j | j    |  _ t  j j |  d d d |  j d  S(   NR   R
  R  (   R  R  Ra   R  t   stringioR  R   (   R   t   response(    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    	c         C   s)   z t  j j |   Wd  |  j j   Xd  S(   N(   R  R  Ru   R  (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyRu     s    (   R   R   R   R   Ru   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR    s   	t   _Methodc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   t   _Method__sendt   _Method__name(   R   t   sendR   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    	c         C   s   t  |  j d |  j | f  S(   Ns   %s.%s(   R  R  R  (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    c         G   s   |  j  |  j |  S(   N(   R  R  (   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    (   R   R   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR    s   		t	   Transportc           B   s   e  Z d  Z d e Z e Z d Z d d  Z	 d d  Z
 d d  Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z RS(   s1   Handles an HTTP transaction to an XML-RPC server.s'   xmlrpclib.py/%s (by www.pythonware.com)i    c         C   s   | |  _  d |  _ g  |  _ d  S(   N(   NN(   R   Rb   t   _connectiont   _extra_headers(   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    		c         C   s   x d D] } y |  j  | | | |  SWq t j k
 rl } | sc | j t j t j t j f k r   q q t j k
 r | r   q q Xq Wd  S(   Ni    i   (   i    i   (	   t   single_requestt   sockett   errort   errnot
   ECONNRESETt   ECONNABORTEDt   EPIPEt   httplibt   BadStatusLine(   R   t   hostt   handlert   request_bodyt   verboseR   t   e(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   request  s    '	c         C   s  |  j  |  } | r% | j d  n  y{ |  j | | |  |  j | |  |  j |  |  j | |  | j d t  } | j d k r | |  _	 |  j
 |  SWn1 t k
 r   n t k
 r |  j     n X| j d d  r | j   n  t | | | j | j | j   d  S(   Ni   t	   bufferingi   s   content-lengthi    (   t   make_connectiont   set_debuglevelt   send_requestt	   send_hostt   send_user_agentt   send_contentt   getresponseR&   t   statusR&  t   parse_responseR!   t	   ExceptionRu   t	   getheaderR  R   t   reasont   msg(   R   R#  R$  R%  R&  t   hR  (    (    s   /usr/lib/python2.7/xmlrpclib.pyR    s.    	
c         C   s   t  d |  j  S(   NR   (   R   R   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR   ;  s    c         C   s   i  } t  | t  r$ | \ } } n  d d  l } | j |  \ } } | r d d  l } | j | j |   } t j t j	 |  d  } d d | f g } n d  } | | | f S(   NiR^   t   Authorizations   Basic (   R.   R>   t   urllibt	   splituserR_   t   encodestringt   unquoteR   R   t   splitRb   (   R   R#  t   x509R9  t   authR_   t   extra_headers(    (    s   /usr/lib/python2.7/xmlrpclib.pyt   get_host_infoI  s    c         C   se   |  j  r' | |  j  d k r' |  j  d S|  j |  \ } |  _ } | t j |  f |  _  |  j  d S(   Ni    i   (   R  RA  R  R!  t   HTTPConnection(   R   R#  t   chostR>  (    (    s   /usr/lib/python2.7/xmlrpclib.pyR*  d  s
    c         C   s/   |  j  \ } } | r+ d |  _  | j   n  d  S(   N(   NN(   R  Rb   Ru   (   R   R#  t
   connection(    (    s   /usr/lib/python2.7/xmlrpclib.pyRu   t  s    	c         C   sL   |  j  r8 t r8 | j d | d t | j d d  n | j d |  d  S(   Nt   POSTt   skip_accept_encodings   Accept-EncodingR  (   t   accept_gzip_encodingR  t
   putrequestR&   t	   putheader(   R   RD  R$  R%  (    (    s   /usr/lib/python2.7/xmlrpclib.pyR,    s    c         C   s[   |  j  } | rW t | t  r- | j   } n  x' | D] \ } } | j | |  q4 Wn  d  S(   N(   R  R.   R   R   RI  (   R   RD  R#  R@  t   keyR+   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR-    s    	c         C   s   | j  d |  j  d  S(   Ns
   User-Agent(   RI  t
   user_agent(   R   RD  (    (    s   /usr/lib/python2.7/xmlrpclib.pyR.    s    c         C   s   | j  d d  |  j d  k	 rY |  j t |  k  rY t rY | j  d d  t |  } n  | j  d t t |    | j |  d  S(   Ns   Content-Types   text/xmls   Content-EncodingR  s   Content-Length(   RI  t   encode_thresholdRb   R   R  R	  RV   t
   endheaders(   R   RD  R%  (    (    s   /usr/lib/python2.7/xmlrpclib.pyR/    s    c         C   s   t  | d  r? | j d d  d k r6 t |  } qE | } n | } |  j   \ } } xE | j d  } | ss Pn  |  j r d Gt |  GHn  | j |  qZ W| | k	 r | j   n  | j   | j   S(   NR4  s   Content-EncodingR^   R  i   s   body:(	   RI   R4  R  R   R  R&  R   Rs   Ru   (   R   R  t   streamR   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR2    s"    		
N(   R   R   R   t   __version__RK  R&   RG  Rb   RL  R   R(  R  R   RA  R*  Ru   R,  R-  R.  R/  R2  (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyR    s    
'									t   SafeTransportc           B   s&   e  Z d  Z d d d  Z d   Z RS(   s2   Handles an HTTPS transaction to an XML-RPC server.i    c         C   s    t  j |  d | | |  _ d  S(   NR   (   R  R   t   context(   R   R   RQ  (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s    c         C   s   |  j  r' | |  j  d k r' |  j  d Sy t j } Wn t k
 rS t d   nQ X|  j |  \ } |  _ } | | | d  d |  j | p i  f |  _  |  j  d Sd  S(   Ni    i   s-   your version of httplib doesn't support HTTPSRQ  (	   R  R!  t   HTTPSConnectionRt   R  RA  R  Rb   RQ  (   R   R#  t   HTTPSRC  R>  (    (    s   /usr/lib/python2.7/xmlrpclib.pyR*    s    *N(   R   R   R   Rb   R   R*  (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyRP    s   t   ServerProxyc           B   s\   e  Z d  Z d d d d d d d  Z d   Z d   Z d   Z e Z d   Z	 d   Z
 RS(	   s  uri [,options] -> a logical connection to an XML-RPC server

    uri is the connection point on the server, given as
    scheme://host/target.

    The standard implementation always supports the "http" scheme.  If
    SSL socket support is available (Python 2.0), it also supports
    "https".

    If the target part and the slash preceding it are both omitted,
    "/RPC2" is assumed.

    The following options can be given as keyword arguments:

        transport: a transport factory
        encoding: the request encoding (default is UTF-8)

    All 8-bit strings passed to the server proxy are assumed to use
    the given encoding.
    i    c   
      C   s   t  r' t | t   r' | j d  } n  d d  l } | j |  \ }	 } |	 d	 k r` t d  n  | j |  \ |  _ |  _ |  j s d |  _ n  | d  k r |	 d k r t
 d | d |  } q t d |  } n  | |  _ | |  _ | |  _ | |  _ d  S(
   Ns
   ISO-8859-1it   httpt   httpss   unsupported XML-RPC protocols   /RPC2R   RQ  (   RU  RV  (   R   R.   R   R9  t	   splittypeR  t	   splithostt   _ServerProxy__hostt   _ServerProxy__handlerRb   RP  R  t   _ServerProxy__transportt   _ServerProxy__encodingt   _ServerProxy__verboset   _ServerProxy__allow_none(
   R   t   urit	   transportR   R&  R   R   RQ  R9  RJ   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR     s"    				c         C   s   |  j  j   d  S(   N(   R[  Ru   (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   __close5  s    c         C   sk   t  | | d |  j d |  j } |  j j |  j |  j | d |  j } t |  d k rg | d } n  | S(   NR   R   R&  i   i    (	   R   R\  R^  R[  R(  RY  RZ  R]  R   (   R   R   R   R(  R  (    (    s   /usr/lib/python2.7/xmlrpclib.pyt	   __request8  s    	c         C   s   d |  j  |  j f S(   Ns   <ServerProxy for %s%s>(   RY  RZ  (   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR   J  s    c         C   s   t  |  j |  S(   N(   R  t   _ServerProxy__request(   R   R   (    (    s   /usr/lib/python2.7/xmlrpclib.pyR   R  s    c         C   s=   | d k r |  j  S| d k r& |  j St d | f   d S(   s|   A workaround to get special attributes on the ServerProxy
           without interfering with the magic __getattr__
        Ru   R`  s   Attribute %r not foundN(   t   _ServerProxy__closeR[  Rt   (   R   t   attr(    (    s   /usr/lib/python2.7/xmlrpclib.pyR   Y  s
    N(   R   R   R   Rb   R   Rd  Rc  R   R   R   R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyRT    s   					t   __main__s   http://localhost:8000i   i	   i   i   i   t   ERRORl        l    l        l     (    (    (    (    (    (    (    (    (    (    (    (    (    (b   R   t   reR   R?   R)   t   typesR  R  R!  R  t   ImportErrorRb   R   t	   NameErrorR7   R'   RF   R   R   t   compilet   searchR   R   R   R   RO  R   R   t   PARSE_ERRORt   SERVER_ERRORt   APPLICATION_ERRORt   SYSTEM_ERRORt   TRANSPORT_ERRORt   NOT_WELLFORMED_ERRORt   UNSUPPORTED_ENCODINGt   INVALID_ENCODING_CHARt   INVALID_XMLRPCt   METHOD_NOT_FOUNDt   INVALID_METHOD_PARAMSt   INTERNAL_ERRORR3  R   R   R    R!   t   sysR%   R   t   mod_dictR   R6   R(   R&   RB   RC   RY   R\   R_   t	   cStringIORa   R]   Rc   R   t
   _xmlrpclibt   ParserR   R   R   Rt   R   R   t   xml.parsersRd   RI   Rf   Rv   R   R   R   R   R   R   R	  R  R  t   objectR  R  R  RP  RT  t   ServerR   t   multit   powt   addR  R   (    (    (    s   /usr/lib/python2.7/xmlrpclib.pyt   <module>   s   0




	

	T		
		

-&	N	%*a