Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-39.pyc
Ðазад
a ^�h�. � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z m Z mZ e�dej �Zdd� Zdd � Zd d� Zddd �Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� ZdS )a� Low-level helpers for the SecureTransport bindings. These are Python functions that are not directly related to the high-level APIs but are necessary to get them to work. They include a whole bunch of low-level CoreFoundation messing about and memory management. The concerns in this module are almost entirely about trying to avoid memory leaks and providing appropriate and useful assistance to the higher-level code. � N� )�Security�CoreFoundation�CFConsts; -----BEGIN CERTIFICATE----- (.*?) -----END CERTIFICATE-----c C s t �t j| t| ��S )zv Given a bytestring, create a CFData object from it. This CFData object must be CFReleased by the caller. )r �CFDataCreate�kCFAllocatorDefault�len)� bytestring� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/urllib3/contrib/_securetransport/low_level.py�_cf_data_from_bytes s �r c C sZ t | �}dd� | D �}dd� | D �}tj| |� }tj| |� }t�tj|||tjtj�S )zK Given a list of Python tuples, create an associated CFDictionary. c s s | ]}|d V qdS )r Nr ��.0�tr r r � <genexpr>, � z-_cf_dictionary_from_tuples.<locals>.<genexpr>c s s | ]}|d V qdS )r Nr r r r r r - r )r r � CFTypeRefZCFDictionaryCreater ZkCFTypeDictionaryKeyCallBacksZkCFTypeDictionaryValueCallBacks)ZtuplesZdictionary_size�keys�valuesZcf_keysZ cf_valuesr r r �_cf_dictionary_from_tuples% s �r c C sn t �| t �t j��}t�|tj�}|du rXt �d�}t� ||dtj�}|sRt d��|j}|durj|�d�}|S )z� Creates a Unicode string from a CFString object. Used entirely for error reporting. Yes, it annoys me quite a lot that this function is this complex. Ni z'Error copying C string from CFStringRef�utf-8) �ctypes�castZPOINTERZc_void_pr ZCFStringGetCStringPtrr ZkCFStringEncodingUTF8Zcreate_string_bufferZCFStringGetCString�OSError�value�decode)r Zvalue_as_void_p�string�buffer�resultr r r �_cf_string_to_unicode; s � � r c C s\ | dkrdS t �| d�}t|�}t�|� |du s:|dkrBd| }|du rPtj}||��dS )z[ Checks the return code and throws an exception if there is an error to report r N� zOSStatus %s)r ZSecCopyErrorMessageStringr r � CFRelease�ssl�SSLError)�errorZexception_classZcf_error_string�outputr r r �_assert_no_errorT s r&