� >��g]� ��dZddlZddlZddlZddlmZmZddlmZm Z ddl m Z e d���ddee d e d ed dfd ���Ze d���ddee d e d ed dfd ���Ze d���ddee d e d ed dfd���Zddee d e d ed dfd�Zde de de de d e f d�Zejd��Zde d ee fd�Zde de de de d e f d�Zde d e fd�Ze d���dd�de de d e fd���ZdS) zMNice output for Black. The double calls are for patching purposes in tests. �N)�Any�Optional)�echo�style)� mypyc_attrT)� patchable�message�nl�styles�returnc �Z�|�d|vrd|d<t|fi|��}t||d���dS)N�boldT�r �err�rr�r r r s �\/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/black/output.py�_outrsL���� �� � �!�F�6�N���*�*�6�*�*����R�T�"�"�"�"�"�"�c �Z�|�d|vrd|d<t|fi|��}t||d���dS)N�fg�redTrrrs r�_errrsL���� �v� � � �F�4�L���*�*�6�*�*����R�T�"�"�"�"�"�"rc �$�t|fd|i|��dS�Nr )rrs r�outr!s#����"�"�R�"�6�"�"�"�"�"rc �$�t|fd|i|��dSr)rrs rrr&s#����"�"�R�"�6�"�"�"�"�"r�a�b�a_name�b_namec�������tj|���tj|�������fd�t�d��D��}d�|��S)zHReturn a unified diff string between each cell in notebooks `a` and `b`.c ���g|]}\}}|ddk�td��d|d��dzd��d|d��dz��d|����d|������~S)� cell_type�code��cells�source� z:cell_)�diff�join)�.0� cell_number�cellr �a_nbr!�b_nbs ����r� <listcomp>zipynb_diff.<locals>.<listcomp>.s���� � � � �K�� � � �� &� &� � �G�G�D��M�+�.�x�8� 9� 9�D� @� �G�G�D��M�+�.�x�8� 9� 9�D� @�� *� *�[� *� *�� *� *�[� *� *�  � � '� &� &rr'r&)�json�loads� enumerater+)rrr r!� diff_linesr/r0s `` @@r� ipynb_diffr6*sy������ �:�a�=�=�D� �:�a�=�=�D� � � � � � � �"+�4��=�!9�!9� � � �J� �7�7�:� � �rz(.*?(?:\r\n|\n|\r|$))r(c��d�t�|��D��}|ddkr|�d��|S)z�Split a string into lines ignoring form feed and other chars. This mimics how the Python parser splits source code. A simplified version of the function with the same name in Lib/ast.py c��g|] }|d�� S)r�)r,�matchs rr1z%_splitlines_no_ff.<locals>.<listcomp>Es�� C� C� C�5�e�A�h� C� C� Cr�����r&)� _line_pattern�finditer�pop)r(�results r�_splitlines_no_ffr@>sI��D� C�M�$:�$:�6�$B�$B� C� C� C�F� �b�z�R���� � �2���� �Mrc�L�ddl}t|��}t|��}g}|�||||d���D]Q}|ddkr|�|���$|�|dz��|�d���Rd�|��S) z9Return a unified diff string between strings `a` and `b`.rN�)�fromfile�tofile�nr;r)z\ No newline at end of file r&)�difflibr@� unified_diff�appendr+) rrr r!rF�a_lines�b_linesr5�lines rr*r*Ks����N�N�N���"�"�G���"�"�G��J��$�$���6�&�A�%��� @� @�� ��8�t� � � � � �d� #� #� #� #� � � �d�T�k� *� *� *� � � �>� ?� ?� ?� ?� �7�7�:� � �r�contentsc��|�d��}t|��D]�\}}|�d��s|�d��r d|zdz}nY|�d��r d|zdz}n;|�d��r d |zdz}n|�d ��rd |zdz}|||<��d�|��S) z(Inject the ANSI color codes to the diff.r)z+++z---zzz@@z�+z�-z)�splitr4� startswithr+)rL�lines�irKs r� color_diffrT`s��� �N�N�4� � �E��U�#�#� � ���4� �?�?�5� !� !� 1�T�_�_�U�%;�%;� 1��t�#�i�/�D�D� �_�_�T� "� "� 1���$�y�0�D�D� �_�_�S� !� !� 1���$�y�0�D�D� �_�_�S� !� !� 1���$�y�0�D���a��� �9�9�U� � �r)�ensure_final_newline�outputrUc���tjddddd���5}|D]<}|�|��|r#|r!|ddkr|�d���= d d d ��n #1swxYwY|jS) z;Dump `output` to a temporary file. Return path to the file.�w�blk_z.logF�utf8)�mode�prefix�suffix�delete�encodingr;r)N)�tempfile�NamedTemporaryFile�write�name)rUrV�frRs r� dump_to_filereps��� � $� ���u�v� � � �� �� � �E� �G�G�E�N�N�N�#� �� �%��)�t�2C�2C����� � � �� ������������������� �6�Ms�AA'�'A+�.A+)NT)�__doc__r2�rer`�typingrr�clickrr�mypy_extensionsr�str�boolrrrrr6�compiler<�listr@r*rTrer9rr�<module>ros�����  � � � � � � � ����� � � � � � � � ���������&�&�&�&�&�&� ��d����#�#�(�3�-�#�D�#�3�#�4�#�#�#���#� ��d����#�#�(�3�-�#�D�#�3�#�4�#�#�#���#� ��d����#�#��#��#�4�#�#�#�$�#�#�#���#�#�#��#��#�4�#�#�#�$�#�#�#�#��#��#��s��C��C�����"�� �3�4�4� � �c� �d�3�i� � � � ��C��C����c��c�����* �� �� � � � �  ��d����<@� � � �#� �T� �S� � � ��� � � r
Memory