
    q"h                        S SK Jr  S SKrS SKrS SKJrJrJr  S SKJrJ	r	J
r
  S SKJrJrJr  \(       a  S SKJr  SrSSS jjrSS	 jr " S
 S5      r " S S\5      r " S S\5      r " S S\5      rg)    )annotationsN)datetime	timedeltatimezone)
formatdate	parsedateparsedate_tz)TYPE_CHECKINGAnyMapping)HTTPResponsez%a, %d %b %Y %H:%M:%S GMTc                d    U=(       d$    [         R                  " [        R                  5      nX-   $ N)r   nowr   utc)deltadates     U/var/www/html/env/lib/python3.13/site-packages/pip/_vendor/cachecontrol/heuristics.pyexpire_afterr      s!    -8<<-D<    c                \    [        [        R                  " U R                  5       5      5      $ r   )r   calendartimegm	timetuple)dts    r   datetime_to_headerr      s    hooblln566r   c                  2    \ rS rSrSS jrSS jrS	S jrSrg)
BaseHeuristic   c                    g)z
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.
z110 - "Response is Stale" selfresponses     r   warningBaseHeuristic.warning   s     +r   c                    0 $ )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     r   update_headersBaseHeuristic.update_headers'   s	     	r   c                    U R                  U5      nU(       aL  UR                  R                  U5        U R                  U5      nUb  UR                  R                  SU05        U$ )NWarning)r(   headersupdater%   )r#   r$   updated_headerswarning_header_values       r   applyBaseHeuristic.apply0   s]    --h7##O4#'<<#9 #/  ''4H(IJr   r!   Nr$   r   return
str | Noner$   r   r3   dict[str, str])r$   r   r3   r   )__name__
__module____qualname____firstlineno__r%   r(   r0   __static_attributes__r!   r   r   r   r      s    	+	r   r   c                  "    \ rS rSrSrSS jrSrg)OneDayCache<   zA
Cache the response by providing an expires 1 day in the
future.
c                    0 nSUR                   ;  aV  [        UR                   S   5      n[        [        SS9[	        US S S[
        R                  06S9n[        U5      US'   SUS	'   U$ )
Nexpiresr      )days   tzinfo)r   publiccache-control)r,   r   r   r   r   r   r   r   )r#   r$   r,   r   r@   s        r   r(   OneDayCache.update_headersB   ss    H,,,X--f56D"q!tBQx==G "4G!<GI'/GO$r   r!   Nr5   )r7   r8   r9   r:   __doc__r(   r;   r!   r   r   r=   r=   <   s    
r   r=   c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)ExpiresAfterP   z3
Cache **all** requests for a defined time period.
c                $    [        S0 UD6U l        g )Nr!   )r   r   )r#   kws     r   __init__ExpiresAfter.__init__U   s    __
r   c                H    [        U R                  5      n[        U5      SS.$ )NrE   )r@   rF   )r   r   r   )r#   r$   r@   s      r   r(   ExpiresAfter.update_headersX   s     tzz*-g6RRr   c                "    SnX R                   -  $ )Nz:110 - Automatically cached for %s. Response might be staler   )r#   r$   tmpls      r   r%   ExpiresAfter.warning\   s    Kjj  r   rS   N)rM   r   r3   Noner5   r2   )	r7   r8   r9   r:   rH   rN   r(   r%   r;   r!   r   r   rJ   rJ   P   s    %S!r   rJ   c                  4    \ rS rSrSr1 SkrSS jrS	S jrSrg)
LastModifieda   a  
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.
>   ,  -                        c                @   UR                   nSU;   a  0 $ SU;   a  US   S:w  a  0 $ UR                  U R                  ;  a  0 $ SU;  d  SU;  a  0 $ [        US   5      nUc   e[        R
                  " US S 5      n[        US   5      nUc  0 $ [        R                  " 5       n[        SXd-
  5      nU[        R
                  " U5      -
  n[        S[        US-  S	5      5      n	X::  a  0 $ XI-   n
S[        R                  " [        [        R                  " U
5      5      0$ )
Nr@   rF   rE   r   zlast-modifiedrC   r   
   iQ )r,   statuscacheable_by_default_statusesr	   r   r   r   timemaxminstrftimeTIME_FMTgmtime)r#   respr,   
time_tupler   last_modifiedr   current_ager   freshness_lifetimer@   s              r   r(   LastModified.update_headers|   s   %)\\Ig%'/*Bh*NI;;d@@@I O7$BI!'&/2
%%%z"1~.!'/":; Iiik!SZ(x}55 C
I$>?,I+4==4;;w3GHIIr   c                    g r   r!   )r#   ro   s     r   r%   LastModified.warning   s    r   r!   N)ro   r   r3   r6   )ro   r   r3   r4   )	r7   r8   r9   r:   rH   rh   r(   r%   r;   r!   r   r   rX   rX   a   s    
%!J@r   rX   r   )r   r   r   zdatetime | Noner3   r   )r   r   r3   str)
__future__r   r   ri   r   r   r   email.utilsr   r   r	   typingr
   r   r   pip._vendor.urllib3r   rm   r   r   r   r=   rJ   rX   r!   r   r   <module>r|      sf    #   2 2 ; ; . .0&
7 B- (!= !"<= <r   