
    -2iE	                     0   U d Z ddlZddlmZ ddlmZ ddlmZmZm	Z	 ddl
mZ  ej                  dj                   ej                  d	j                  ee	z                     ej                         Zeed
<   deddfdZd	g ddfdededee   dededefdZy)zA
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
    N)Sequence)Final   )ascii_symbolsto_strunprintable_ascii_chars)InvalidCharError[{}] __RE_SYMBOLtextreturnc                 `    t         j                  t        |             }|rt        d|       y)z
    Verifying whether symbol(s) included in the ``text`` or not.

    Args:
        text:
            Input text to validate.

    Raises:
        ValidationError (ErrorReason.INVALID_CHARACTER):
            If symbol(s) included in the ``text``.
    zinvalid symbols found: N)r   findallr   r	   )r   
match_lists     ^/mnt/e/genesis-system/.venvs/voice-bridge/lib/python3.12/site-packages/pathvalidate/_symbol.pyvalidate_symbolr      s3     $$VD\2J!8EFF     Freplacement_textexclude_symbolsis_replace_consecutive_charsis_stripc                    |rvt        j                  dj                  t        j                  dj	                  t        t        t        z         t        |      z
                    t         j                        }nt        }	 |j                  |t        |             }|s|S |r-t        j                  t        j                  |       d||      }|r|j                  |      }|S # t        $ r t        d      w xY w)ag  
    Replace all of the symbols in the ``text``.

    Args:
        text:
            Input text.
        replacement_text:
            Replacement text.
        exclude_symbols:
            Symbols that were excluded from the replacement.
        is_replace_consecutive_chars:
            If |True|, replace consecutive multiple ``replacement_text`` characters
            to a single character.
        is_strip:
            If |True|, strip ``replacement_text`` from the beginning/end of the replacement text.

    Returns:
        A replacement string.

    Example:

        :ref:`example-sanitize-symbol`
    r
   r   ztext must be a string+)recompileformatescapejoinsetr   r   UNICODEr   subr   	TypeErrorstrip)r   r   r   r   r   regexpnew_texts          r   replace_symbolr'   $   s    > MM		GGC0G GH3K__`
 JJ
 1::.t= #66RYY'789;=MxX>>"23O  1/001s    C# #C8)__doc__r   collections.abcr   typingr   _commonr   r   r   errorr	   r   r   r   r   r!   r   __annotations__strr   boolr'    r   r   <module>r1      s    
 $  C C #  RZZ
MM)"))BGGM4K$KLMNPRPZPZU 
G# G$ G( %').9
99 c]9 #'	9
 9 	9r   