+
    f7i)  c                  s  a  0 t $ ^ RIHt ^ RIHt  0 RkRkRkRkRkRkR	kR
kRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkR kR!kR"kR#kR$kR%kR&kR'kR(kR)kR*kR+kR,kR-kR.kR/kR0kR1ktR2]R3&   0 RBmtR2]R4&   ^tR5]R6&    ! R7 R8]	4      t
RCR: R; llt. R9R93R< R= llt. R9R93R> R? llt]R@8X  d   ^ RAIt]P                   ! 4        RA# RA# )Di    )annotations)IterableZ ZZZZZZZZZ	Z
ZZZZZZZZZZZZZZZZZZZZZZ"Z*Z+Z/Z:Z<Z>Z?Z[Z\Z]Z(Z)Z|Zzset[str]illegalCharactersreservedFileNamesintmaxFileNameLengthc                  s    ] tR t^otRtR# )NameTranslationError N)__name__Z
__module__Z__qualname__Z__firstlineno__Z__static_attributes__r       A/usr/lib64/python3.14/site-packages/fontTools/ufoLib/filenames.pyr   r   o   s    r	   r    c          
     ,    V ^8  d   QhRRRRRRRRRR/#    userNamestrexistingIterable[str]prefixsuffixreturnr   Zformat   "r
   __annotate__r   s   s;     g gg*g9<gKNggr	   c                s   \        V \        4      '       g   \        R4      h\        V4      p\        V4      pV'       g   V ^ ,          R8X  d   RV R,          ,           p . pV  F?  pV\        9   d   RpMWwP                  4       8w  d
   VR,          pVP                  V4       KA  	  RP                  V4      p \        V,
          V,
          pV RV p . p	V P                  R4       F6  p
V
P                  4       \        9   d
   RV
,           p
V	P                  V
4       K8  	  RP                  V	4      p W ,           V,           pVP                  4       V9   d   \        WW#4      pV# )a  Converts from a user name to a file name.

Takes care to avoid illegal characters, reserved file names, ambiguity between
upper- and lower-case characters, and clashes with existing files.

Args:
        userName (str): The input file name.
        existing: A case-insensitive list of all existing file names.
        prefix: Prefix to be prepended to the file name.
        suffix: Suffix to be appended to the file name.

Returns:
        A suitable filename.

Raises:
        NameTranslationError: If no suitable name could be generated.

Examples::

        >>> userNameToFileName("a") == "a"
        True
        >>> userNameToFileName("A") == "A_"
        True
        >>> userNameToFileName("AE") == "A_E_"
        True
        >>> userNameToFileName("Ae") == "A_e"
        True
        >>> userNameToFileName("ae") == "ae"
        True
        >>> userNameToFileName("aE") == "aE_"
        True
        >>> userNameToFileName("a.alt") == "a.alt"
        True
        >>> userNameToFileName("A.alt") == "A_.alt"
        True
        >>> userNameToFileName("A.Alt") == "A_.A_lt"
        True
        >>> userNameToFileName("A.aLt") == "A_.aL_t"
        True
        >>> userNameToFileName(u"A.alT") == "A_.alT_"
        True
        >>> userNameToFileName("T_H") == "T__H_"
        True
        >>> userNameToFileName("T_h") == "T__h"
        True
        >>> userNameToFileName("t_h") == "t_h"
        True
        >>> userNameToFileName("F_F_I") == "F__F__I_"
        True
        >>> userNameToFileName("f_f_i") == "f_f_i"
        True
        >>> userNameToFileName("Aacute_V.swash") == "A_acute_V_.swash"
        True
        >>> userNameToFileName(".notdef") == "_notdef"
        True
        >>> userNameToFileName("con") == "_con"
        True
        >>> userNameToFileName("CON") == "C_O_N_"
        True
        >>> userNameToFileName("con.alt") == "_con.alt"
        True
        >>> userNameToFileName("alt.con") == "alt._con"
        True
z(The value for userName must be a string.Z.Z_:i   NNr   N)Z
isinstancer   Z
ValueErrorlenr   lowerZappendZjoinr   Zsplitr   handleClash1)r   r   r   r   prefixLengthsuffixLengthZfilteredUserNameZ	charactersliceLengthZpartsZpartfullName   &&&&        r
   userNameToFileNamer!   s   s5   H h$$CDDv;Lv;L hqkS("%	))I//++I	*  ww'(H#l2\AK%HEs#::<,,:DT $ xxH 6)H~~8#FCOr	   c          
     r   r   r   r   r   r
   r   r      s;     A AA*A9<AKNAAr	   c                s   \        V4      p\        V4      pV\        V 4      ,           V,           ^,           \        8  d3   V\        V 4      ,           V,           ^,           p\        V,
          pV RV p Rp^p	Vf\   V \        V	4      P                  ^4      ,           p
W*,           V,           pVP	                  4       V9  d   TpMV	^,          p	V	R8  g   K^   Vf   \        WV4      pV# )a  A helper function that resolves collisions with existing names when choosing a filename.

This function attempts to append an unused integer counter to the filename.

    Args:
            userName (str): The input file name.
            existing: A case-insensitive list of all existing file names.
            prefix: Prefix to be prepended to the file name.
            suffix: Suffix to be appended to the file name.

    Returns:
            A suitable filename.

    >>> prefix = ("0" * 5) + "."
    >>> suffix = "." + ("0" * 10)
    >>> existing = ["a" * 5]

    >>> e = list(existing)
    >>> handleClash1(userName="A" * 5, existing=e,
    ...             prefix=prefix, suffix=suffix) == (
    ...     '00000.AAAAA000000000000001.0000000000')
    True

    >>> e = list(existing)
    >>> e.append(prefix + "aaaaa" + "1".zfill(15) + suffix)
    >>> handleClash1(userName="A" * 5, existing=e,
    ...             prefix=prefix, suffix=suffix) == (
    ...     '00000.AAAAA000000000000002.0000000000')
    True

    >>> e = list(existing)
    >>> e.append(prefix + "AAAAA" + "2".zfill(15) + suffix)
    >>> handleClash1(userName="A" * 5, existing=e,
    ...             prefix=prefix, suffix=suffix) == (
    ...     '00000.AAAAA000000000000001.0000000000')
    True
Nl   I5 )r   r   r   Zzfillr   handleClash2)r   r   r   r   r   r   Zlr   	finalNamecounterZnamer   r    r
   r   r      s    T v;Lv;Lc(m#l2R7:KK3x=(<7"<'!+L[)IG

#g,,,R00=6)>>8+ IqLGo% 6:	r	   c               s(    V ^8  d   QhRRRRRRRR/# )r   r   r   r   r   r   r   r   r   r   r
   r   r   !  s,     = ==*-=<?==r	   c                s*   \         \        V4      ,
          \        V4      ,
          p\        RV,          4      pRp^pVfD   V\        V4      ,           V,           pVP	                  4       V 9  d   TpMV^,          pWd8  g   KF   Vf   \        R4      hV# )a  A helper function that resolves collisions with existing names when choosing a filename.

This function is a fallback to :func:`handleClash1`. It attempts to append an unused integer counter to the filename.

    Args:
            userName (str): The input file name.
            existing: A case-insensitive list of all existing file names.
            prefix: Prefix to be prepended to the file name.
            suffix: Suffix to be appended to the file name.

    Returns:
            A suitable filename.

    Raises:
            NameTranslationError: If no suitable name could be generated.

    Examples::

      >>> prefix = ("0" * 5) + "."
      >>> suffix = "." + ("0" * 10)
      >>> existing = [prefix + str(i) + suffix for i in range(100)]

      >>> e = list(existing)
      >>> handleClash2(existing=e, prefix=prefix, suffix=suffix) == (
      ...   '00000.100.0000000000')
      True

      >>> e = list(existing)
      >>> e.remove(prefix + "1" + suffix)
      >>> handleClash2(existing=e, prefix=prefix, suffix=suffix) == (
      ...   '00000.1.0000000000')
      True

      >>> e = list(existing)
      >>> e.remove(prefix + "2" + suffix)
      >>> handleClash2(existing=e, prefix=prefix, suffix=suffix) == (
      ...   '00000.2.0000000000')
      True
Z9NzNo unique name could be found.)r   r   r   r   r   r   )r   r   r   Z	maxLengthZmaxValuer#   r$   r   s   &&&     r
   r"   r"   !  s    V "CK/#f+=I3?#HIG

CL(61>>8+ IqLG"#CDDr	   Z__main__N>   ZauxZconZnulZprnZcom1Zcom2Zcom3Zcom4Zcom5Zcom6Zcom7Zcom8Zcom9Zlpt1Zlpt2Zlpt3Zlpt4Zlpt5Zlpt6Zlpt7Zlpt8Zlpt9zclock$)r   r   r   )__conditional_annotations__Z
__future__r    Zcollections.abcr   r   Z__annotations__r   r   Z	Exceptionr   r!   r   r"   r   ZdoctestZtestmod)r%   s   @r
   <module>r&      s   " " $:0
0
0 0 	0
 0 0 0 0 0 	0 	0 0 0 	0 0  !0" #0$ %0& '0( )0* +0, -0. /00 102 304 506 708 90: ;0< =0> ?0@ A0B C0D E0F G0H I0J K0L M0N O0P Q0R S0T 	U0V W0X Y0Z [0\ ]0^ _0 8 0b 8 2  3 	9 	gV .0rQSAJ !"=@ zOO r	   