Current File : //usr/lib/python3/dist-packages/pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-312.pyc |
�
/�g� � �� � d dl mZ d dlZd dlZd dlmZmZmZ d dlmZm Z m
Z
d dlmZm
Z
mZ erd dlmZ dZddd�Zdd �Z G d
� d� Z G d� d
e� Z G d� de� Z G d� de� Zy)� )�annotationsN)�datetime� timedelta�timezone)�
formatdate� parsedate�parsedate_tz)�
TYPE_CHECKING�Any�Mapping)�HTTPResponsez%a, %d %b %Y %H:%M:%S GMTc �Z � |xs# t j t j � }|| z S �N)r �nowr �utc)�delta�dates �E/usr/lib/python3/dist-packages/pip/_vendor/cachecontrol/heuristics.py�expire_afterr s# � ��-�8�<�<����-�D��%�<�� c �Z � t t j | j � � � S r )r �calendar�timegm� timetuple)�dts r �datetime_to_headerr s � ��h�o�o�b�l�l�n�5�6�6r c �$ � e Zd Zdd�Zdd�Zdd�Zy)�
BaseHeuristicc � � y)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"� ��self�responses r �warningzBaseHeuristic.warning s � � +r c � � i S )z�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.
r r! s r �update_headerszBaseHeuristic.update_headers'