← Back
Editing: ptutils.cpython-311.pyc
� �@�c9 � �& � d Z ddlZddlmZ ddlmZmZmZ ddlmZm Z ddl mZ ddl mZ ddl mZ ddlmZ ddlZddlZddlZ e� � Zd d �dedefd �Zd d �dedededefd�Zddededefd�Zd� Z G d� de� � Z G d� de� � ZdS )zfprompt-toolkit utilities Everything in this module is a private API, not to be used outside IPython. � N)�wcwidth)�provisionalcompleter�cursor_to_position�_deduplicate_completions)� Completer� Completion)�Lexer)� PygmentsLexer)�patch_stdout� �� min_elide�string�returnc � � | � dd� � } | � dd� � } t | � � |k r| S | � d� � }| � t j � � }|d dk r|� � � t |� � dk r@d � |d |d dd� |d dd� |d � � S t |� � dk r`dt j z dz t j z dz � |d |d dd� |d dd� |d � � S | S )a� If a string is long enough, and has at least 3 dots, replace the middle part with ellipses. If a string naming a file is long enough, and has at least 3 slashes, replace the middle part with ellipses. If three consecutive dots, or two consecutive dots are encountered these are replaced by the equivalents HORIZONTAL ELLIPSIS or TWO DOT LEADER unicode equivalents z...� …z..u ‥�.���� � u {}.{}…{}.{}r � N���z{}u {}…{})�replace�len�split�os�sep�pop�format)r r �object_parts� file_partss �:/usr/lib/python3/dist-packages/IPython/terminal/ptutils.py�_elide_pointr# sU � � �^�^�E�";� <� <�F� �^�^�D�!5� 6� 6�F� �6�{�{�Y���� ��<�<��$�$�L����b�f�%�%�J��"�~���������� �<���1���2�9�9���O���O�B�Q�B�����R�S�S�!���� � � � �Z���1� � ��r�v� � =�=���F��M�U�U��q�M�:�a�=��!��,�j��n�R�S�S�.A�:�b�>� � � � �M� �typedr c � � t | � � |k r| S t |� � dz }|dk r| S | � |� � r7t | � � t |� � k r| dd� � d| |d� � �S | S )zT Elide the middle of a long string if the beginning has already been typed. r � Nr )r � startswith)r r% r �cut_how_muchs r"