%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib64/python3.7/site-packages/aiohttp/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/aiohttp/__pycache__/cookiejar.cpython-37.pyc

B

�Z�_�/�@s�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZddlm
Z
mZmZmZmZmZmZmZmZmZddlmZddlmZddlmZmZdd	lmZm Z d
Z!ee"dfZ#Gdd
�d
e�Z$Gdd�de�Z%dS)�N)�defaultdict)�
BaseCookie�Morsel�SimpleCookie)
�DefaultDict�Dict�Iterable�Iterator�Mapping�Optional�Set�Tuple�Union�cast)�URL�)�AbstractCookieJar)�
is_ip_address�next_whole_second)�LooseCookies�PathLike)�	CookieJar�DummyCookieJarzMorsel[str]csxeZdZdZe�d�Ze�d�Ze�d�Ze�dej	�Z
e�d�Zejj
jejjd�Zej�d�Zd	d
dd�eeeejdd
��fdd�Zedd�dd�Zedd�dd�Zdd�dd�Zdd�dd�Zed�dd�Zdd�dd�Z eje!e!dd�d d!�Z"e#�fe$e#dd"�d#d$�Z%e#�fe#e&d%d&�d'd(�Z'e(e!e!ed)�d*d+��Z)e(e!e!ed,�d-d.��Z*e+e!eejd/�d0d1��Z,�Z-S)2rz/Implements cookie storage adhering to RFC 6265.z][\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]*(?P<token>[\x00-\x08\x0A-\x1F\d:a-zA-Z\x7F-\xFF]+)z(\d{1,2}):(\d{1,2}):(\d{1,2})z	(\d{1,2})zG(jan)|(feb)|(mar)|(apr)|(may)|(jun)|(jul)|(aug)|(sep)|(oct)|(nov)|(dec)z	(\d{2,4}))�tzinfoi���FTN)�unsafe�quote_cookie�loop)rrr�returncsrt�j|d�tt�|_t�|_||_||_t	�|_
i|_|j|_
y|j
��Wntk
rl|j|_
YnXdS)N)r)�super�__init__rr�_cookies�set�_host_only_cookies�_unsafe�
_quote_cookier�_next_expiration�_expirations�MAX_TIME�	_max_timeZ	timestamp�
OverflowError�MAX_32BIT_TIME)�selfrrr)�	__class__��D/opt/alt/python37/lib64/python3.7/site-packages/aiohttp/cookiejar.pyr9szCookieJar.__init__)�	file_pathrc	Cs8t�|�}|jdd��}t�|j|tj�WdQRXdS)N�wb)�mode)�pathlib�Path�open�pickle�dumpr ZHIGHEST_PROTOCOL)r+r/�fr-r-r.�savePs
zCookieJar.savec	Cs2t�|�}|jdd��}t�|�|_WdQRXdS)N�rb)r1)r2r3r4r5�loadr )r+r/r7r-r-r.r:Us
zCookieJar.load)rcCs*|j��|j��t�|_|j��dS)N)r �clearr"rr%r&)r+r-r-r.r;Zs

zCookieJar.clearzIterator[Morsel[str]]ccs.|��x |j��D]}|��EdHqWdS)N)�_do_expirationr �values)r+�valr-r-r.�__iter__`szCookieJar.__iter__cCstdd�|D��S)Ncss|]
}dVqdS)rNr-)�.0�ir-r-r.�	<genexpr>fsz$CookieJar.__len__.<locals>.<genexpr>)�sum)r+r-r-r.�__len__eszCookieJar.__len__c
Cs�tj�tjj�}|j|krdS|js(dS|j}g}|j}|j}xZ|��D]N\\}}}||kr�||�	|d�|�
||f�|j�||f�qHt
||�}qHWx|D]
}	||	=q�Wy|jdd�tjdd�|_Wntk
r�|j|_YnXdS)Nr)Zmicrosecondr)�seconds)�datetime�now�timezone�utcr%r&r(r �items�pop�appendr"�discard�min�replace�	timedeltar))
r+rGZnext_expirationZto_del�cookiesZexpirations�domain�name�when�keyr-r-r.r<hs.


zCookieJar._do_expiration)rTrRrSrcCs t|j|�|_||j||f<dS)N)rNr%r&)r+rTrRrSr-r-r.�_expire_cookie�szCookieJar._expire_cookie)rQ�response_urlrc	Cs�|j}|jst|�rdSt|t�r*|��}�x�|D�]�\}}t|t�s\t�}|||<||}|d}|�d�rxd}|d=|s�|dk	r�|j	�
||f�|}|d<|�d�r�|dd�}||d<|r�|�||�s�q2|d}|r�|�d��s|j
}|�d�s�d}nd|d|�d��}||d<|d}	|	�r�yXt|	�}
y tj�tjj�tj|
d	�}Wntk
�rp|j}YnX|�|||�Wntk
�r�d|d<YnXn6|d
}|�r�|�|�}
|
�r�|�|
||�nd|d
<||j||<q2W|��dS)zUpdate cookies.NrR�.�r�path�/zmax-age)rE�expires)�raw_hostr#r�
isinstancer
rJrr�endswithr"�add�
startswith�_is_domain_matchrZ�rfind�intrFrGrHrIrPr)r(rV�
ValueError�_parse_dater r<)r+rQrW�hostnamerS�cookieZtmprRrZZmax_ageZ
delta_secondsZmax_age_expirationr\Zexpire_timer-r-r.�update_cookies�sd





zCookieJar.update_cookies)zBaseCookie[str]zSimpleCookie[str])�request_urlrc	Cs�|��t|�}|jrt�nt�}|jp*d}|jdk}x�|D]�}|j}|d}|s^|j||<q<|j	snt
|�rnq<||f|jkr�||kr�q<n|�||�s�q<|�
|j|d�s�q<|r�|dr�q<td|�|jt���}|�|j|j|j�|||<q<W|S)z8Returns this jar's cookies filtered by their attributes.rY)ZhttpsZwssrRrZZsecurezMorsel[str])r<rr$rrr]ZschemerU�valuer#rr"rb�_is_path_matchrZr�getrr!Zcoded_value)	r+rjZfilteredrgZ
is_not_securerhrSrRZmrsl_valr-r-r.�filter_cookies�s4



zCookieJar.filter_cookies)rRrgrcCsD||krdS|�|�sdS|dt|��}|�d�s:dSt|�S)z0Implements domain matching adhering to RFC 6265.TFNrX)r_�lenr)rRrg�non_matchingr-r-r.rbs

zCookieJar._is_domain_match)�req_path�cookie_pathrcCsP|�d�sd}||krdS|�|�s(dS|�d�r6dS|t|�d�}|�d�S)z.Implements path matching adhering to RFC 6265.r[TFN)rar_ro)rqrrrpr-r-r.rls


zCookieJar._is_path_match)�date_strrc	Cs�|sdSd}d}d}d}d}}}d}	d}
d}x�|j�|�D]�}|�d�}
|s~|j�|
�}|r~d}dd�|��D�\}}}q>|s�|j�|
�}|r�d}t|���}	q>|s�|j�|
�}|r�d}|j	dk	s�t
�|j	}
q>|s>|j�|
�}|r>d}t|���}q>Wd|k�rd	k�r nn
|d
7}n$d|k�r8dk�rDnn|d7}d||||fk�rZdSd
|	k�rrdk�sxndS|dk�s�|dk�s�|dk�s�|dk�r�dStj||
|	|||tj
jd�S)z4Implements date string parsing adhering to RFC 6265.NFr�tokenTcSsg|]}t|��qSr-)rd)r@�sr-r-r.�
<listcomp>;sz)CookieJar._parse_date.<locals>.<listcomp>�F�cil�Ei�r�iA��;)r)�DATE_TOKENS_RE�finditer�group�DATE_HMS_TIME_RE�match�groups�DATE_DAY_OF_MONTH_RErd�
DATE_MONTH_RE�	lastindex�AssertionError�DATE_YEAR_RErFrHrI)�clsrsZ
found_timeZ	found_dayZfound_monthZ
found_yearZhourZminute�secondZdayZmonthZyearZtoken_matchrtZ
time_matchZ	day_matchZmonth_matchZ
year_matchr-r-r.rf#s`

(zCookieJar._parse_date).�__name__�
__module__�__qualname__�__doc__�re�compiler}r�r��Ir�r�rF�maxrOrHrIr'Zutcfromtimestampr*�boolr�asyncio�AbstractEventLooprrr8r:r;r?rdrDr<�strrVrrrirrn�staticmethodrbrl�classmethodrf�
__classcell__r-r-)r,r.r"s>


N*rcs�eZdZdZdd�eejdd��fdd�Zdd�d	d
�Ze	d�dd�Z
dd�d
d�Ze�fe
edd�dd�Zedd�dd�Z�ZS)rzxImplements a dummy cookie storage.

    It can be used with the ClientSession when no cookie processing is needed.

    N)r)rrcst�j|d�dS)N)r)rr)r+r)r,r-r.rmszDummyCookieJar.__init__zIterator[Morsel[str]])rccsdS)Nr-)r+r-r-r.r?pszDummyCookieJar.__iter__cCsdS)Nrr-)r+r-r-r.rDtszDummyCookieJar.__len__cCsdS)Nr-)r+r-r-r.r;wszDummyCookieJar.clear)rQrWrcCsdS)Nr-)r+rQrWr-r-r.rizszDummyCookieJar.update_cookieszBaseCookie[str])rjrcCst�S)N)r)r+rjr-r-r.rn}szDummyCookieJar.filter_cookies)r�r�r�r�rr�r�rr?rdrDr;rrrirnr�r-r-)r,r.rfs r)&r�rF�osr2r5r��collectionsrZhttp.cookiesrrr�typingrrrr	r
rrr
rrZyarlr�abcrZhelpersrrZtypedefsrr�__all__r�Z
CookieItemrrr-r-r-r.�<module>s$0
F

Zerion Mini Shell 1.0