Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/jedi/__pycache__/utils.cpython-39.pyc
Ðазад
a j�hH � @ sj d Z ddlZddlmZ ddlZddlZddlZddlZddlZddl m Z dZedfdd�Zdd � Z dS ) z Utilities for end-users. � N)� namedtuple)�InterpreterFc s� t rtjddtjd� G � �fdd�d�}zddl}ddl}W n tyX td� Y nL0 |�|� j � |� d � |� d � |� d� |� d� |� d � |�d� dS )a� This function sets up :mod:`readline` to use Jedi in a Python interactive shell. If you want to use a custom ``PYTHONSTARTUP`` file (typically ``$HOME/.pythonrc.py``), you can add this piece of code:: try: from jedi.utils import setup_readline except ImportError: # Fallback to the stdlib readline completer if it is installed. # Taken from http://docs.python.org/2/library/rlcompleter.html print("Jedi is not installed, falling back to readline") try: import readline import rlcompleter readline.parse_and_bind("tab: complete") except ImportError: print("Readline is not installed either. No tab completion is enabled.") else: setup_readline() This will fallback to the readline completer if Jedi is not installed. The readline completer will only complete names in the global namespace, so for example:: ran<TAB> will complete to ``range``. With Jedi the following code:: range(10).cou<TAB> will complete to ``range(10).count``, this does not work with the default cPython :mod:`readline` completer. You will also need to add ``export PYTHONSTARTUP=$HOME/.pythonrc.py`` to your shell profile (usually ``.bash_profile`` or ``.profile`` if you use bash). z /tmp/jedi.log�a)�filename�filemode�levelc s e Zd Z� �fdd�ZdS )zsetup_readline.<locals>.JediRLc s� |dkr�t j�dt�� � z�zPt�dt� � � t� �j g�}|j �d�}t�d|� � fdd�|D �| _W n t�dt �� � � Y n0 W t j�d� nt j�d� 0 z| j| W S ty� Y dS 0 dS ) a This complete stuff is pretty weird, a generator would make a lot more sense, but probably due to backwards compatibility this is still the way how it works. The only important part is stuff in the ``state == 0`` flow, everything else has been copied from the ``rlcompleter`` std. library module. r zStart REPL completion: )�fuzzyzREPL completions: %sc s( g | ] }� d t � �|j � |j �qS )N)�lenZ_like_name_lengthZname_with_symbols)�.0�c��text� �z/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/jedi/utils.py� <listcomp>Y s �z;setup_readline.<locals>.JediRL.complete.<locals>.<listcomp>zREPL Completion error: N)�sys�path�insert�os�getcwd�logging�debug�reprr �__dict__�complete�matches�error� traceback� format_exc�pop� IndexError)�selfr �state�interpreterZcompletions�r �namespace_moduler r r E s$ � z'setup_readline.<locals>.JediRL.completeN)�__name__� __module__�__qualname__r r r$ r r �JediRLD s r) r Nz$Jedi: Module readline not available.z tab: completezset completion-ignore-case onzset show-all-if-unmodifiedzset show-all-if-ambiguous onz&set completion-prefix-display-length 2� )�READLINE_DEBUGr �basicConfig�DEBUG�rlcompleter�readline�ImportError�printZ set_completerr �parse_and_bindZset_completer_delims)r% r r) r. r/ r r$ r �setup_readline s&