
    i'                     8   S r SSKrSSKrSSKrSSKJr  SSKJr  SSKrSSK	J
r
  SSKJr  \R                  " S5      r\R                  " S	\R                   \R"                  -  5      rS
r " S S\5      r  SS\S\\   S\\-  S-  S\R2                  S-  S\4
S jjrS\S\\\   \\   4   4S jr SS\S\\   S\\-  S-  S\S\R2                  S-  S\\\   \\   4   4S jjr SS\S\\   S\\-  S-  S\S\R2                  S-  S\\\   \\   4   4S jjr g)z=tldextract helpers for testing and fetching remote resources.    N)Sequence)cast)FileAdapter   )	DiskCache
tldextractz^(?P<suffix>[.*!]*\w[\S]*)z// ===BEGIN PRIVATE DOMAINS===c                       \ rS rSrSrSrg)SuffixListNotFound   zA recoverable error while looking up a suffix list.

Recoverable because you can specify backups, or use this library's bundled
snapshot.
 N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       Z/home/kali/github-search/github-env/lib/python3.13/site-packages/tldextract/suffix_list.pyr
   r
      s    r   r
   cacheurlscache_fetch_timeoutsessionreturnc                    SnUc1  [         R                  " 5       nUR                  S[        5       5        Sn U H,  n U R	                  X5US9s  U(       a  UR                  5         $ $    U(       a  UR                  5         [        S5      e! [         R                  R                   a    [        R                  SUSS9   M  f = f! U(       a  UR                  5         f f = f)zQDecode the first successfully fetched URL, from UTF-8 encoding to Python unicode.Fzfile://T)r   urltimeoutz+Exception reading Public Suffix List url %s)exc_infozNo remote Public Suffix List found. Consider using a mirror, or avoid this fetch by constructing your TLDExtract with `suffix_list_urls=()`.)requestsSessionmountr   cached_fetch_urlclose
exceptionsRequestExceptionLOGwarningr
   )r   r   r   r   session_createdr   s         r   find_first_responser(      s     O""$i/C--#6I .   MMO   MMO
	M  &&77 A3QU   MMO s4   C BC (C 3C?C CC C suffix_list_textc                    U R                  [        5      u  pn[        R                  U5       Vs/ s H  oDR	                  S5      PM     nn[        R                  U5       Vs/ s H  oDR	                  S5      PM     nnXV4$ s  snf s  snf )zJParse the raw suffix list text for its different designations of suffixes.suffix)	partitionPUBLIC_PRIVATE_SUFFIX_SEPARATORPUBLIC_SUFFIX_REfinditergroup)r)   public_text_private_textmpublic_tldsprivate_tldss          r   extract_tlds_from_suffix_listr7   >   s~    #3#=#='$ KL /?.G.G.TU.T778$.TKU/?/H/H/VW/V!GGH%/VLW$$ VWs   B#Bfallback_to_snapshotc           
      >    U R                  [        SU UUUUS.SS/S9$ ))Fetch, parse, and cache the suffix lists.zpublicsuffix.org-tldsr   r   r   r8   r   r   r8   )func	namespacekwargshashed_argnames)run_and_cache_get_suffix_listsr;   s        r   get_suffix_listsrB   I   sA     )#6$8
  !78   r   c                      [        XX$S9n[        U5      u  pX4$ ! [         aK  nU(       a=  [        R                  " SS5      n[	        [
        U5      nUR                  S5      n SnAN^UeSnAff = f)r:   )r   r   r   z.tld_set_snapshotzutf-8N)r(   r
   pkgutilget_datar   bytesdecoder7   )r   r   r   r8   r   textexcmaybe_pkg_datapkg_datar5   r6   s              r   rA   rA   _   sv    "-@
 !>d CK$$  $--l<OPNE>2H??7+DIs   
 
A1?A,*A,,A1)NN)N)!r   loggingrD   recollections.abcr   typingr   r   requests_filer   r   r   	getLoggerr%   compileUNICODE	MULTILINEr.   r-   LookupErrorr
   strfloatintr   r(   tuplelistr7   boolrB   rA   r   r   r   <module>r\      s   C   	 $   % %::;RZZ",,=VW "B   /3'+	
3- t+ $	
 	D%C %E$s)TRUYBV<W %  (,
3- t+ 	
 $ 49d3i 6 (,%%
3-% t+% 	%
 $% 49d3i %r   