_internal_utils.pyc
1 o 2 ��Ycu � @ sj d Z ddlZddlmZ e�d�Ze�d�Ze�d�Ze�d�Ze eefe 3 eefiZdd 4 d�Zdd � Z dS )z� 5 requests._internal_utils 6 ~~~~~~~~~~~~~~ 7 8 Provides utility functions that are consumed internally by Requests 9 which depend on extremely few external helpers (such as compat) 10 � N� )�builtin_strs ^[^:\s][^:\r\n]*$z^[^:\s][^:\r\n]*$s ^\S[^\r\n]*$|^$z^\S[^\r\n]*$|^$�asciic C s t | t�r | }|S | �|�}|S )z�Given a string object, regardless of type, returns a representation of 11 that string in the native string type, encoding and decoding where 12 necessary. This assumes ASCII unless told otherwise. 13 )� 14 isinstancer �decode)�string�encoding�out� r 15 ��C:\Users\Jacks.GUTTSPC\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\_internal_utils.py�to_native_string s 16 17 18 �r c C s4 t | t�sJ �z| �d� W dS ty Y dS w )z�Determine if unicode string only contains ASCII characters. 19 20 :param str u_string: unicode string to check. Must be unicode 21 and not Python 2 `str`. 22 :rtype: bool 23 r TF)r �str�encode�UnicodeEncodeError)Zu_stringr 24 r 25 r �unicode_is_ascii$ s 26 �r )r )�__doc__�re�compatr �compile�_VALID_HEADER_NAME_RE_BYTE�_VALID_HEADER_NAME_RE_STR�_VALID_HEADER_VALUE_RE_BYTE�_VALID_HEADER_VALUE_RE_STR�bytesr �HEADER_VALIDATORSr r r 27 r 28 r 29 r �<module> s 30 31 32 33 � 34