+
     ha   c                  s   R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
HtHt ^ RIHt ^ RIHtHt ^ RIt^ RIHt ]P*                  ! ]4      tRs]! R4      tR	 R
 ltR R lt ! R R4      tR R ltR R ltR R ltR# )zHelpers.)annotationsN)CallableHashableIterable)Path)TypeVarcast)FileLockFTc                   V ^8  d   QhRR/#    returnstr Zformat   "5/usr/lib/python3.14/site-packages/tldextract/cache.py__annotate__r      s      3     c                 s    ^ RI Hp  RV ,           p\        P                  P                  \        P                  4      p\        P                  ! \        P                  P                  R4      RR7      P                  4       R,          pRP                  \        P                  R	R  Uu. uF  p\        V4      NK  	  up4      pVVVV.pR
P                  V4      pV#   \         d    Rp  Li ; iu upi )zGenerate an identifier unique to the python version, tldextract version, and python instance.

This will prevent interference between virtualenvs and issues that might arise when installing
a new version of tldextract
)versionZdevztldextract-utf-8FZusedforsecurity:Ni   NZ.NZ__i)Ztldextract._versionr   ZImportErrorospathZbasenamesysZprefixhashlibmd5encode	hexdigestZjoinZversion_infor   )r   Ztldextract_versionZpython_env_nameZpython_binary_path_short_hashvZpython_versionZidentifier_partsZpkg_identifiers           r   get_pkg_unique_identifierr      s    / '0gg&&szz2O$+KK

'"E%ik"%! XXs/?/?/DE/D!s1v/DEFN%	 YY/0N%   Fs   C (C/C,+C,c               r	   r
   r   r   r   r   r   r   9   s     A As Ar   c                 s   \         P                  P                  RR4      p V e   V # \         P                  ! RR4      pVf5   \         P                  ! RR4      pV'       d   \	        \        VR4      4      pVe   \	        \        VR\        4       4      4      # \	        \        \         P                  P                  \        4      R4      4      # )zGet a cache dir that we have permission to write to.

Try to follow the XDG standard, but if that doesn't work fallback to the package directory
http://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
ZTLDEXTRACT_CACHENZXDG_CACHE_HOMEZHOMEz.cachezpython-tldextractz.suffix_cache)
r   ZenvirongetZgetenvr   r   r   r   dirnameZ__file__)	cache_dirZxdg_cache_homeZ	user_homes      r   get_cache_dirr#   9   s     

148IYY/6NIIfd+	 i!:;N!!46O6QR
 	

 tBGGOOH-?@@r   c                  sr    ] tR t^RtRtRR R lltR R ltR R ltR R	 ltR
 R lt	R R lt
R R ltRtR# )	DiskCachez0Disk _cache that only works for jsonable values.c                    V ^8  d   QhRRRR/# )r   r"   z
str | Nonelock_timeoutZintr   r   r   r   r   DiskCache.__annotate__U   s     + +* +C +r   c                s    \        V4      V n        \        P                  P	                  \        V4      ;'       g    R4      V n        W n        RV n        R# )z.Construct a disk cache in the given directory.Z z.tldextract.jsonN)	Zboolenabledr   r   Z
expanduserr   r"   r&   file_ext)selfr"   r&   s   &&&r   __init__ZDiskCache.__init__U   s>    I++C	N,@,@bA( +r   c               s$    V ^8  d   QhRRRRRR/# )r   	namespacer   keystr | dict[str, Hashable]r   objectr   r   r   r   r   r'   ^   s'     V VS V'@ VV Vr   c                s   V P                   '       g   \        R4      hV P                  W4      p\        P                  P                  V4      '       g*   \        RV,           R,           \        V4      ,           4      h \        V4      ;_uu_ 4       p\        P                  ! V4      uuRRR4       #   + '       g   i     R# ; i  \        \        3 d0   p\        RT,           R,           \        T4      ,           4      ThRp?ii ; i)z%Retrieve a value from the disk cache.zCache is disabledznamespace: z key: N)r(   KeyError_key_to_cachefile_pathr   r   ZisfilerepropenjsonZloadOSErrorZ
ValueError)r*   r,   r-   cache_filepath
cache_fileexc   &&&   r   r    ZDiskCache.get^   s    |||.//44YDww~~n--=94x?$s)KLL	Vn%%yy, &%%%$ 	V=94x?$s)KLRUU	Vs6   >C B2'
C 2C	=C C D*DDc               s(    V ^8  d   QhRRRRRRRR/# )	r   r,   r   r-   r.   valuer/   r   Noner   r   r   r   r   r'   l   s,     0 00#<0EK0	0r   c                s   V P                   '       g   R# V P                  W4      p \        V4       \        VR4      ;_uu_ 4       p\        P
                  ! W54       RRR4       R#   + '       g   i     R# ; i  \         d9   p\        '       g"   \        P                  RTTTT4       Rs Rp?R#  Rp?R# Rp?ii ; i)zSet a value in the disk cache.NZwunable to cache %s.%s in %s. This could refresh the Public Suffix List over HTTP every app startup. Construct your `TLDExtract` with a writable `cache_dir` or set `cache_dir=None` to silence this warning. %sT)
r(   r1   	_make_dirr3   r4   Zdumpr5   _DID_LOG_UNABLE_TO_CACHELOGwarning)r*   r,   r-   r:   r6   r7   ioes   &&&&   r   setZDiskCache.setl   s     |||44YD	0n%nc**j		%, +*** 	0++G "	 ,0( ,	0s5   A; A'A; 'A8	2A; 8A; ;B>'B99B>c               r	   )r   r   r;   r   r   r   r   r   r'      s     " "t "r   c           
     s   \         P                  ! V P                  4       F  w  rpV Fw  pVP                  V P                  4      '       g+   VP                  V P                  R,           4      '       g   KN   \         P
                  ! \        \        W4      4      4       Ky  	  K  	  R#   \         d     K  \         d,   pTP                  \        P                  8w  d   h  Rp?K  Rp?ii ; i)zClear the disk cache..lockN)r   Zwalkr"   Zendswithr)   Zunlinkr   r   ZFileNotFoundErrorr5   errnoZENOENT)r*   ZrootZ_Zfilesfilenamer8   s   &     r   clearZDiskCache.clear   s     ggdnn5NDU!$$T]]33x7H7HMMG+8 8"		#d4&:";< " 6 - " " 994! 5"s$   8(B**C-8C-C- C((C-c               s$    V ^8  d   QhRRRRRR/# )r   r,   r   r-   r.   r   r   r   r   r   r   r'      s$      #<	r   c                	s    \        \        V P                  V4      4      p\        V4      p\        \        W4V P                  ,           4      4      pV# )N)r   r   r"   _make_cache_keyr)   )r*   r,   r-   Znamespace_pathZ
hashed_keyZ
cache_pathr9   r   r1   Z DiskCache._key_to_cachefile_path   sA     T$..)<=$S)
n4==.HIJ
r   c          
     s,    V ^8  d   QhRRRRRRRRR	R
/# )r   funczCallable[..., T]r,   r   kwargszdict[str, Hashable]hashed_argnameszIterable[str]r   r   r   r   r   r   r   r'      s<     ( (( ( $	(
 '( 
(r   c           
     s   V P                   '       g	   V! R/ VB # VP                  4        UUu/ uF  w  rVWT9   g   K  WVbK  	  pppV P                  W'4      pVR,           p	 \        V4       \        YP                  R7      ;_uu_ 4         \        \        T P                  Y'R7      4      pTuuRRR4       # u uppi   \         d:   p
\
        '       g   \        P                  RTTTT
4       RsT! R/ TB u Rp
?
# Rp
?
ii ; i  \         d    T! R/ TB pT P                  Y'TR7        Li ; i  + '       g   i     R# ; i)	!Get a url but cache the response.rC   r<   TNtimeout)r,   r-   )r,   r-   r:   r   )r(   Zitemsr1   r=   r5   r>   r?   r@   r   r&   r   r   r    r0   rB   )r*   rH   r,   rI   rJ   Zkr   Zkey_argsr6   Z	lock_pathrA   Zresults   &&&&&       r   run_and_cacheZDiskCache.run_and_cache   s-    |||>&>!%+\\^L^TQq7KDAD^L44YI"W,		"n%$ i):):;;JaI!LM
  <;- M
  	"++G "	 ,0(>&>!	"(  J9&IJ <;;sX   
B8B8!B> 
D1 D,D1>D	.C=7D=D&D.+D1-D..D11E	c               (    V ^8  d   QhRRRRRRRR/# )r   sessionrequests.Sessionurlr   rM   zfloat | int | Noner   r   r   r   r   r   r'      s,     	
 	
'	
.1	
<N	
		
r   c           
     sB    V P                  \        RRVRVRV/R.R7      # )rK   ZurlsrP   rR   rM   )rH   r,   rI   rJ   )rN   
_fetch_url)r*   rP   rR   rM   s   &&&&r   cached_fetch_urlZDiskCache.cached_fetch_url   s7     !!wsIwG"G	 " 
 	
r   )r"   r(   r)   r&   N)i   )__name__Z
__module__Z__qualname__Z__firstlineno____doc__r+   r    rB   rF   r1   rN   rT   Z__static_attributes__r   r   r   r$   r$   R   s/    :+V08""(T	
 	
r   r$   c               rO   )r   rP   rQ   rR   r   rM   z
int | Noner   r   r   r   r   r   r      s)      ( s Z C r   c                s    V P                  WR 7      pVP                  4        VP                  p\        V\        4      '       g   \	        VR4      pV# )rL   r   )r    Zraise_for_statustextZ
isinstancer   )rP   rR   rM   ZresponserW   s   &&&  r   rS   rS      sE    {{3{0H==DdC  4!Kr   c               r%   )r   inputsr.   r   r   r   r   r   r   r   r      s     N N5 N# Nr   c                s    \        V 4      p\        P                  ! VP                  R 4      RR7      P	                  4       # )Zutf8Fr   )r2   r   r   r   r   )rX   r-      & r   rG   rG      s.    
v,C;;szz&)5AKKMMr   c               r%   )r   rE   r   r   r;   r   r   r   r   r   r      s        r   c                sh   \         P                  P                  \         P                  P                  V 4      4      '       g7    \         P                  ! \         P                  P                  V 4      4       R# R#   \
         d,   pTP                  \        P                  8w  d   h  Rp?R# Rp?ii ; i)z-Make a directory if it doesn't already exist.N)r   r   Zexistsr!   Zmakedirsr5   rD   ZEEXIST)rE   r8   rY   r   r=   r=      so    77>>"''//(344	KK12 5  	yyELL( )	s   3A; ;B1 B,,B1) rV   Z
__future__r    rD   r   r4   Zloggingr   r   Zcollections.abcr   r   r   Zpathlibr   Ztypingr   r   ZrequestsZfilelockr   Z	getLoggerrU   r?   r>   r   r   r#   r$   rS   rG   r=   r   r   r   <module>rZ      sz     "     	 
 8 8 
  !  CL:A2D
 D
NN
r   