o
    n~b                     @   s*  d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlm	Z	m
Z
mZmZmZmZ d dlmZmZ d dlZd dlZddlmZmZ dd	dd	d
Ze ZdedefddZG dd dZeG dd dZdd ZdZe edd a e edd a!edd Z"edd Z#eeeddd Z$dS )!    N)MappingSequence)
ip_address)SplitResult	parse_qslurljoinurlsplit
urlunsplitquote)	MultiDictMultiDictProxy   )_Quoter	_UnquoterP   i  )httphttpswswssobjreturnc                 C   s
   d| _ | S )NZyarl)
__module__)r    r   4/usr/local/lib/python3.10/dist-packages/yarl/_url.pyrewrite_module   s   r   c                   @   s,   e Zd ZdZdd ZefddZdd ZdS )	cached_propertyaR  Use as a class method decorator.  It operates almost exactly like
    the Python `@property` decorator, but it puts the result of the
    method it decorates into the instance dict after the first call,
    effectively replacing the function it decorates with an instance
    variable.  It is, in Python parlance, a data descriptor.

    c                 C   s8   || _ z|j| _W n ty   d| _Y nw |j| _d S )N )wrapped__doc__AttributeError__name__name)selfr   r   r   r   __init__$   s   
zcached_property.__init__c                 C   sB   |d u r| S |j | j|}||ur|S | |}||j | j< |S N)_cachegetr!   r   )r"   instowner	_sentinelvalr   r   r   __get__,   s   
zcached_property.__get__c                 C   s   t d)Nzcached property is read-only)r   )r"   r'   valuer   r   r   __set__6      zcached_property.__set__N)r    r   __qualname__r   r#   sentinelr+   r-   r   r   r   r   r      s
    
r   c                   @   sp  e Zd ZdZeddZe ZeddddZedddZedd	d
ddZ	edd	d
dZ
edd
ddZedddZeddZe ZeddZed
dZddddddZeddddddddddddddZdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Z d3e!fd4d5Z"d6d7 Z#d8d9 Z$d:d; Z%d<d= Z&d>d? Z'd@dA Z(e)dBdC Z*e)dDdE Z+e,dFdG Z-e)dHdI Z.e,dJdK Z/e)dLdM Z0e,dNdO Z1e)dPdQ Z2e,dRdS Z3e)dTdU Z4e)dVdW Z5e)dXdY Z6e,dZd[ Z7e,d\d] Z8e)d^d_ Z9e,d`da Z:e,dbdc Z;e,ddde Z<e)dfdg Z=e,dhdi Z>e,djdk Z?e,dldm Z@e,dndo ZAe,dpdq ZBe,drds ZCeDdtdu ZEedvdw ZFeGjHdxkrdeddydzZInedd{dzZIe	dd|d}ZJd~d ZKdd ZLdd ZMdd ZNdd ZOddddZPedd ZQeDdd ZRdd ZSdd ZTdd ZUdd ZVdd ZWdd ZXdd ZYdS )URL)r%   _valF)requotez@:z/+)safe	protectedr3   )r4   r5   z?/:@z=+&;T)r4   r5   qsr3   )r4   r5   r6   )r4   r6   r3   )r4   r3   )r4   +)unsafe)r6   r   N)encodedstrictc             
   C   sZ  |d ur	t d t|| u r|S t|tu rt|}nt|tu r)|s(tdnt|tr5tt|}ntd|s|d sDd}d}n/|j	}|d u rOtdz|j
}W n tye } ztd|d }~ww | j|j|j||ddd	}| |d
 }|r| |}| j||d | |d }	| |d }
t|d |||	|
}t| }||_i |_|S )Nzstrict parameter is ignoredz$Cannot apply decoding to SplitResultz#Constructor parameter should be strr   r   z/Invalid URL: host is required for absolute urlsz/Invalid URL: port can't be converted to integerT)encoder3      hostpath      r   )warningswarntypestrr   r   
ValueError
isinstance	TypeErrorhostnameport_make_netlocusernamepassword_PATH_REQUOTER_normalize_path _validate_authority_uri_abs_path_QUERY_REQUOTER_FRAGMENT_REQUOTERobject__new__r2   r%   )clsr*   r9   r:   netlocr>   rJ   er?   queryfragmentr"   r   r   r   rT      sX   





zURL.__new__)scheme	authorityuserrM   r>   rJ   r?   rX   query_stringrY   r9   c                C   s@  |r|s
|s
|s
|rt d|r|st d|r|	rt d|du s2|du s2|du s2|	du s2|
du r6td|rT|r=|}n/td|ddd}| j|j|j|j|jdd}n|s_|s_|s_|s_d}n| j||||| | d	}|s| |}|rz| 	|}| j
||d
 | |	}	| |
}
| t||||	|
dd}|r||S |S )zCreates and returns a new URLz@Can't mix "authority" with "user", "password", "host" or "port".z/Can't build URL with "port" but without "host".z6Only one of "query" or "query_string" should be passedNzuNoneType is illegal for "scheme", "authority", "path", "query_string", and "fragment" args, use empty string instead.r   T)r;   )r;   encode_hostr=   r9   )rF   rH   r   rK   rL   rM   rI   rJ   _PATH_QUOTERrO   rP   _QUERY_QUOTER_FRAGMENT_QUOTER
with_query)rU   rZ   r[   r\   rM   r>   rJ   r?   rX   r]   rY   r9   rV   tmpurlr   r   r   build   s\   




z	URL.buildc                 C   s   t d| )Nz-Inheriting a class {!r} from URL is forbidden)rH   format)rU   r   r   r   __init_subclass__     zURL.__init_subclass__c                 C   s4   | j }|js|  r|js|jr|jdd}t|S N/r?   )r2   r?   is_absoluterX   rY   _replacer	   r"   r*   r   r   r   __str__
  s   zURL.__str__c                 C   s   d | jjt| S )Nz{}('{}'))rg   	__class__r    rE   r"   r   r   r   __repr__  s   zURL.__repr__c                 C   s   t | dS )Nascii)rE   r;   rr   r   r   r   	__bytes__  ri   zURL.__bytes__c                 C   sX   t |turtS | j}|js|  r|jdd}|j}|js(| r(|jdd}||kS rj   )rD   r1   NotImplementedr2   r?   rm   rn   )r"   otherZval1Zval2r   r   r   __eq__  s   z
URL.__eq__c                 C   sJ   | j d}|d u r#| j}|js|  r|jdd}t| }| j d< |S )Nhashrk   rl   )r%   r&   r2   r?   rm   rn   ry   )r"   retr*   r   r   r   __hash__$  s   zURL.__hash__c                 C   s   t |turtS | j|jkS r$   rD   r1   rv   r2   r"   rw   r   r   r   __le__-     z
URL.__le__c                 C   s   t |turtS | j|jk S r$   r|   r}   r   r   r   __lt__2  r   z
URL.__lt__c                 C   s   t |turtS | j|jkS r$   r|   r}   r   r   r   __ge__7  r   z
URL.__ge__c                 C   s   t |turtS | j|jkS r$   r|   r}   r   r   r   __gt__<  r   z
URL.__gt__c                 C   s   |  |}|drtd|| jj}|dkrd| }n|s'|  s'|}n|dd}|	| d
|}|  rB| |}t| jj|dddddS )Nrk   z4Appending path {!r} starting from slash is forbiddenr   r?   rX   rY   Tr_   )r`   
startswithrF   rg   r2   r?   rm   rstripsplitappendjoinrO   r1   rn   )r"   r!   r?   new_pathpartsr   r   r   __truediv__A  s$   





zURL.__truediv__c                 C   s
   |  |S r$   )update_query)r"   rX   r   r   r   __mod__V  s   
zURL.__mod__r   c                 C   s$   t | jjp| jjp| jjp| jjS r$   )boolr2   rV   r?   rX   rY   rr   r   r   r   __bool__Y  s   zURL.__bool__c                 C   s   | j fS r$   )r2   rr   r   r   r   __getstate__^  r.   zURL.__getstate__c                 C   s>   |d d u rt |d tr|d d | _n|^| _}i | _d S )Nr   r   r2   )rG   dictr2   r%   )r"   stateZunusedr   r   r   __setstate__a  s   

zURL.__setstate__c                 C   s
   | j duS )zA check for absolute URLs.

        Return True for absolute ones (having scheme or starting
        with //), False otherwise.

        N)raw_hostrr   r   r   r   rm   i  s   
zURL.is_absolutec                 C   s0   | j du rdS t| j}|du rdS | j |kS )zA check for default port.

        Return True if port is default for specified scheme,
        e.g. 'http://python.org' or 'http://python.org:80', False
        otherwise.

        NF)rJ   DEFAULT_PORTSr&   rZ   )r"   defaultr   r   r   is_default_portr  s   

zURL.is_default_portc                 C   sX   |   std| jjstd| j}| dd|j|j}|j|dddd}t|ddS )z}Return an URL with scheme, host and port parts only.

        user, password, path, query and fragment are removed.

        URL should be absolutezURL should have schemeNr   )rV   r?   rX   rY   Tr_   )	rm   rF   r2   rZ   rK   rI   rJ   rn   r1   )r"   vrV   r*   r   r   r   origin  s   z
URL.originc                 C   s,   |   std| jjddd}t|ddS )zhReturn a relative part of the URL.

        scheme, user, password, host and port are removed.

        r   r   )rZ   rV   Tr_   )rm   rF   r2   rn   r1   ro   r   r   r   relative  s   zURL.relativec                 C      | j jS )zdScheme for absolute URLs.

        Empty string for relative URLs or URLs starting with //

        )r2   rZ   rr   r   r   r   rZ        z
URL.schemec                 C   r   )zQEncoded authority part of URL.

        Empty string for relative URLs.

        )r2   rV   rr   r   r   r   raw_authority  r   zURL.raw_authorityc                 C   s   | j | j| j| j| jddS )zQDecoded authority part of URL.

        Empty string for relative URLs.

        Fr^   )rK   r\   rM   r>   rJ   rr   r   r   r   r[     s   zURL.authorityc                 C   s   | j j}|sdS |S )zEEncoded user part of URL.

        None if user is missing.

        N)r2   rL   r"   rz   r   r   r   raw_user  s   zURL.raw_userc                 C      |  | jS )zEDecoded user part of URL.

        None if user is missing.

        )	_UNQUOTERr   rr   r   r   r   r\        zURL.userc                 C   r   )zMEncoded password part of URL.

        None if password is missing.

        )r2   rM   rr   r   r   r   raw_password  r   zURL.raw_passwordc                 C   r   )zMDecoded password part of URL.

        None if password is missing.

        )r   r   rr   r   r   r   rM     r   zURL.passwordc                 C   r   )zDEncoded host part of URL.

        None for relative URLs.

        )r2   rI   rr   r   r   r   r     s   	zURL.raw_hostc                 C   s&   | j }|du r	dS d|v r|S t|S )zDDecoded host part of URL.

        None for relative URLs.

        N%)r   _idna_decode)r"   rawr   r   r   r>     s   zURL.hostc                 C   s   | j jp
t| j jS )zPort part of URL, with scheme-based fallback.

        None for relative URLs or URLs without explicit port and
        scheme without default port substitution.

        )r2   rJ   r   r&   rZ   rr   r   r   r   rJ     s   zURL.portc                 C   r   )zyPort part of URL, without scheme-based fallback.

        None for relative URLs or URLs without explicit port.

        )r2   rJ   rr   r   r   r   explicit_port  r   zURL.explicit_portc                 C   s   | j j}|s|  rd}|S )zNEncoded path of URL.

        / for absolute URLs without path part.

        rk   )r2   r?   rm   r   r   r   r   raw_path  s   zURL.raw_pathc                 C   r   )zNDecoded path of URL.

        / for absolute URLs without path part.

        )_PATH_UNQUOTERr   rr   r   r   r   r?     r   zURL.pathc                 C   s   t t| jdd}t|S )zA MultiDictProxy representing parsed query parameters in decoded
        representation.

        Empty value if URL has no query part.

        Tkeep_blank_values)r   r   raw_query_stringr   r   r   r   r   rX   %  s   z	URL.queryc                 C   r   )zOEncoded query part of URL.

        Empty string if query is missing.

        )r2   rX   rr   r   r   r   r   0  r   zURL.raw_query_stringc                 C   r   )zODecoded query part of URL.

        Empty string if query is missing.

        )_QS_UNQUOTERr   rr   r   r   r   r]   9  r   zURL.query_stringc                 C      | j s| jS d| j| j S )zDecoded path of URL with query.{}?{})r]   r?   rg   rr   r   r   r   path_qsB     zURL.path_qsc                 C   r   )zEncoded path of URL with query.r   )r   r   rg   rr   r   r   r   raw_path_qsI  r   zURL.raw_path_qsc                 C   r   )zUEncoded fragment part of URL.

        Empty string if fragment is missing.

        )r2   rY   rr   r   r   r   raw_fragmentP  r   zURL.raw_fragmentc                 C   r   )zUDecoded fragment part of URL.

        Empty string if fragment is missing.

        )r   r   rr   r   r   r   rY   Y  r   zURL.fragmentc                 C   s~   | j j}|  r!|sdg}t|S dg|dd d }t|S |dr6dg|dd d }t|S |d}t|S )zjA tuple containing encoded *path* parts.

        ('/',) for absolute URLs if *path* is missing.

        rk   r   N)r2   r?   rm   r   r   tuple)r"   r?   r   r   r   r   	raw_partsb  s   

zURL.raw_partsc                    s   t  fdd jD S )zjA tuple containing decoded *path* parts.

        ('/',) for absolute URLs if *path* is missing.

        c                 3   s    | ]}  |V  qd S r$   )r   ).0partrr   r   r   	<genexpr>}  s    zURL.parts.<locals>.<genexpr>)r   r   rr   r   rr   r   r   v  s   z	URL.partsc                 C   sp   | j }|r	|dkr| js| jrt| jjdddddS | S |d}| jjd|dd ddd}t|ddS )	z]A new URL with last part of path removed and cleaned up query and
        fragment.

        rk   r   )rX   rY   Tr_   Nr   )r   r   r   r1   r2   rn   r   r   )r"   r?   r   r*   r   r   r   parent  s   
 z
URL.parentc                 C   s2   | j }|  r|dd }|sdS |d S |d S )zThe last part of raw_parts.r   Nr   r   )r   rm   )r"   r   r   r   r   raw_name  s   zURL.raw_namec                 C   r   )zThe last part of parts.)r   r   rr   r   r   r   r!     s   zURL.namec                 C   s6   t | dkrt |dkr|dstddS dS dS )znEnsure that path in URL with authority starts with a leading slash.

        Raise ValueError if not.
        r   rk   zCPath in a URL with authority should start with a slash ('/') if setN)lenr   rF   r=   r   r   r   rP     s
   "z$URL._validate_authority_uri_abs_pathc              	   C   st   | d}g }|D ] }|dkrz|  W q	 ty   Y q	w |dkr$q	|| q	|d dv r5|d d|S )Nrk   ...r   r   r   r   )r   pop
IndexErrorr   r   )rU   r?   segmentsresolved_pathsegr   r   r   rO     s   


zURL._normalize_path)r@      c                 C   s   z| d\}}}t|}W n ty*   | }|s| r#| Y S t|}Y |S w |j}|r6|d| 7 }|jdkrAd| d }|S )Nr      [])	partitionr   rF   lowerisascii_idna_encode
compressedversion)rU   r>   humanipsepzoner   r   r   _encode_host  s    


zURL._encode_hostc                 C   s   z| d\}}}t|}W n' ty5   | }|r| Y S |D ]}|dkr) nq!| Y S t|}Y |S w |j}|rA|d| 7 }|jdkrLd| d }|S )Nr   r   r   r   )r   r   rF   r   r   r   r   )rU   r>   r   r   r   r   charr   r   r   r     s*   

c           
      C   s   |r| j n| j}|r| |}	n|}	|r|	d t| }	|d ur8|s%d}n|r+||}|r1||}|d | }n|r@|r@||}|rH|d |	 }	|	S )N:r   @)	_REQUOTER_QUOTERr   rE   )
rU   r\   rM   r>   rJ   r;   r^   r3   quoterrz   r   r   r   rK     s&   zURL._make_netlocc                 C   s<   t |ts	td|  stdt| jj| dddS )z&Return a new URL with scheme replaced.zInvalid scheme typez3scheme replacement is not allowed for relative URLs)rZ   Tr_   )	rG   rE   rH   rm   rF   r1   r2   rn   r   )r"   rZ   r   r   r   with_scheme  s
   
zURL.with_schemec                 C   sn   | j }|du r
d}nt|tr| |}|j}ntd|  s$tdt| j j	| 
|||j|jdddS )zReturn a new URL with user replaced.

        Autoencode user if needed.

        Clear user/password if user is None.

        NzInvalid user typez1user replacement is not allowed for relative URLsrV   Tr_   )r2   rG   rE   r   rM   rH   rm   rF   r1   rn   rK   rI   rJ   )r"   r\   r*   rM   r   r   r   	with_user  s   	

zURL.with_userc                 C   sf   |du rnt |tr| |}ntd|  std| j}t| jj| 	|j
||j|jdddS )zReturn a new URL with password replaced.

        Autoencode password if needed.

        Clear password if argument is None.

        NzInvalid password typez5password replacement is not allowed for relative URLsr   Tr_   )rG   rE   r   rH   rm   rF   r2   r1   rn   rK   rL   rI   rJ   )r"   rM   r*   r   r   r   with_password7  s   	
zURL.with_passwordc                 C   s\   t |ts	td|  std|std| j}t| jj| |j	|j
||jdddS )zReturn a new URL with host replaced.

        Autoencode host if needed.

        Changing host for relative URLs is not allowed, use .join()
        instead.

        zInvalid host typez1host replacement is not allowed for relative URLszhost removing is not allowedr   Tr_   )rG   rE   rH   rm   rF   r2   r1   rn   rK   rL   rM   rJ   )r"   r>   r*   r   r   r   	with_hostP  s   

zURL.with_hostc                 C   sb   |durt |tstdt||  std| j}t| jj	| 
|j|j|j|dddS )z`Return a new URL with port replaced.

        Clear port to default if None is passed.

        Nz"port should be int or None, got {}z1port replacement is not allowed for relative URLsr   Tr_   )rG   intrH   rg   rD   rm   rF   r2   r1   rn   rK   rL   rM   rI   )r"   rJ   r*   r   r   r   	with_porth  s   zURL.with_portr_   c                C   sZ   |s|  |}|  r| |}t|dkr |d dkr d| }t| jj|dddddS )z$Return a new URL with path replaced.r   rk   r   r   Tr_   )r`   rm   rO   r   r1   r2   rn   )r"   r?   r9   r   r   r   	with_path{  s   

zURL.with_pathc                 c   sf    |D ]-\}}t |ttfr"|D ]}||d || | V  qq||d || | V  qd S )N=)rG   listr   
_query_var)rU   r   pairskeyr*   r   r   r   r   _query_seq_pairs  s   zURL._query_seq_pairsc                 C   s~   t | }t|tr| S t|tr(t| rtdt| r"tdtt| S t|tr7|t	ur7tt| S t
d| |)Nzfloat('inf') is not supportedzfloat('nan') is not supportedzMInvalid variable type: value should be str, int or float, got {!r} of type {})rD   
issubclassrE   floatmathisinfrF   isnanr   r   rH   rg   )r   rU   r   r   r   r     s   



zURL._query_varc                    s   |rt |dkrtd|}nt |dkr|d }ntd|d u r&d}|S t|tr;j d | }|S t|trG	|}|S t|t
ttfrStdt|trjj d fdd|D }|S td	)
Nr   z7Either kwargs or single query parameter must be presentr   r   &zAInvalid query type: bytes, bytearray and memoryview are forbiddenc                 3   s.    | ]\}} |d    | V  qdS )r   N)r   r   kr   r   r"   r   r   r     s    
z%URL._get_str_query.<locals>.<genexpr>zRInvalid query type: only str, mapping or sequence of (key, value) pairs is allowed)r   rF   rG   r   _QUERY_PART_QUOTERr   r   itemsrE   ra   bytes	bytearray
memoryviewrH   r   )r"   argskwargsrX   r   r   r   _get_str_query  s@   




	zURL._get_str_queryc                 O   s,   | j |i |}t| jj| jj|dddS )a[  Return a new URL with query part replaced.

        Accepts any Mapping (e.g. dict, multidict.MultiDict instances)
        or str, autoencode the argument if needed.

        A sequence of (key, value) pairs is supported as well.

        It also can take an arbitrary number of keyword arguments.

        Clear query if None is passed.

        )r?   rX   Tr_   )r   r1   r2   rn   r?   )r"   r   r   	new_queryr   r   r   rc     s   zURL.with_queryc                 O   sP   | j |i |}tt|dd}t| j}|| t| jj|  |dddS )z)Return a new URL with query part updated.Tr   )rX   r_   )r   r   r   rX   updater1   r2   rn   )r"   r   r   sr   rX   r   r   r   r     s
   

zURL.update_queryc                 C   sN   |du rd}nt |tstd| |}| j|kr| S t| jj|dddS )zReturn a new URL with fragment replaced.

        Autoencode fragment if needed.

        Clear fragment to default if None is passed.

        Nr   zInvalid fragment type)rY   Tr_   )rG   rE   rH   rb   r   r1   r2   rn   )r"   rY   r   r   r   r   with_fragment  s   	


zURL.with_fragmentc                 C   s   t |ts	tdd|v rtd| |}|dv rtdt| j}|  r<t|dkr3|	| n||d< d|d	< n||d< |d	 dkrJd|d	< t
| jjd|ddd
ddS )zReturn a new URL with name (last part of path) replaced.

        Query and fragment parts are cleaned up.

        Name is encoded if needed.

        zInvalid name typerk   zSlash in name is not allowedr   z. and .. values are forbiddenr   r   r   r   r   Tr_   )rG   rE   rH   rF   r`   r   r   rm   r   r   r1   r2   rn   r   )r"   r!   r   r   r   r   	with_name  s(   
	


zURL.with_namec                 C   s,   t |ts	tdttt| t|ddS )u_  Join URLs

        Construct a full (“absolute”) URL by combining a “base URL”
        (self) with another URL (url).

        Informally, this uses components of the base URL, in
        particular the addressing scheme, the network location and
        (part of) the path, to provide missing components in the
        relative URL.

        zurl should be URLTr_   )rG   r1   rH   r   rE   )r"   re   r   r   r   r     s   
zURL.joinc              
   C   s   t | jd}t | jd}| j}|r| j| jdd}t | jd}ddd | j D }t | j	d}t
t| j| j|||| jjd	d
|||S )z<Return decoded human readable string for URL representation.z#/:?@T)r   z#?r   c                 s   s,    | ]\}}d  t|dt|dV  qdS )z{}={}z#&+;=N)rg   _human_quoter   r   r   r   r   2  s
    
z!URL.human_repr.<locals>.<genexpr>r   Fr   )r  r\   rM   r>   r   r?   r   rX   r   rY   r	   r   rZ   rK   r2   rJ   )r"   r\   rM   r>   r?   r]   rY   r   r   r   
human_repr*  s2   
zURL.human_repr)r   )F)FTF)Zr    r   r/   	__slots__r   r   r   r`   rN   ra   rQ   r   rb   rR   r   r   r   r   rT   classmethodrf   rh   rp   rs   ru   rx   r{   r~   r   r   r   r   r   r   r   r   r   rm   r   r   r   propertyrZ   r   r   r[   r   r\   r   rM   r   r>   rJ   r   r   r?   rX   r   r]   r   r   r   rY   r   r   r   r   r!   staticmethodrP   rO   sysversion_infor   rK   r   r   r   r   r   r   r   r   r   rc   r   r   r   r   r  r   r   r   r   r1   :   s    G



0E		











	


















	


(	 r1   c                 C   sT   | s| S d| D ]}|| v r|  |dt|} q|  r | S ddd | D S )Nr   z%{:02X}r   c                 s   s$    | ]}|  r
|nt|V  qd S r$   )isprintabler
   )r   cr   r   r   r   P  s   " z_human_quote.<locals>.<genexpr>)replacerg   ordr	  r   )r   r8   r
  r   r   r   r  H  s   r     c                 C   s6   z	t | dW S  ty   | dd Y S w )Nrt   idna)r  decoder;   UnicodeError)r   r   r   r   r   V  s
   r   c                 C   s:   zt j| dddW S  ty   | dd Y S w )NT)uts46rt   r  )r  r;   r  r  )r>   r   r   r   r   ^  s
   r   c                   C   s   t   t  d S r$   )r   cache_clearr   r   r   r   r   r  f  s   r  c                   C   s   t  t dS )N)Zidna_encodeZidna_decode)r   
cache_infor   r   r   r   r   r  l  s   r  Zidna_encode_sizeZidna_decode_sizec                 C   s$   t | tjat |tjad S r$   )	functools	lru_cacher   __wrapped__r   r  r   r   r   cache_configuret  s   r  )%r  r  rB   collections.abcr   r   	ipaddressr   urllib.parser   r   r   r   r	   r
   Z	multidictr   r   r  r   Z_quotingr   r   r   rS   r0   r   r   r1   r  	_MAXCACHEr  r   r   r  r  r  r   r   r   r   <module>   sH             



