File: //lib64/python3.9/site-packages/ldap/__pycache__/dn.cpython-39.opt-1.pyc
a
�.d( � @ s\ d Z ddlmZ ddlZddlZdd� Zddd�Zdd � Zddd�Z dd
d�Z
ddd�ZdS )zs
dn.py - misc stuff for handling distinguished names (see RFC 4514)
See https://www.python-ldap.org/ for details.
� )�__version__Nc C s� | r�| � dd�} | � dd�} | � dd�} | � dd�} | � d d
�} | � dd�} | � d
d�} | � dd�} | � dd�} | d dkr�d�| dd� df�} | d dks�| d dkr�d�d| f�} | S )za
Escape all DN special characters found in s
with a back-slash (see RFC 4514, section 2.4)
�\z\\�,z\,�+z\+�"z\"�<z\<�>z\>�;z\;�=z\=� z\ ���� � Nz\ r �#)�replace�join)�s� r �-/usr/lib64/python3.9/site-packages/ldap/dn.py�escape_dn_chars s r c C s | sg S t j�dtj| |�S )z�
This function takes a DN as string as parameter and returns
a decomposed DN. It's the inverse to dn2str().
flags describes the format of the dn
See also the OpenLDAP man-page ldap_str2dn(3)
N)�ldapZ functionsZ_ldap_function_call�_ldap�str2dn)�dn�flagsr r r r % s r c C s d� dd� | D ��S )z�
This function takes a decomposed DN as parameter and returns
a single string. It's the inverse to str2dn() but will always
return a DN in LDAPv3 format compliant to RFC 4514.
r c S s g | ]}d � dd� |D ���qS )r c S s( g | ] \}}}d � |t|pd�f��qS �r
r �r r ��.0ZatypeZavalueZdummyr r r �
<listcomp>: s �z%dn2str.<locals>.<listcomp>.<listcomp>�r )r �rdnr r r r 9 s �
�zdn2str.<locals>.<listcomp>r )r r r r �dn2str3 s
�r"