B
    v\~              C   @   s  d Z ddlmZ ddlZddlZddlZddlZddlZdZdZ	ej
d dkZej
d dkZej
dd dkZerefZefZefZeZeZejZn~efZeefZeejfZeZeZejd	red
ZnHG dd deZ ye!e   W n e"k
r   ed
ZY n
X edZ[ dd Z#dd Z$G dd deZ%G dd de%Z&G dd dej'Z(G dd de%Z)G dd deZ*e*e+Z,G dd de(Z-e)dddd e)d!d"d#d$d!e)d%d"d"d&d%e)d'd(d#d)d'e)d*d(d+e)d,d"d#d-d,e)d.d/d/d0d.e)d1d/d/d.d1e)d2d3d4e)d5d(d#d6d5e)d7d(erd8nd9d:e)d;d(d<e)d=d>d?d@e)d d de)dAdAdBe)dCdCdBe)dDdDdBe)d6d(d#d6d5e)dEd"d#dFdEe)dGd"d"dHdGe&d#d(e&dIdJe&dKdLe&dMdNdOe&dPdQdPe&dRdSdTe&dUdVdWe&dXdYdZe&d[d\d]e&d^d_d`e&dadbdce&dddedfe&dgdhdie&djdkdle&dmdndoe&dpdpdqe&drdrdqe&dsdsdqe&dtdtdue&dvdwe&dxdye&dzd{e&d|d}d|e&d~de&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&de+d de&de+d de&de+d e+d e&ddde&ddde&dddg@Z.ejdkrfe.e&ddg7 Z.x:e.D ]2Z/e0e-e/j1e/ e2e/e&rle,3e/de/j1  qlW [/e.e-_.e-e+d Z4e,3e4d G dd de(Z5e)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)d@dde)ddde)ddde)ddde)ddddd΃e)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)dddgZ6xe6D ]Z/e0e5e/j1e/ qW [/e6e5_.e,3e5e+d ddڡ G dd܄ de(Z7e)ddde)ddde)dddgZ8xe8D ]Z/e0e7e/j1e/ qHW [/e8e7_.e,3e7e+d dd G dd de(Z9e)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)d dde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)d	ddg#Z:xe:D ]Z/e0e9e/j1e/ q
W [/e:e9_.e,3e9e+d
 dd G dd de(Z;e)ddde)ddde)ddde)dddgZ<xe<D ]Z/e0e;e/j1e/ qW [/e<e;_.e,3e;e+d dd G dd de(Z=e)dddgZ>xe>D ]Z/e0e=e/j1e/ 	qW [/e>e=_.e,3e=e+d dd G dd dej'Z?e,3e?e+d d d d! Z@d"d# ZAe	rd$ZBd%ZCd&ZDd'ZEd(ZFd)ZGn$d*ZBd+ZCd,ZDd-ZEd.ZFd/ZGyeHZIW n" eJk

r   d0d1 ZIY nX eIZHyeKZKW n" eJk

r2   d2d3 ZKY nX e
r^d4d5 ZLejMZNd6d7 ZOeZPn>d8d5 ZLd9d: ZNd;d7 ZOG d<d= d=eZPeKZKe#eLd> eQeBZReQeCZSeQeDZTeQeEZUeQeFZVeQeGZWer@d?d@ ZXdAdB ZYdCdD ZZdEdF Z[e\dGZ]e\dHZ^e\dIZ_nTdJd@ ZXdKdB ZYdLdD ZZdMdF Z[e\dNZ]e\dOZ^e\dPZ_e#eXdQ e#eYdR e#eZdS e#e[dT er\dUdV Z`dWdX ZaebZcddldZdededYjfZg[dehdZiejjZkelZmddlnZnenjoZoenjpZpdZZqej
d[ d[krNd\Zrd]Zsnd^Zrd_Zsnjd`dV Z`dadX ZaecZcebZgdbdc Ziddde ZketejuevZmddloZoeojo ZoZpdfZqd\Zrd]Zse#e`dg e#eadh didZ Zwdjd^ Zxdkd_ Zyer(eze4j{dlZ|ddmdnZ}nddodpZ|e|dq ej
dd drkrde|ds n.ej
dd drkre|dt ndudv Z~eze4j{dwdZedkrdxdy Zej
dd dzk reZd{dy Ze#e}d| ej
dd dk rejejfd}d~ZnejZdd Zdd ZdddZdddZdddZdd Zg Ze+Ze ddk	rg e_ejrx>eejD ]0\ZZeej+dkrej1e+kreje= P qW [[eje, dS (  z6Utilities for writing code that runs on Python 2 and 3    )absolute_importNz'Benjamin Peterson <benjamin@python.org>z1.12.0      )r      javaic               @   s   e Zd Zdd ZdS )Xc             C   s   dS )Nl         )selfr   r   "lib/python3.7/site-packages/six.py__len__>   s    z	X.__len__N)__name__
__module____qualname__r   r   r   r   r
   r   <   s   r   l    c             C   s
   || _ dS )z Add documentation to a function.N)__doc__)funcdocr   r   r
   _add_docK   s    r   c             C   s   t |  tj|  S )z7Import module, returning the module after the last dot.)
__import__sysmodules)namer   r   r
   _import_moduleP   s    r   c               @   s   e Zd Zdd Zdd ZdS )
_LazyDescrc             C   s
   || _ d S )N)r   )r	   r   r   r   r
   __init__X   s    z_LazyDescr.__init__c             C   sB   |   }t|| j| yt|j| j W n tk
r<   Y nX |S )N)_resolvesetattrr   delattr	__class__AttributeError)r	   objtpresultr   r   r
   __get__[   s    z_LazyDescr.__get__N)r   r   r   r   r"   r   r   r   r
   r   V   s   r   c                   s.   e Zd Zd fdd	Zdd Zdd Z  ZS )	MovedModuleNc                s2   t t| | tr(|d kr |}|| _n|| _d S )N)superr#   r   PY3mod)r	   r   oldnew)r   r   r
   r   i   s    zMovedModule.__init__c             C   s
   t | jS )N)r   r&   )r	   r   r   r
   r   r   s    zMovedModule._resolvec             C   s"   |   }t||}t| || |S )N)r   getattrr   )r	   attr_modulevaluer   r   r
   __getattr__u   s    
zMovedModule.__getattr__)N)r   r   r   r   r   r-   __classcell__r   r   )r   r
   r#   g   s   	r#   c                   s(   e Zd Z fddZdd Zg Z  ZS )_LazyModulec                s   t t| | | jj| _d S )N)r$   r/   r   r   r   )r	   r   )r   r   r
   r   ~   s    z_LazyModule.__init__c             C   s    ddg}|dd | j D 7 }|S )Nr   r   c             S   s   g | ]
}|j qS r   )r   ).0r*   r   r   r
   
<listcomp>   s    z'_LazyModule.__dir__.<locals>.<listcomp>)_moved_attributes)r	   Zattrsr   r   r
   __dir__   s    z_LazyModule.__dir__)r   r   r   r   r3   r2   r.   r   r   )r   r
   r/   |   s   r/   c                   s&   e Zd Zd fdd	Zdd Z  ZS )MovedAttributeNc                sd   t t| | trH|d kr |}|| _|d kr@|d kr<|}n|}|| _n|| _|d krZ|}|| _d S )N)r$   r4   r   r%   r&   r*   )r	   r   Zold_modZnew_modZold_attrZnew_attr)r   r   r
   r      s    zMovedAttribute.__init__c             C   s   t | j}t|| jS )N)r   r&   r)   r*   )r	   moduler   r   r
   r      s    
zMovedAttribute._resolve)NN)r   r   r   r   r   r.   r   r   )r   r
   r4      s   r4   c               @   sV   e Zd ZdZdd Zdd Zdd Zdd	d
Zdd Zdd Z	dd Z
dd ZeZdS )_SixMetaPathImporterz
    A meta path importer to import six.moves and its submodules.

    This class implements a PEP302 finder and loader. It should be compatible
    with Python 2.5 and all existing versions of Python3
    c             C   s   || _ i | _d S )N)r   known_modules)r	   Zsix_module_namer   r   r
   r      s    z_SixMetaPathImporter.__init__c             G   s&   x |D ]}|| j | jd | < qW d S )N.)r7   r   )r	   r&   Z	fullnamesfullnamer   r   r
   _add_module   s    
z _SixMetaPathImporter._add_modulec             C   s   | j | jd |  S )Nr8   )r7   r   )r	   r9   r   r   r
   _get_module   s    z _SixMetaPathImporter._get_moduleNc             C   s   || j kr| S d S )N)r7   )r	   r9   pathr   r   r
   find_module   s    
z _SixMetaPathImporter.find_modulec             C   s0   y
| j | S  tk
r*   td| Y nX d S )Nz!This loader does not know module )r7   KeyErrorImportError)r	   r9   r   r   r
   Z__get_module   s    
z!_SixMetaPathImporter.__get_modulec             C   sR   y
t j| S  tk
r   Y nX | |}t|tr>| }n| |_|t j|< |S )N)r   r   r>    _SixMetaPathImporter__get_module
isinstancer#   r   
__loader__)r	   r9   r&   r   r   r
   load_module   s    




z _SixMetaPathImporter.load_modulec             C   s   t | |dS )z
        Return true, if the named module is a package.

        We need this method to get correct spec objects with
        Python 3.4 (see PEP451)
        __path__)hasattrr@   )r	   r9   r   r   r
   
is_package   s    z_SixMetaPathImporter.is_packagec             C   s   |  | dS )z;Return None

        Required, if is_package is implementedN)r@   )r	   r9   r   r   r
   get_code   s    
z_SixMetaPathImporter.get_code)N)r   r   r   r   r   r:   r;   r=   r@   rC   rF   rG   
get_sourcer   r   r   r
   r6      s   
	r6   c               @   s   e Zd ZdZg ZdS )_MovedItemszLazy loading of moved objectsN)r   r   r   r   rD   r   r   r   r
   rI      s   rI   Z	cStringIOioStringIOfilter	itertoolsbuiltinsZifilterfilterfalseZifilterfalseinputZ__builtin__Z	raw_inputinternr   mapimapgetcwdosZgetcwdugetcwdbZ	getoutputZcommands
subprocessrangeZxrangeZreload_module	importlibimpreloadreduce	functoolsZshlex_quoteZpipesZshlexZquoteUserDictcollectionsUserList
UserStringzipZizipzip_longestZizip_longestZconfigparserZConfigParsercopyregZcopy_regZdbm_gnuZgdbmzdbm.gnuZ_dummy_threadZdummy_threadZhttp_cookiejarZ	cookielibzhttp.cookiejarZhttp_cookiesZCookiezhttp.cookiesZhtml_entitiesZhtmlentitydefszhtml.entitiesZhtml_parserZ
HTMLParserzhtml.parserZhttp_clientZhttplibzhttp.clientZemail_mime_basezemail.MIMEBasezemail.mime.baseZemail_mime_imagezemail.MIMEImagezemail.mime.imageZemail_mime_multipartzemail.MIMEMultipartzemail.mime.multipartZemail_mime_nonmultipartzemail.MIMENonMultipartzemail.mime.nonmultipartZemail_mime_textzemail.MIMETextzemail.mime.textZBaseHTTPServerzhttp.serverZCGIHTTPServerZSimpleHTTPServerZcPicklepickleZqueueZQueuereprlibreprZsocketserverZSocketServer_threadZthreadZtkinterZTkinterZtkinter_dialogZDialogztkinter.dialogZtkinter_filedialogZ
FileDialogztkinter.filedialogZtkinter_scrolledtextZScrolledTextztkinter.scrolledtextZtkinter_simpledialogZSimpleDialogztkinter.simpledialogZtkinter_tixZTixztkinter.tixZtkinter_ttkZttkztkinter.ttkZtkinter_constantsZTkconstantsztkinter.constantsZtkinter_dndZTkdndztkinter.dndZtkinter_colorchooserZtkColorChooserztkinter.colorchooserZtkinter_commondialogZtkCommonDialogztkinter.commondialogZtkinter_tkfiledialogZtkFileDialogZtkinter_fontZtkFontztkinter.fontZtkinter_messageboxZtkMessageBoxztkinter.messageboxZtkinter_tksimpledialogZtkSimpleDialogZurllib_parsez.moves.urllib_parsezurllib.parseZurllib_errorz.moves.urllib_errorzurllib.errorZurllibz.moves.urllibZurllib_robotparserrobotparserzurllib.robotparserZxmlrpc_clientZ	xmlrpclibzxmlrpc.clientZxmlrpc_serverZSimpleXMLRPCServerzxmlrpc.serverZwin32winreg_winregzmoves.z.movesmovesc               @   s   e Zd ZdZdS )Module_six_moves_urllib_parsez7Lazy loading of moved objects in six.moves.urllib_parseN)r   r   r   r   r   r   r   r
   rm   B  s   rm   ZParseResultZurlparseZSplitResultZparse_qsZ	parse_qslZ	urldefragZurljoinZurlsplitZ
urlunparseZ
urlunsplitZ
quote_plusZunquoteZunquote_plusZunquote_to_bytesZ	urlencodeZ
splitqueryZsplittagZ	splituserZ
splitvalueZuses_fragmentZuses_netlocZuses_paramsZ
uses_queryZuses_relativezmoves.urllib_parsezmoves.urllib.parsec               @   s   e Zd ZdZdS )Module_six_moves_urllib_errorz7Lazy loading of moved objects in six.moves.urllib_errorN)r   r   r   r   r   r   r   r
   rn   l  s   rn   ZURLErrorZurllib2Z	HTTPErrorZContentTooShortErrorz.moves.urllib.errorzmoves.urllib_errorzmoves.urllib.errorc               @   s   e Zd ZdZdS )Module_six_moves_urllib_requestz9Lazy loading of moved objects in six.moves.urllib_requestN)r   r   r   r   r   r   r   r
   ro     s   ro   Zurlopenzurllib.requestZinstall_openerZbuild_openerZpathname2urlZurl2pathnameZ
getproxiesZRequestZOpenerDirectorZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZProxyHandlerZBaseHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZHTTPHandlerZHTTPSHandlerZFileHandlerZ
FTPHandlerZCacheFTPHandlerZUnknownHandlerZHTTPErrorProcessorZurlretrieveZ
urlcleanupZ	URLopenerZFancyURLopenerZproxy_bypassZparse_http_listZparse_keqv_listz.moves.urllib.requestzmoves.urllib_requestzmoves.urllib.requestc               @   s   e Zd ZdZdS ) Module_six_moves_urllib_responsez:Lazy loading of moved objects in six.moves.urllib_responseN)r   r   r   r   r   r   r   r
   rp     s   rp   Zaddbasezurllib.responseZaddclosehookZaddinfoZ
addinfourlz.moves.urllib.responsezmoves.urllib_responsezmoves.urllib.responsec               @   s   e Zd ZdZdS )#Module_six_moves_urllib_robotparserz=Lazy loading of moved objects in six.moves.urllib_robotparserN)r   r   r   r   r   r   r   r
   rq     s   rq   ZRobotFileParserz.moves.urllib.robotparserzmoves.urllib_robotparserzmoves.urllib.robotparserc               @   sN   e Zd ZdZg ZedZedZedZ	edZ
edZdd Zd	S )
Module_six_moves_urllibzICreate a six.moves.urllib namespace that resembles the Python 3 namespacezmoves.urllib_parsezmoves.urllib_errorzmoves.urllib_requestzmoves.urllib_responsezmoves.urllib_robotparserc             C   s   dddddgS )Nparseerrorrequestresponseri   r   )r	   r   r   r
   r3     s    zModule_six_moves_urllib.__dir__N)r   r   r   r   rD   	_importerr;   rs   rt   ru   rv   ri   r3   r   r   r   r
   rr     s   




rr   zmoves.urllibc             C   s   t t| j|  dS )zAdd an item to six.moves.N)r   rI   r   )Zmover   r   r
   add_move  s    rx   c             C   sX   yt t|  W nD tk
rR   ytj| = W n" tk
rL   td| f Y nX Y nX dS )zRemove item from six.moves.zno such move, %rN)r   rI   r   rl   __dict__r>   )r   r   r   r
   remove_move  s    rz   __func____self____closure____code____defaults____globals__im_funcZim_selfZfunc_closureZ	func_codeZfunc_defaultsZfunc_globalsc             C   s   |   S )N)next)itr   r   r
   advance_iterator  s    r   c             C   s   t dd t| jD S )Nc             s   s   | ]}d |j kV  qdS )__call__N)ry   )r0   klassr   r   r
   	<genexpr>  s    zcallable.<locals>.<genexpr>)anytype__mro__)r   r   r   r
   callable  s    r   c             C   s   | S )Nr   )unboundr   r   r
   get_unbound_function  s    r   c             C   s   | S )Nr   )r   clsr   r   r
   create_unbound_method#  s    r   c             C   s   | j S )N)r   )r   r   r   r
   r   (  s    c             C   s   t | ||jS )N)types
MethodTyper   )r   r   r   r   r
   create_bound_method+  s    r   c             C   s   t | d |S )N)r   r   )r   r   r   r   r
   r   .  s    c               @   s   e Zd Zdd ZdS )Iteratorc             C   s   t | | S )N)r   __next__)r	   r   r   r
   r   3  s    zIterator.nextN)r   r   r   r   r   r   r   r
   r   1  s   r   z3Get the function out of a possibly unbound functionc             K   s   t | jf |S )N)iterkeys)dkwr   r   r
   iterkeysD  s    r   c             K   s   t | jf |S )N)r   values)r   r   r   r   r
   
itervaluesG  s    r   c             K   s   t | jf |S )N)r   items)r   r   r   r   r
   	iteritemsJ  s    r   c             K   s   t | jf |S )N)r   Zlists)r   r   r   r   r
   	iterlistsM  s    r   r   r   r   c             K   s   | j f |S )N)r   )r   r   r   r   r
   r   V  s    c             K   s   | j f |S )N)r   )r   r   r   r   r
   r   Y  s    c             K   s   | j f |S )N)r   )r   r   r   r   r
   r   \  s    c             K   s   | j f |S )N)r   )r   r   r   r   r
   r   _  s    viewkeys
viewvalues	viewitemsz1Return an iterator over the keys of a dictionary.z3Return an iterator over the values of a dictionary.z?Return an iterator over the (key, value) pairs of a dictionary.zBReturn an iterator over the (key, [values]) pairs of a dictionary.c             C   s
   |  dS )Nzlatin-1)encode)sr   r   r
   bq  s    r   c             C   s   | S )Nr   )r   r   r   r
   ut  s    r   z>BassertCountEqual   ZassertRaisesRegexpZassertRegexpMatchesassertRaisesRegexassertRegexc             C   s   | S )Nr   )r   r   r   r
   r     s    c             C   s   t | dddS )Nz\\z\\\\Zunicode_escape)unicodereplace)r   r   r   r
   r     s    c             C   s   t | d S )Nr   )ord)Zbsr   r   r
   byte2int  s    r   c             C   s   t | | S )N)r   )Zbufir   r   r
   
indexbytes  s    r   ZassertItemsEqualzByte literalzText literalc             O   s   t | t||S )N)r)   _assertCountEqual)r	   argskwargsr   r   r
   r     s    c             O   s   t | t||S )N)r)   _assertRaisesRegex)r	   r   r   r   r   r
   r     s    c             O   s   t | t||S )N)r)   _assertRegex)r	   r   r   r   r   r
   r     s    execc             C   s:   z*|d kr|  }|j |k	r$|||W d d }d }X d S )N)__traceback__with_traceback)r    r,   tbr   r   r
   reraise  s    

r   c             C   sB   |dkr*t d}|j}|dkr&|j}~n|dkr6|}td dS )zExecute code in a namespace.Nr   zexec _code_ in _globs_, _locs_)r   	_getframe	f_globalsf_localsr   )Z_code_Z_globs_Z_locs_framer   r   r
   exec_  s    
r   zedef reraise(tp, value, tb=None):
    try:
        raise tp, value, tb
    finally:
        tb = None
)r   r   zdef raise_from(value, from_value):
    try:
        if from_value is None:
            raise value
        raise value from from_value
    finally:
        value = None
zrdef raise_from(value, from_value):
    try:
        raise value from from_value
    finally:
        value = None
c             C   s   | d S )Nr   )r,   Z
from_valuer   r   r
   
raise_from  s    r   printc        
         s4  | dtj  dkrdS  fdd}d}| dd}|dk	r`t|trNd}nt|ts`td| d	d}|dk	rt|trd}nt|tstd
|rtd|sx| D ]}t|trd}P qW |rtd}td}nd}d}|dkr|}|dkr|}x,t| D ] \}	}|	r|| || qW || dS )z4The new-style print function for Python 2.4 and 2.5.fileNc                sd   t | tst| } t  trVt | trV jd k	rVt dd }|d krHd}|  j|}  |  d S )Nerrorsstrict)	rA   
basestringstrr   r   encodingr)   r   write)datar   )fpr   r
   r     s    



zprint_.<locals>.writeFsepTzsep must be None or a stringendzend must be None or a stringz$invalid keyword arguments to print()
 )popr   stdoutrA   r   r   	TypeError	enumerate)
r   r   r   Zwant_unicoder   r   argnewlineZspacer   r   )r   r
   print_  sL    






r   )r   r   c              O   s<   | dtj}|dd}t| | |r8|d k	r8|  d S )Nr   flushF)getr   r   r   _printr   )r   r   r   r   r   r   r
   r     s
    
zReraise an exception.c                s    fdd}|S )Nc                s   t  | } | _| S )N)r]   wraps__wrapped__)f)assignedupdatedwrappedr   r
   wrapper*  s    zwraps.<locals>.wrapperr   )r   r   r   r   r   )r   r   r   r
   r   (  s    r   c                s&   G  fdddt }t |ddi S )z%Create a base class with a metaclass.c                   s,   e Zd Z fddZe fddZdS )z!with_metaclass.<locals>.metaclassc                s   | |S )Nr   )r   r   
this_basesr   )basesmetar   r
   __new__:  s    z)with_metaclass.<locals>.metaclass.__new__c                s    | S )N)__prepare__)r   r   r   )r   r   r   r
   r   =  s    z-with_metaclass.<locals>.metaclass.__prepare__N)r   r   r   r   classmethodr   r   )r   r   r   r
   	metaclass8  s   r   Ztemporary_classr   )r   r   )r   r   r   r   )r   r   r
   with_metaclass3  s    r   c                s    fdd}|S )z6Class decorator for creating a class with a metaclass.c                s   | j  }|d}|d k	rDt|tr,|g}x|D ]}|| q2W |dd  |dd  t| drp| j|d<  | j| j	|S )N	__slots__ry   __weakref__r   )
ry   copyr   rA   r   r   rE   r   r   	__bases__)r   Z	orig_varsslotsZ	slots_var)r   r   r
   r   E  s    





zadd_metaclass.<locals>.wrapperr   )r   r   r   )r   r
   add_metaclassC  s    r   utf-8r   c             C   s8   t | tr| ||S t | tr$| S tdt|  dS )zCoerce **s** to six.binary_type.

    For Python 2:
      - `unicode` -> encoded to `str`
      - `str` -> `str`

    For Python 3:
      - `str` -> encoded to `bytes`
      - `bytes` -> `bytes`
    znot expecting type '%s'N)rA   	text_typer   binary_typer   r   )r   r   r   r   r   r
   ensure_binaryU  s
    

r   c             C   sX   t | ttfstdt|  tr:t | tr:| ||} ntrTt | trT| ||} | S )zCoerce *s* to `str`.

    For Python 2:
      - `unicode` -> encoded to `str`
      - `str` -> `str`

    For Python 3:
      - `str` -> `str`
      - `bytes` -> decoded to `str`
    znot expecting type '%s')	rA   r   r   r   r   PY2r   r%   decode)r   r   r   r   r   r
   
ensure_strh  s    r   c             C   s8   t | tr| ||S t | tr$| S tdt|  dS )zCoerce *s* to six.text_type.

    For Python 2:
      - `unicode` -> `unicode`
      - `str` -> `unicode`

    For Python 3:
      - `str` -> `str`
      - `bytes` -> decoded to `str`
    znot expecting type '%s'N)rA   r   r   r   r   r   )r   r   r   r   r   r
   ensure_text|  s
    

r   c             C   s2   t r.d| jkrtd| j | j| _dd | _| S )a   
    A decorator that defines __unicode__ and __str__ methods under Python 2.
    Under Python 3 it does nothing.

    To support Python 2 and 3 with a single code base, define a __str__ method
    returning text and apply this decorator to the class.
    __str__zY@python_2_unicode_compatible cannot be applied to %s because it doesn't define __str__().c             S   s   |   dS )Nzutf-8)__unicode__r   )r	   r   r   r
   <lambda>  s    z-python_2_unicode_compatible.<locals>.<lambda>)r   ry   
ValueErrorr   r   r   )r   r   r   r
   python_2_unicode_compatible  s    


r   __spec__)N)NN)r   r   )r   r   )r   r   )r   Z
__future__r   r]   rM   operatorr   r   
__author____version__version_infor   r%   ZPY34r   Zstring_typesintZinteger_typesr   Zclass_typesr   bytesr   maxsizeZMAXSIZEr   ZlongZ	ClassTyper   platform
startswithobjectr   lenOverflowErrorr   r   r   r#   
ModuleTyper/   r4   r6   r   rw   rI   r2   r*   r   r   rA   r:   rl   rm   Z_urllib_parse_moved_attributesrn   Z_urllib_error_moved_attributesro   Z _urllib_request_moved_attributesrp   Z!_urllib_response_moved_attributesrq   Z$_urllib_robotparser_moved_attributesrr   rx   rz   Z
_meth_funcZ
_meth_selfZ_func_closureZ
_func_codeZ_func_defaultsZ_func_globalsr   r   	NameErrorr   r   r   r   r   r   
attrgetterZget_method_functionZget_method_selfZget_function_closureZget_function_codeZget_function_defaultsZget_function_globalsr   r   r   r   methodcallerr   r   r   r   r   chrZunichrZstructZStructZpackZint2byte
itemgetterr   getitemr   r   Z	iterbytesrJ   rK   BytesIOr   r   r   partialrS   r   r   r   r   r)   rN   r   r   r   r   r   WRAPPER_ASSIGNMENTSWRAPPER_UPDATESr   r   r   r   r   r   r   rD   __package__globalsr   r   submodule_search_locations	meta_pathr   r   importerappendr   r   r   r
   <module>   s  

>







































































































5