§
    ŒŸjH  ã                   óh   — d Z ddlZddlmZ ddlZddlZddlZddlZddlZddl	m
Z
 dZedfd„Zd„ ZdS )z
Utilities for end-users.
é    N)Ú
namedtuple)ÚInterpreterFc                 ó  ‡ ‡— t           r!t          j        ddt          j        ¬¦  «          G ˆˆ fd„d¦  «        }	 ddl}ddl}|                      |¦   «         j        ¦  «         |                     d¦  «         |                     d	¦  «         |                     d
¦  «         |                     d¦  «         |                     d¦  «         | 	                    d¦  «         dS # t          $ r t          d¦  «         Y dS w xY w)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                   ó   •— e Zd Zˆ ˆfd„ZdS )úsetup_readline.<locals>.JediRLc                 óŽ  •‡— |dk    �rt           j                             dt          j        ¦   «         ¦  «         	 t          j        dt          ‰¦  «        z   ¦  «         t          ‰‰j	        g¦  «        }| 
                    ‰¬¦  «        }t          j        d|¦  «         ˆfd„|D ¦   «         | _        n.#  t          j        dt          j        ¦   «         z   ¦  «         ‚ xY w	 t           j                             d¦  «         n$# t           j                             d¦  «         w xY w	 | j        |         S # t           $ r Y dS w xY w)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   zStart REPL completion: )ÚfuzzyzREPL completions: %sc                 ó^   •— g | ])}‰d t          ‰¦  «        |j        z
  …         |j        z   ‘Œ*S )N)ÚlenÚ_like_name_lengthÚname_with_symbols)Ú.0ÚcÚtexts     €úW/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/jedi/utils.pyú
<listcomp>z;setup_readline.<locals>.JediRL.complete.<locals>.<listcomp>Y   sJ   ø€ ð $ð $ð $àð Ð=�c $™iœi¨!Ô*=Ñ=Ð=Ô>ÀÔATÑTð$ð $ð $ó    zREPL Completion error:
N)ÚsysÚpathÚinsertÚosÚgetcwdÚloggingÚdebugÚreprr   Ú__dict__ÚcompleteÚmatchesÚerrorÚ	tracebackÚ
format_excÚpopÚ
IndexError)Úselfr   ÚstateÚinterpreterÚcompletionsr   Únamespace_modules    `   €€r   r!   z'setup_readline.<locals>.JediRL.completeE   sF  øø€ ð ˜Šz‰zÝ”—’ ¥2¤9¡;¤;Ñ/Ô/Ð/ð$Ý”MÐ";½dÀ4¹j¼jÑ"HÑIÔIÐIÝ"-¨dÐ5EÔ5NÐ4OÑ"PÔ"P�Kà"-×"6Ò"6¸UÐ"6Ñ"CÔ"C�KÝ”MÐ"8¸+ÑFÔFÐFð$ð $ð $ð $à!,ð$ñ $ô $�D”L�LøðÝ”MÐ"<½yÔ?SÑ?UÔ?UÑ"UÑVÔVÐVØøøøð !õ ”H—L’L ‘O”O�O�Oø•C”H—L’L ‘O”O�O�OøøøðØ”| EÔ*Ð*øÝð ð ð Ø�t�tðøøøs0   ¼A8B5 Â4D Â5+C Ã D Ä!D%Ä)D6 Ä6
EÅEN)Ú__name__Ú
__module__Ú__qualname__r!   )r   r,   s   €€r   ÚJediRLr   D   s3   ø€ € € € € ð 	ð  	ð  	ð  	ð  	ð  	ð  	ð  	r   r0   r   Nztab: completezset completion-ignore-case onzset show-all-if-unmodifiedzset show-all-if-ambiguous onz&set completion-prefix-display-length 2Ú z$Jedi: Module readline not available.)ÚREADLINE_DEBUGr   ÚbasicConfigÚDEBUGÚrlcompleterÚreadlineÚset_completerr!   Úparse_and_bindÚset_completer_delimsÚImportErrorÚprint)r,   r   r0   r5   r6   s   ``   r   Úsetup_readliner<      s^  øø€ õT ð 
ÝÔØ$ØÝ”-ð	
ñ 	
ô 	
ð 	
ð!ð !ð !ð !ð !ð !ð !ð !ñ !ô !ð !ðF*ð
 	ÐÐÐØˆˆˆð 	×Ò˜v˜v™xœxÔ0Ñ1Ô1Ð1Ø×Ò Ñ0Ô0Ð0à×ÒÐ ?Ñ@Ô@Ð@à×ÒÐ <Ñ=Ô=Ð=Ø×ÒÐ >Ñ?Ô?Ð?à×ÒÐ HÑIÔIÐIà×%Ò% bÑ)Ô)Ð)Ð)Ð)øõ ð 6ð 6ð 6ÝÐ4Ñ5Ô5Ð5Ð5Ð5Ð5ð6øøøs   ¼C& Ã&DÄDc                  ó�   — t          dd¦  «        } ddlm} t          j        d|¦  «        } | d„ t          |¦  «        D ¦   «         Ž S )z_
    Returns a namedtuple of Jedi's version, similar to Python's
    ``sys.version_info``.
    ÚVersionzmajor, minor, micror   )Ú__version__z
[a-z]+|\d+c                 óB   — g | ]\  }}|d k    r|nt          |¦  «        ‘ŒS )é   )Úint)r   ÚiÚxs      r   r   z version_info.<locals>.<listcomp>†   s.   € ÐIÐIÐI±°°A˜!˜qš&˜&�Q�Q¥c¨!¡f¤fÐIÐIÐIr   )r   Újedir?   ÚreÚfindallÚ	enumerate)r>   r?   Útupls      r   Úversion_inforJ   ~   sY   € õ
 ˜Ð$9Ñ:Ô:€GØ Ð Ð Ð Ð Ð ÝŒ:�m [Ñ1Ô1€DØˆ7ÐIÐI½À4¹¼ÐIÑIÔIÐJÐJr   )Ú__doc__Ú__main__Úcollectionsr   r   r$   rF   r   r   rE   r   r2   r<   rJ   © r   r   ú<module>rO      s³   ððð ð €€€Ø "Ð "Ð "Ð "Ð "Ð "Ø €€€Ø Ð Ð Ð Ø 	€	€	€	Ø 	€	€	€	Ø 
€
€
€
à Ð Ð Ð Ð Ð ð €ð %-°Eð h*ð h*ð h*ð h*ðVKð Kð Kð Kð Kr   