ó
    úÞ jþ	  ã                   óü   • 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      Ú\/var/www/html/gaurav/venv/lib/python3.13/site-packages/requests_toolbelt/utils/deprecated.pyÚget_encodings_from_contentr      sh   € ô  ˜gÓ&¬°WÓ)=Ñ=Ü˜GÓ$ñ%€Ià”×!Ñ!Õ* FÕ*àÐñ >GÓG¹Y°—_‘_ 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         N f = 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  € ô& “e€Oô ×.Ò.¨x×/?Ñ/?Ó@€Hæð	2Ü�x×'Ñ'¨Ó2Ð2ô +¨8×+;Ñ+;Ó<€Iãˆ	Ø—O‘OÓ%ˆ	ØÓ'Ùð	+Ü�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   ðá =Û 	Û 
å à�zŠzØ)°·±ñç	�'ð ð �jŠjØ3¸2¿4¹4ñç	�'ð ð �:Š:Ø,óç	�'ð 	ò
ó./r+   