�
��gF � �D � d Z ddlZddlZ ej d� � Z dd�ZdS )zHCollection of utilities for command-line interfaces and console scripts.� Nz#\d+$F� c �p � t j � | � � \ }}t j � |� � \ }}|r|}t � |� � d }|�%t j � | � � d }t j � |||z |z � � }d} |s|t j � |� � r]t j � |||z dz t | � � z |z � � }| dz
} t j � |� � �]|S )a% Generates a suitable file name for writing output.
Often tools will want to take a file, do some kind of transformation to it,
and write it out again. This function determines an appropriate name for the
output file, through one or more of the following steps:
- changing the output directory
- appending suffix before file extension
- replacing the file extension
- suffixing the filename with a number (``#1``, ``#2``, etc.) to avoid
overwriting an existing file.
Args:
input: Name of input file.
outputDir: Optionally, a new directory to write the file into.
suffix: Optionally, a string suffix is appended to file name before
the extension.
extension: Optionally, a replacement for the current file extension.
overWrite: Overwriting an existing file is permitted if true; if false
and the proposed filename exists, a new name will be generated by
adding an appropriate number suffix.
Returns:
str: Suitable output filename
r N� �#)�os�path�split�splitext�
numberAddedRE�join�exists�repr)
�input� outputDir� extension� overWrite�suffix�dirName�fileName�ext�output�ns
�g/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fontTools/misc/cliTools.py�makeOutputFileNamer
s � �8 ��
�
�e�,�,��G�X��G�$�$�X�.�.�M�H�c�� ����"�"�8�,�,�Q�/�H����G�$�$�U�+�+�A�.� �
�W�\�\�'�8�f�#4�y�#@�
A�
A�F� �A�� ��g�n�n�V�$�$� ��W�\�\���F�*�S�0�4��7�7�:�Y�F�� �F�
��F�A� �g�n�n�V�$�$� �
�M� )NNFr )�__doc__r �re�compiler r � r r �<module>r sU �� N� N� � � � � � � � � ��
�8�$�$�
� DF�+� +� +� +� +� +r