ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/cookiejar.cpython-38.pyc

U

'�7`�/�@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�DummyCookieJar�Morsel[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})�Ztzinfoi���FTN)�unsafe�quote_cookie�loop)rrr�returncsrt�j|d�tt�|_t�|_||_||_t	�|_
i|_|j|_
z|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/python38/lib64/python3.8/site-packages/aiohttp/cookiejar.pyr"9s�zCookieJar.__init__)�	file_pathrc	Cs8t�|�}|jdd��}t�|j|tj�W5QRXdS)N�wb��mode)�pathlib�Path�open�pickle�dumpr#ZHIGHEST_PROTOCOL�r.r3�fr1r1r2�savePs
zCookieJar.savec	Cs2t�|�}|jdd��}t�|�|_W5QRXdS)N�rbr5)r7r8r9r:�loadr#r<r1r1r2r@Us
zCookieJar.load�rcCs*|j��|j��t�|_|j��dS�N)r#�clearr%rr(r)�r.r1r1r2rCZs

zCookieJar.clear�Iterator[Morsel[str]]ccs*|��|j��D]}|��EdHqdSrB)�_do_expirationr#�values)r.�valr1r1r2�__iter__`szCookieJar.__iter__cCstdd�|D��S)Ncss|]
}dVqdS)rNr1)�.0�ir1r1r2�	<genexpr>fsz$CookieJar.__len__.<locals>.<genexpr>)�sumrDr1r1r2�__len__eszCookieJar.__len__c
Cs�tj�tjj�}|j|krdS|js(dS|j}g}|j}|j}|��D]N\\}}}||kr�||�	|d�|�
||f�|j�||f�qFt
||�}qF|D]
}	||	=q�z|jdd�tjdd�|_Wntk
r�|j|_YnXdS)Nr)Zmicrosecondr�Zseconds)�datetime�now�timezone�utcr(r)r+r#�items�pop�appendr%�discard�min�replace�	timedeltar,)
r.rQZnext_expirationZto_del�cookiesZexpirations�domain�name�when�keyr1r1r2rFhs2
�
�
zCookieJar._do_expiration)r^r\r]rcCs t|j|�|_||j||f<dSrB)rXr(r))r.r^r\r]r1r1r2�_expire_cookie�szCookieJar._expire_cookie�r[�response_urlrc	Cs�|j}|jst|�rdSt|t�r*|��}|D�]�\}}t|t�sXt�}|||<||}|d}|�d�rtd}|d=|s�|dk	r�|j	�
||f�|}|d<|�d�r�|dd�}||d<|r�|�||�s�q.|d}|r�|�d��s|j
}|�d�s�d}nd|d|�d��}||d<|d}	|	�r�zXt|	�}
z tj�tjj�tj|
d	�}Wntk
�rl|j}YnX|�|||�Wntk
�r�d|d<YnXn6|d
}|�r�|�|�}
|
�r�|�|
||�nd|d
<||j||<q.|��dS)zUpdate cookies.Nr\�.�r�path�/zmax-agerO�expires)�raw_hostr&r�
isinstancer
rTrr�endswithr%�add�
startswith�_is_domain_matchre�rfind�intrPrQrRrSrZr,r+r`�
ValueError�_parse_dater#rF)r.r[rb�hostnamer]�cookieZtmpr\reZmax_ageZ
delta_secondsZmax_age_expirationrgZexpire_timer1r1r2�update_cookies�sh




�
�
zCookieJar.update_cookies)�BaseCookie[str]zSimpleCookie[str]��request_urlrc	Cs�|��t|�}|jrt�nt�}|jp*d}|jdk}|D]�}|j}|d}|s\|j||<q:|j	slt
|�rlq:||f|jkr�||kr�q:n|�||�s�q:|�
|j|d�s�q:|r�|dr�q:td|�|jt���}|�|j|j|j�|||<q:|S)z8Returns this jar's cookies filtered by their attributes.rd)ZhttpsZwssr\reZsecurer)rFrr'rrrhZschemer_�valuer&rr%rm�_is_path_matchrer�getrr$Zcoded_value)	r.rwZfilteredrrZ
is_not_securersr]r\Zmrsl_valr1r1r2�filter_cookies�s6�



zCookieJar.filter_cookies)r\rrrcCsD||krdS|�|�sdS|dt|��}|�d�s:dSt|�S)z0Implements domain matching adhering to RFC 6265.TFNrc)rj�lenr)r\rr�non_matchingr1r1r2rms

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.rfTFN)rlrjr|)r~rr}r1r1r2rys


zCookieJar._is_path_match)�date_strrc	Cs�|sdSd}d}d}d}d}}}d}	d}
d}|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<d|k�rd	k�rnn
|d
7}n$d|k�r4dk�r@nn|d7}d||||fk�rVdSd
|	k�rndk�stndS|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|��qSr1)ro)rJ�sr1r1r2�
<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_REro�
DATE_MONTH_RE�	lastindex�AssertionError�DATE_YEAR_RErPrRrS)�clsr�Z
found_timeZ	found_dayZfound_monthZ
found_yearZhourZminute�secondZdayZmonthZyearZtoken_matchr�Z
time_matchZ	day_matchZmonth_matchZ
year_matchr1r1r2rq#sn

(�zCookieJar._parse_date).�__name__�
__module__�__qualname__�__doc__�re�compiler�r�r��Ir�r�rP�maxrYrRrSr*Zutcfromtimestampr-�boolr�asyncio�AbstractEventLoopr"rr>r@rCrIrorNrF�strr`rrrtrr{�staticmethodrmry�classmethodrq�
__classcell__r1r1r/r2r"sR�

�
��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.

    Nr )rrcst�j|d�dSr)r!r")r.rr/r1r2r"mszDummyCookieJar.__init__rErAccsdSrBr1rDr1r1r2rIpszDummyCookieJar.__iter__cCsdS)Nrr1rDr1r1r2rNtszDummyCookieJar.__len__cCsdSrBr1rDr1r1r2rCwszDummyCookieJar.clearracCsdSrBr1)r.r[rbr1r1r2rtzszDummyCookieJar.update_cookiesrurvcCst�SrB)r)r.rwr1r1r2r{}szDummyCookieJar.filter_cookies)r�r�r�r�rr�r�r"rIrorNrCrrrtr{r�r1r1r/r2rfs r)&r�rP�osr7r:r��collectionsrZhttp.cookiesrrr�typingrrrr	r
rrr
rrZyarlr�abcrZhelpersrrZtypedefsrr�__all__r�Z
CookieItemrrr1r1r1r2�<module>s$0
F

Zerion Mini Shell 1.0