
    h              	          d Z ddlmZ 	 ddlZdZddlZej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  f	ZddZy# e$ r dZd ZY yw xY w)	z&An implementation of RFC4013 SASLprep.    )	text_typeNTc                 >   t        | t              s| S |rt        t        j                  fz   }nt        }t        j
                  }t        j                  }dj                  | D cg c]  } ||      s ||      rdn| c}      } t        j                  j                  d|       } t        j                  } || d         r+ || d         st        d      |t        j                  fz   }n||fz   }| D ]!  t        fd|D              st        d       | S c c}w )	a  An implementation of RFC4013 SASLprep.

        :Parameters:
          - `data`: The string to SASLprep. Unicode strings
            (python 2.x unicode, 3.x str) are supported. Byte strings
            (python 2.x str, 3.x bytes) are ignored.
          - `prohibit_unassigned_code_points`: True / False. RFC 3454
            and RFCs for various SASL mechanisms distinguish between
            `queries` (unassigned code points allowed) and
            `stored strings` (unassigned code points prohibited). Defaults
            to ``True`` (unassigned code points are prohibited).

        :Returns:
        The SASLprep'ed version of `data`.
          NFKCr   z$SASLprep: failed bidirectional checkc              3   .   K   | ]  } |        y w)N ).0in_tablechars     S/var/www/html/ranktracker/api/venv/lib/python3.12/site-packages/pymongo/saslprep.py	<genexpr>zsaslprep.<locals>.<genexpr>h   s     =h8D>=s   z+SASLprep: failed prohibited character check)
isinstance
_text_type_PROHIBITED
stringprepin_table_a1in_table_c12in_table_b1joinunicodedata	ucd_3_2_0	normalizein_table_d1
ValueErrorin_table_d2any)dataprohibit_unassigned_code_points
prohibitedr   r   eltr   r   s          @r   saslprepr#   0   s+     $
+K*$
(>(>'@@J$J ".. ,,xx6K$4 's+Y4 67 $$..vt< ,,tAwtBx( !!GHH $z'='=&??J
 ${n4J  	CD=*== AC C	C
 ;6s   $DFc                 <    t        | t              rt        d      | S )zSASLprep dummyzVThe stringprep module is not available. Usernames and passwords must be ASCII strings.)r   r   	TypeError)r   s    r   r#   r#      s%    dJ'34 4     )T)__doc__bson.py3compatr   r   r   HAVE_STRINGPREPr   r   in_table_c21_c22in_table_c3in_table_c4in_table_c5in_table_c6in_table_c7in_table_c8in_table_c9r   r#   ImportErrorr
   r&   r   <module>r3      s    - 2Y O 	## K<7  Os   A> >
B
B