
    FCf              	      >   d Z ddlmZ ddlmZ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
dZy# e$ r dZ	 d		 	 	 	 	 d
dZY yw xY w)z&An implementation of RFC4013 SASLprep.    )annotations)AnyOptionalNTc                F   t        | t              s| S |rg t        t        j                  }nt        }t        j
                  }t        j                  }dj                  | D cg c]  } ||      r ||      rdn| c}      } t        j                  j                  d|       } t        j                  } || d         r, || d         st        d      g |t        j                  }ng ||}| D ]!  t        fd|D              st        d       | S c c}w )	aV  An implementation of RFC4013 SASLprep.

        :param data: The string to SASLprep. Unicode strings
            (:class:`str`) are supported. Byte strings
            (:class:`bytes`) are ignored.
        :param 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).

        :return: The SASLprep'ed version of `data`.
          NFKCr   z$SASLprep: failed bidirectional checkc              3  .   K   | ]  } |        y w)N ).0in_tablechars     P/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/pymongo/saslprep.py	<genexpr>zsaslprep.<locals>.<genexpr>q   s     =h8D>=s   z+SASLprep: failed prohibited character check)
isinstancestr_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%   9   s&     $$K*?;?
(>(>?J$J ".. ,,ww?C\;WZK[c*X3\
 $$..vt< ,,tAwtBx( !!GHH ?:>z'='=>J
 4:3{3J  	PD=*== !NOO	P 9 ]s   %D3DFc                <    t        | t              rt        d      | S )zSASLprep dummyz[The stringprep module is not available. Usernames and passwords must be instances of bytes.)r   r   	TypeError)r!   r"   s     r   r%   r%      s'    
 dC 8      )T)r!   r   r"   zOptional[bool]returnr   )__doc__
__future__r   typingr   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>r7      s    - "  `" O 	##K;G  O ;?

)7
 

s   B BB