
    V/a*                         d Z ddlZddlZddlZddlZddlmZ  ej                  d      Z ej                  dej                  ej                  z        ZdZ G d de      Zdd	Zd
 Zd Zd Zy)z=tldextract helpers for testing and fetching remote resources.    N)FileAdapter
tldextractz^(?P<suffix>[.*!]*\w[\S]*)z// ===BEGIN PRIVATE DOMAINS===c                       e Zd ZdZy)SuffixListNotFoundzA 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____doc__     8/usr/lib/python3/dist-packages/tldextract/suffix_list.pyr   r      s    Hr   r   c                 r   t        j                         5 }|j                  dt                      |D ]!  }	 | j	                  |||      c cddd       S  	 ddd       t        d      # t         j
                  j                  $ r t        j                  d|       Y mw xY w# 1 sw Y   t        d      xY w)zZDecode the first successfully fetched URL, from UTF-8 encoding to
    Python unicode.
    zfile://)sessionurltimeoutNz+Exception reading Public Suffix List url %szrNo Public Suffix List found. Consider using a mirror or constructing your TLDExtract with `suffix_list_urls=None`.)
requestsSessionmountr   cached_fetch_url
exceptionsRequestExceptionLOG	exceptionr   )cacheurlscache_fetch_timeoutr   r   s        r   find_first_responser      s     
			 	Rwi/ 	RCR--#6I .  	R 	R	R	R 	8  &&77 RKSQR	R 	8 s4    B#A*	B#B#*3B B#B  B##B6c                    | j                  t              \  }}}t        j                  |      D cg c]  }|j	                  d       }}t        j                  |      D cg c]  }|j	                  d       }}||fS c c}w c c}w )zNParse the raw suffix list text for its different designations of
    suffixes.suffix)	partitionPUBLIC_PRIVATE_SUFFIX_SEPARATORPUBLIC_SUFFIX_REfinditergroup)suffix_list_textpublic_text_private_textmpublic_tldsprivate_tldss          r   extract_tlds_from_suffix_listr,   )   s     $4#=#='$ KL /?.G.G.TU1778$UKU/?/H/H/VW!AGGH%WLW$$ VWs   B "Bc           	      B    | j                  t        d| |||dddg      S )(Fetch, parse, and cache the suffix listszpublicsuffix.org-tldsr   r   r   fallback_to_snapshotr   r0   )func	namespacekwargshashed_argnames)run_and_cache_get_suffix_listsr/   s       r   get_suffix_listsr7   5   s<    )#6$8	
  !78  
 
r   c                     	 t        | ||      }t        |      \  }}||fS # t        $ rA}|r3t        j                  dd      }t	        |t
              st        |d      }n|Y d}~Wd}~ww xY w)r.   )r   r   z.tld_set_snapshotzutf-8N)r   r   pkgutilget_data
isinstancestrr,   )r   r   r   r0   textexcr*   r+   s           r   r6   r6   D   sv    "5$DWX !>d CK$$  ##L2EFDdC(4)Is   " 	A,7A''A,)N)r
   loggingr9   rer   requests_filer   	getLoggerr   compileUNICODE	MULTILINEr"   r!   LookupErrorr   r   r,   r7   r6   r   r   r   <module>rG      sr    ?   	  %g%2::;RZZ",,=VW "B H H
(	%%r   