Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyc

ó
“tÆ_c@sÁddlZddlZddlmZmZmZddlmZmZdZdd„Z
d„Zdefd„ƒYZ
d	e
fd
„ƒYZde
fd„ƒYZd
e
fd„ƒYZdS(iÿÿÿÿN(t
formatdatet	parsedatetparsedate_tz(tdatetimet	timedeltas%a, %d %b %Y %H:%M:%S GMTcCs|ptjƒ}||S(N(Rtutcnow(tdeltatdate((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pytexpire_afterscCsttj|jƒƒƒS(N(Rtcalendarttimegmt	timetuple(tdt((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pytdatetime_to_headerst
BaseHeuristiccBs#eZd„Zd„Zd„ZRS(cCsdS(s!
        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.
        s110 - "Response is Stale"((tselftresponse((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pytwarnings	cCsiS(sïUpdate 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.
        ((RR((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pytupdate_headers!scCsa|j|ƒ}|r]|jj|ƒ|j|ƒ}|dk	r]|jji|d6ƒq]n|S(NtWarning(RtheaderstupdateRtNone(RRtupdated_headerstwarning_header_value((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pytapply*s(t__name__t
__module__RRR(((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyRs			tOneDayCachecBseZdZd„ZRS(sM
    Cache the response by providing an expires 1 day in the
    future.
    cCsni}d|jkrjt|jdƒ}ttddƒdt|d Œƒ}t|ƒ|d<d|d<n|S(NtexpiresRtdaysiitpublics
cache-control(RRRRRR
(RRRRR((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyR<s%
(RRt__doc__R(((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyR6stExpiresAftercBs)eZdZd„Zd„Zd„ZRS(s;
    Cache **all** requests for a defined time period.
    cKst||_dS(N(RR(Rtkw((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyt__init__LscCs't|jƒ}it|ƒd6dd6S(NRRs
cache-control(RRR
(RRR((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyROscCsd}||jS(Ns:110 - Automatically cached for %s. Response might be stale(R(RRttmpl((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyRSs(RRR R#RR(((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyR!Gs		tLastModifiedcBsGeZdZddddddddd	d
dhZd„Zd
„ZRS(sÁ
    If there is no Expires header already, fall back on Last-Modified
    using the heuristic from
    http://tools.ietf.org/html/rfc7234#section-4.2.2
    to calculate a reasonable value.

    Firefox also does something like this per
    https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching_FAQ
    http://lxr.mozilla.org/mozilla-release/source/netwerk/protocol/http/nsHttpResponseHead.cpp#397
    Unlike mozilla we limit this to 24-hr.
    iÈiËiÌiÎi,i-i”i•išižiõc
	Cs8|j}d|kriSd|kr9|ddkr9iS|j|jkrOiSd|ksgd|krkiStjt|dƒƒ}t|dƒ}|dks¬|dkr°iStjƒ}t	d||ƒ}|tj|ƒ}t	dt
|dd
ƒƒ}||kriS||}	itjttj
|	ƒƒd6S(NRs
cache-controlRRs
last-modifiedii
iii€Q(Rtstatustcacheable_by_default_statusesR	R
RRRttimetmaxtmintstrftimetTIME_FMTtgmtime(
RtrespRRt
last_modifiedtnowtcurrent_ageRtfreshness_lifetimeR((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyRhs*	
cCsdS(N(R(RR.((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyR†s(RRR R'RR(((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyR%Xs'	(R	R(temail.utilsRRRRRR,RRR
tobjectRRR!R%(((sT/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/heuristics.pyt<module>s	"
Back to Directory File Manager