hddlmZddlZddlZddlmZmZmZddlmZm Z m Z ddl m Z m Z mZe rddlmZdZdddZddZGddZGddeZGddeZGddeZdS)) annotationsN)datetime timedeltatimezone) formatdate parsedate parsedate_tz) TYPE_CHECKINGAnyMapping) HTTPResponsez%a, %d %b %Y %H:%M:%S GMTdeltardatedatetime | NonereturnrcL|ptjtj}||zSN)rnowrutc)rrs /builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/cachecontrol/heuristics.py expire_afterrs"  -8< --D %<dtstrchttj|Sr)rcalendartimegm timetuple)rs rdatetime_to_headerrs" hobllnn55 6 66rc&eZdZd dZd dZd dZd S) BaseHeuristicresponser r str | NonecdS)a! Return a valid 1xx warning header value describing the cache adjustments. The response is provided too allow warnings like 113 http://tools.ietf.org/html/rfc7234#section-5.5.4 where we need to explicitly say response is over 24 hours old. z110 - "Response is Stale"selfr"s rwarningzBaseHeuristic.warnings +*rdict[str, str]ciS)zUpdate the response headers with any new headers. NOTE: This SHOULD always include some Warning header to signify that the response was cached by the client, not by way of the provided headers. r%r&s rupdate_headerszBaseHeuristic.update_headers's  rc||}|rM|j|||}||jd|i|S)NWarning)r+headersupdater()r'r"updated_headerswarning_header_values rapplyzBaseHeuristic.apply0so--h77  K   # #O 4 4 4#'<<#9#9 #/ ''4H(IJJJrNr"r rr#r"r rr))r"r rr )__name__ __module__ __qualname__r(r+r2r%rrr!r!sP + + + +      rr!ceZdZdZddZdS) OneDayCachezM Cache the response by providing an expires 1 day in the future. r"r rr)ci}d|jvrlt|jd}ttdt |dddt ji}t||d<d|d <|S) Nexpiresr)daystzinfo)rpublic cache-control)r.rrrrrrr)r'r"r.rr;s rr+zOneDayCache.update_headersBs H, , ,X-f566D"q!!!tBQBx= ==G"4G! ,-respr rr)cB|j}d|vriSd|vr|ddkriS|j|jvriSd|vsd|vriSt|d}|Jt j|dd}t |d}|iStj}td||z }|t j|z }tdt|dz d } | |kriS|| z} dtj ttj | iS) Nr;rAr@rz last-modifiedr>r iQ) r.statuscacheable_by_default_statusesr rrrtimemaxminstrftimeTIME_FMTgmtime) r'rYr. time_tupler last_modifiedr current_agerfreshness_lifetimer;s rr+zLastModified.update_headers|sD%)\   I g % %'/*Bh*N*NI ;d@ @ @I  O7$B$BI!'&/22 %%%z"1"~..!'/":;;  Iikk!S4Z(( x}555 C I$>$>??  , ,I++4=4;w3G3GHHIIrr#cdSrr%)r'rYs rr(zLastModified.warningstrN)rYr rr))rYr rr#)r5r6r7rBr]r+r(r%rrrMrMas]   % % %!JJJJ@rrMr)rrrrrr)rrrr) __future__rrr^rrr email.utilsrrr typingr r r pip._vendor.urllib3r rbrrr!r9rDrMr%rrrms#""""" 2222222222;;;;;;;;;;..........1000000 & 7777B-(!!!!!=!!!"<<<<<=<<<<<r