
    8i	                         S r SSKrSSKrSSKJr  \R
                  " S\R                  S9R                  r\R
                  " S\R                  S9R                  r	\R
                  " S5      R                  r
S rS	 rg)
z7A collection of functions deprecated in requests.utils.    N)utilss!   <meta.*?charset=["\']*(.+?)["\'>])flagss+   <meta.*?content=["\']*;?charset=(.+?)["\'>]s$   ^<\?xml.*?encoding=["\']*(.+?)["\'>]c                     [        U 5      [        U 5      -   [        U 5      -   nS[        R                  s=::  a  S:  a$  O  U$ U Vs/ s H  o"R                  S5      PM     nnU$ s  snf )aq  Return encodings from given content string.

.. code-block:: python

    import requests
    from requests_toolbelt.utils import deprecated

    r = requests.get(url)
    encodings = deprecated.get_encodings_from_content(r)

:param content: bytestring to extract encodings from
:type content: bytes
:return: encodings detected in the provided content
:rtype: list(str)
)   r   )   r   utf8)find_charsetfind_pragmafind_xmlsysversion_infodecode)content	encodingsencodings      r/home/dmtnaga/Documents/work/airagagent/rag_env/lib/python3.13/site-packages/requests_toolbelt/utils/deprecated.pyget_encodings_from_contentr      sh      g&W)==G$%I!!*F* >GGY__V,Y	G Hs   A%c                 T   [        5       n[        R                  " U R                  5      nU(       a   [	        U R
                  U5      $ [        U R
                  5      nU H1  nUR                  5       nXA;   a  M   [	        U R
                  U5      s  $    U(       a   [	        U R
                  USS9$ U R                  $ ! [         a"    UR                  UR                  5       5         Nf = f! [         a    UR                  U5         M  f = f! [         a     U R                  $ f = f)a  Return the requested content back in unicode.

This will first attempt to retrieve the encoding from the response
headers. If that fails, it will use
:func:`requests_toolbelt.utils.deprecated.get_encodings_from_content`
to determine encodings from HTML elements.

.. code-block:: python

    import requests
    from requests_toolbelt.utils import deprecated

    r = requests.get(url)
    text = deprecated.get_unicode_from_response(r)

:param response: Response object to get unicode content from.
:type response: requests.models.Response
replace)errors)setr   get_encoding_from_headersheadersstrr   UnicodeErroraddlowerr   	TypeErrortext)responsetried_encodingsr   r   	_encodings        r   get_unicode_from_responser#   ,   s   & eO ..x/?/?@H	2x''22 +8+;+;<I	OO%	'	+x''33  	x'')DD ==)  	2 01	2  	+	*	+  	==	s5   B> ;C-D >)C*)C*-DD
D'&D')__doc__rer   requestsr   compileIfindallr	   r
   r   r   r#        r   <module>r,      sv    = 	 
 zz)	'  jj3244	'  ::,	' 	
./r+   