3 Re @ s d dl Z d dlZd dlmZmZmZ d dlmZmZ dZdddZ dd Z G d d d eZG dd deZ G d d deZG dd deZdS ) N) formatdate parsedateparsedate_tz)datetime timedeltaz%a, %d %b %Y %H:%M:%S GMTc C s |p t j }|| S )N)r utcnow)deltadate r /builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el9.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/cachecontrol/heuristics.pyexpire_after s r c C s t tj| j S )N)r calendartimegm timetuple)dtr r r datetime_to_header s r c @ s$ e Zd Zdd Zdd Zdd ZdS ) BaseHeuristicc C s dS )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"r )selfresponser r r warning s zBaseHeuristic.warningc C s i S )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 r r r r update_headers! s zBaseHeuristic.update_headersc C s@ | j |}|r<|jj| | j|}|d k r<|jjd|i |S )NWarning)r headersupdater )r r Zupdated_headersZwarning_header_valuer r r apply* s zBaseHeuristic.applyN)__name__ __module____qualname__r r r r r r r r s r c @ s e Zd ZdZdd ZdS )OneDayCachezM Cache the response by providing an expires 1 day in the future. c C sR i }d|j krNt|j d }ttddt|d d d}t||d<