403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/IPython/core/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/IPython/core/__pycache__/completer.cpython-311.pyc
�

�@�cP;��F�dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlmZddlmZddlmZmZmZmZmZmZmZmZmZmZm Z ddl!m"Z"ddl#m$Z$dd	l%m&Z&m'Z'dd
l(m)Z)ddl*m+Z+ddl,m-Z-dd
l.m/Z/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6m7Z7m8Z8mZ9m:Z:m;Z;m<Z<ddl=m>Z>ddl?Z?dZ@	ddlAZAdeAjB_CddlDZAddlEZAdZFn
#eG$rdZFYnwxYwddgZHddgZIe
jJdkrdZKndZKdZLGd�deM��ZNejOdeN���e+edPd!�����ZPd"�ZQeKfd#�ZRd$eSd%eeSeTeSffd&�ZUd$eSd'eTd(eSd%eSfd)�ZVd*�ZWGd+�d,��ZXGd-�d.��ZYeeYZZd/eSd0eZd%eZfd1�Z[dd2�d/eSd0eZd3eTd%eZfd4�Z\e
jJdkrd5Z]nd6Z]d7Z^Gd8�d9e_��Z`Gd:�de>��Zad;�Zb	dQd<eeeSeceeeSecffd=eSd>eSd?e eeSecfd%eeSedeeSff
d@�Zed/eSdAeddBedd%edfdC�Zfd/eSdDedd%eededffdE�ZgdF�Zhd/eSd%eeSeeSffdG�Zid/eSd%eeSeeSffdH�Zjd%eSfdI�Zkd%eSfdJ�ZlGdK�dLe��ZmGdM�dea��ZndNeeededfd%eeSfdO�ZodS)Ru�Completion for IPython.

This module started as fork of the rlcompleter module in the Python standard
library.  The original enhancements made to rlcompleter have been sent
upstream and were accepted as of Python 2.3,

This module now support a wide variety of completion mechanism both available
for normal classic Python code, as well as completer for IPython specific
Syntax like magics.

Latex and Unicode completion
============================

IPython and compatible frontends not only can complete your code, but can help
you to input a wide range of characters. In particular we allow you to insert
a unicode character using the tab completion mechanism.

Forward latex/unicode completion
--------------------------------

Forward completion allows you to easily type a unicode character using its latex
name, or unicode long description. To do so type a backslash follow by the
relevant name and press tab:


Using latex completion:

.. code::

    \alpha<tab>
    α

or using unicode completion:


.. code::

    \GREEK SMALL LETTER ALPHA<tab>
    α


Only valid Python identifiers will complete. Combining characters (like arrow or
dots) are also available, unlike latex they need to be put after the their
counterpart that is to say, ``F\\vec<tab>`` is correct, not ``\\vec<tab>F``.

Some browsers are known to display combining characters incorrectly.

Backward latex completion
-------------------------

It is sometime challenging to know how to type a character, if you are using
IPython, or any compatible frontend you can prepend backslash to the character
and press ``<tab>`` to expand it to its latex form.

.. code::

    \α<tab>
    \alpha


Both forward and backward completions can be deactivated by setting the
``Completer.backslash_combining_completions`` option to ``False``.


Experimental
============

Starting with IPython 6.0, this module can make use of the Jedi library to
generate completions both using static analysis of the code, and dynamically
inspecting multiple namespaces. Jedi is an autocompletion and static analysis
for Python. The APIs attached to this new mechanism is unstable and will
raise unless use in an :any:`provisionalcompleter` context manager.

You will find that the following are experimental:

    - :any:`provisionalcompleter`
    - :any:`IPCompleter.completions`
    - :any:`Completion`
    - :any:`rectify_completions`

.. note::

    better name for :any:`rectify_completions` ?

We welcome any feedback on these new API, and we also encourage you to try this
module in debug mode (start IPython with ``--Completer.debug=True``) in order
to have extra logging information if :any:`jedi` is crashing, or if current
IPython completer pending deprecations are returning results not yet handled
by :any:`jedi`

Using Jedi for tab completion allow snippets like the following to work without
having to execute any code:

   >>> myvar = ['hello', 42]
   ... myvar[1].bi<tab>

Tab completion will be able to infer that ``myvar[1]`` is a real number without
executing any code unlike the previously available ``IPCompleter.greedy``
option.

Be sure to update :any:`jedi` to the latest stable version or to try the
current development version to get better completions.
�N)�contextmanager)�
import_module)�SimpleNamespace)�Iterable�Iterator�List�Tuple�Union�Any�Sequence�Dict�
NamedTuple�Pattern�Optional)�TryNext)�	ESC_MAGIC)�
latex_symbols�reverse_latex_symbol)�
InspectColors)�skip_doctest)�generics)�dir2�get_real_method)�ensure_dir_exists)�	arg_split)�Bool�Enum�Intr�Unicode�default�observe)�ConfigurableTF)� iK)ii��	Completer�IPCompleter�win32� z ()[]{}?=\|;:'#*"^&i�c��eZdZdZdS)�ProvisionalCompleterWarningz�
    Exception raise by an experimental feature in this module.

    Wrap code in :any:`provisionalcompleter` context manager if you
    are certain you want to use an unstable feature.
    N)�__name__�
__module__�__qualname__�__doc__���8/usr/lib/python3/dist-packages/IPython/core/completer.pyr)r)�s��������	�Dr/r)�error��category�ignorec#�K�tj��5tj|t���dV�ddd��dS#1swxYwYdS)a�
    This context manager has to be used in any place where unstable completer
    behavior and API may be called.

    >>> with provisionalcompleter():
    ...     completer.do_experimental_things() # works

    >>> completer.do_experimental_things() # raises.

    .. note::

        Unstable

        By using this context manager you agree that the API in use may change
        without warning, and that you won't complain if they do so.

        You also understand that, if the API is not to your liking, you should report
        a bug to explain your use case upstream.

        We'll be happy to get your feedback, feature requests, and improvements on
        any of the unstable APIs!
    r2N)�warnings�catch_warnings�filterwarningsr))�actions r0�provisionalcompleterr:�s�����2
�	 �	"�	"������1L�M�M�M�M�
������������������������s� A�A�
Ac�n�|�d��dzrdS|�d��dzrdSdS)aReturn whether a string has open quotes.

    This simply counts whether the number of quote characters of either type in
    the string is odd.

    Returns
    -------
    If there is an open quote, the quote character is returned.  Else, return
    False.
    �"��'F)�count)�ss r0�has_open_quotesrA�sA��	�w�w�s�|�|�a����s�	
�������	���s��ur/c���t|��t���zr9tjdkrd|zdzSd��fd�|D����S|S)z.Escape a string to protect certain characters.r&r<�c3�.�K�|]}|�vrd|zn|V��dS��\Nr.)�.0�c�protectabless  �r0�	<genexpr>z#protect_filename.<locals>.<genexpr>�s5�����M�M�a��\�(9�(9�D�1�H�H�q�M�M�M�M�M�Mr/)�set�sys�platform�join)r@rIs `r0�protect_filenamerO�se���
�1�v�v��L�!�!�!���<�7�"�"���7�S�=� ��7�7�M�M�M�M�1�M�M�M�M�M�M��r/�path�returnc���d}d}|}|�d��rCd}t|��dz
}tj�|��}|r|d|�}n|}|||fS)a�Expand ``~``-style usernames in strings.

    This is similar to :func:`os.path.expanduser`, but it computes and returns
    extra information that will be useful if the input was being used in
    computing completions, and you wish to return the completions with the
    original '~' instead of its expanded value.

    Parameters
    ----------
    path : str
        String to be expanded.  If no ~ is present, the output is the same as the
        input.

    Returns
    -------
    newpath : str
        Result of ~ expansion in the input path.
    tilde_expand : bool
        Whether any expansion was performed or not.
    tilde_val : str
        The value that ~ was replaced with.
    FrC�~T�N)�
startswith�len�osrP�
expanduser)rP�tilde_expand�	tilde_val�newpath�rests     r0�expand_userr]�s{��0�L��I��G����s��� ����4�y�y��{���'�$�$�T�*�*���	 ���$����I�I��I��L�)�+�+r/rYrZc�6�|r|�|d��S|S)z8Does the opposite of expand_user, with its outputs.
    rS��replace)rPrYrZs   r0�
compress_userra's%�����|�|�I�s�+�+�+��r/c�X�d\}}|�d��rd}n|�d��rd}|�d��rd}|�d��rd	|dd
�vr|dd
�}d}n-|�d	��rd	|dd
�vr|dd
�}d}|||fS)z�key for sorting completions

    This does several things:

    - Demote any completions starting with underscores to the end
    - Insert any %magic and %%cellmagic completions in the alphabetical order
      by their name
    )rr�__r=�_rT�=���z%%�%N)rU�endswith)�word�prio1�prio2s   r0�completions_sorting_keyrl0s����L�E�5����t�������	
����	�	�����}�}�S���������t�����d�1�2�2�h�������8�D��E��	
����	�	���d�1�2�2�h�������8�D��E��$���r/c��eZdZdZd�Zd�ZdS)�_FakeJediCompletionz�
    This is a workaround to communicate to the UI that Jedi has crashed and to
    report a bug. Will be used only id :any:`IPCompleter.debug` is set to true.

    Added in IPython 6.0 so should likely be removed for 7.0

    c�Z�||_||_d|_||_d|_d|_dS)N�crashedrC�fake)�name�complete�type�name_with_symbols�	signature�_origin)�selfrrs  r0�__init__z_FakeJediCompletion.__init__Ys1����	���
���	�!%����������r/c��dS)Nz)<Fake completion object jedi has crashed>r.�rxs r0�__repr__z_FakeJediCompletion.__repr__bs��:�:r/N)r*r+r,r-ryr|r.r/r0rnrnPs<�����������;�;�;�;�;r/rnc�X�eZdZdZgd�Zdddd�dededed	ed
df
d�Zd�Zd
e	fd
�Z
d�ZdS)�
Completionam
    Completion object used and return by IPython completers.

    .. warning::

        Unstable

        This function is unstable, API may change without warning.
        It will also raise unless use in proper context manager.

    This act as a middle ground :any:`Completion` object between the
    :any:`jedi.api.classes.Completion` object and the Prompt Toolkit completion
    object. While Jedi need a lot of information about evaluator and how the
    code should be ran/inspected, PromptToolkit (and other frontend) mostly
    need user facing information.

    - Which range should be replaced replaced by what.
    - Some metadata (like completion type), or meta information to displayed to
      the use user.

    For debugging purpose we can also store the origin of the completion (``jedi``,
    ``IPython.python_matches``, ``IPython.magics_matches``...).
    ��start�end�textrtrvrwNrC�rtrwrvr�r�r�rtrQc��tjdtd���||_||_||_||_||_||_dS)Nz~``Completion`` is a provisional API (as of IPython 6.0). It may change without warnings. Use in corresponding context manager.r=�r3�
stacklevel)	r6�warnr)r�r�r�rtrvrw)rxr�r�r�rtrwrvs       r0ryzCompletion.__init__�s[���
�>� ;�q�	J�	J�	J�	J�
��
������	���	�"�������r/c�`�d|j�d|j�d|j�d|jpd�d|jpd�d�S)Nz<Completion start=z end=z text=z type=�?z, signature=z,>)r�r�r�rtrvr{s r0r|zCompletion.__repr__�sH�������T�X�X�X�t�y�y�y�$�)�2B�s�2B�2B�D�N�DY�VY�DY�DY�[�	[r/c�b�|j|jko|j|jko|j|jkS)a]
        Equality and hash do not hash the type (as some completer may not be
        able to infer the type), but are use to (partially) de-duplicate
        completion.

        Completely de-duplicating completion is a bit tricker that just
        comparing as it depends on surrounding text, which Completions are not
        aware of.
        )r�r�r�)rx�others  r0�__eq__zCompletion.__eq__�s7���z�U�[�(�$��H��	�!�$��I���#�	$r/c�D�t|j|j|jf��S�N)�hashr�r�r�r{s r0�__hash__zCompletion.__hash__�s���T�Z���4�9�5�6�6�6r/)r*r+r,r-�	__slots__�int�strryr|rr�r�r.r/r0r~r~fs���������0I�H�H�I�EI�SU�ac����c����3����hl�����[�[�[�$�T�$�$�$�$�7�7�7�7�7r/r~r��completionsc#�BK�t|��}|sdStd�|D����}td�|D����}t��}|D]F}|||j�|jz||j|�z}||vr|V�|�|���GdS)a
    Deduplicate a set of completions.

    .. warning::

        Unstable

        This function is unstable, API may change without warning.

    Parameters
    ----------
    text : str
        text that should be completed.
    completions : Iterator[Completion]
        iterator over the completions to deduplicate

    Yields
    ------
    `Completions` objects
    Completions coming from multiple sources, may be different but end up having
    the same effect when applied to ``text``. If this is the case, this will
    consider completions as equal and only emit the first encountered.
    Not folded in `completions()` yet for debugging purpose, and to detect when
    the IPython completer does return things that Jedi does not, but should be
    at some point.
    Nc3�$K�|]}|jV��dSr��r��rGrHs  r0rJz+_deduplicate_completions.<locals>.<genexpr>�s$����1�1��A�G�1�1�1�1�1�1r/c3�$K�|]}|jV��dSr��r�r�s  r0rJz+_deduplicate_completions.<locals>.<genexpr>�s$����-�-�A�!�%�-�-�-�-�-�-r/)�list�min�maxrKr�r�r��add)r�r��	new_start�new_end�seenrH�new_texts       r0�_deduplicate_completionsr��s�����6�{�#�#�K������1�1�[�1�1�1�1�1�I��-�-��-�-�-�-�-�G��5�5�D�
�����	�!�'�)�*�Q�V�3�d�1�5��=�6I�I���4����G�G�G��H�H�X�����	�r/)�_debugr�c	#�K�tjdtd���t|��}|sdSd�|D��}d�|D��}t	|��}t|��}t
��}t
��}|D]�}	|||	j�|	jz||	j	|�z}
|	j
dkr|�|
��n |	j
dkr|�|
��t|||
|	j
|	j
|	j�	��V���|�|��}|r|rt!d
|��dSdSdS)a�
    Rectify a set of completions to all have the same ``start`` and ``end``

    .. warning::

        Unstable

        This function is unstable, API may change without warning.
        It will also raise unless use in proper context manager.

    Parameters
    ----------
    text : str
        text that should be completed.
    completions : Iterator[Completion]
        iterator over the completions to rectify
    _debug : bool
        Log failed completion

    Notes
    -----
    :any:`jedi.api.classes.Completion` s returned by Jedi may not have the same start and end, though
    the Jupyter Protocol requires them to behave like so. This will readjust
    the completion to have the same ``start`` and ``end`` by padding both
    extremities with surrounding text.

    During stabilisation should support a ``_debug`` option to log which
    completion are return by the IPython completer and not found in Jedi in
    order to make upstream bug report.
    z�`rectify_completions` is a provisional API (as of IPython 6.0). It may change without warnings. Use in corresponding context manager.r=r�Nc3�$K�|]}|jV��dSr�r�r�s  r0rJz&rectify_completions.<locals>.<genexpr>�s$����
+�
+�!�a�g�
+�
+�
+�
+�
+�
+r/c3�$K�|]}|jV��dSr�r�r�s  r0rJz&rectify_completions.<locals>.<genexpr>�s$����'�'�a�A�E�'�'�'�'�'�'r/�jedizIPCompleter.python_matchesr�z#IPython.python matches have extras:)r6r�r)r�r�r�rKr�r�r�rwr�r~rtrv�
difference�print)r�r�r��starts�endsr�r��	seen_jedi�seen_python_matchesrHr��diffs            r0�rectify_completionsr��s�����>
�M�9�7�1�F�F�F�F�
�{�#�#�K�����
+�
+�{�
+�
+�
+�F�'�'�;�'�'�'�D��F���I��$�i�i�G����I��%�%��
�n�n���	�!�'�)�*�Q�V�3�d�1�5��=�6I�I���9�����M�M�(�#�#�#�#�
�Y�6�
6�
6��#�#�H�-�-�-���G�X�A�F�A�I�ab�al�m�m�m�m�m�m�m��)�)�)�4�4�D��;��;�
�3�T�:�:�:�:�:�;�;�;�;r/z 	
`!@#$^&*()=+[{]}|;'",<>?z 	
`!@#$^&*()=+[{]}\|;:'",<>?z =
c�d�eZdZdZeZdZdZdd�Ze	d���Z
e
jd���Z
dd�ZdS)�CompletionSplitteraWAn object to split an input line in a manner similar to readline.

    By having our own implementation, we can expose readline-like completion in
    a uniform manner to all frontends.  This object only needs to be given the
    line of text to be split and the cursor position on said line, and it
    returns the 'word' to be completed on at the cursor after splitting the
    entire line.

    What characters are used as splitting delimiters can be controlled by
    setting the ``delims`` attribute (this is a property that internally
    automatically builds the necessary regular expression)Nc�4�|�tjn|}||_dSr�)r��_delims�delims)rxr�s  r0ryzCompletionSplitter.__init__/s��/5�~�#�+�+�6������r/c��|jS)z*Return the string of delimiter characters.)r�r{s r0r�zCompletionSplitter.delims3s���|�r/c��dd�d�|D����zdz}tj|��|_||_||_dS)z&Set the delimiters for line splitting.�[rCc3� K�|]	}d|zV��
dSrEr.r�s  r0rJz,CompletionSplitter.delims.<locals>.<genexpr>;s&����5�5��T�1�W�5�5�5�5�5�5r/�]N)rN�re�compile�	_delim_rer��_delim_expr)rxr��exprs   r0r�zCompletionSplitter.delims8sT���R�W�W�5�5�f�5�5�5�5�5�5��;����D�)�)����������r/c�^�|�|n	|d|�}|j�|��dS)zBSplit a line of text with a cursor at the given position.
        Nrf)r��split)rx�line�
cursor_pos�ls    r0�
split_linezCompletionSplitter.split_line@s6���&�D�D�D��*��,=���~�#�#�A�&�&�r�*�*r/r�)
r*r+r,r-�DELIMSr�r�r�ry�propertyr��setterr�r.r/r0r�r�s�������
>�
>� �G�
�K��I���������X���]� � ��]� �+�+�+�+�+�+r/r�c�|��eZdZedd����d���Zeed����d���Zedd	����d���Z	edd
����d���Z
edd����d���Zd�fd
�	Zd�Z
d�Zd�Z�xZS)r$FaActivate greedy completion
        PENDING DEPRECATION. this is now mostly taken care of with Jedi.

        This will enable completion on elements of lists, results of function calls, etc.,
        but can be unsafe because the code is actually evaluated on TAB.
        ��helpT��configzYExperimental: Use Jedi to generate autocompletions. Default to True if jedi is installed.��
default_valuer�i�z�Experimental: restrict time (in milliseconds) during which Jedi can compute types.
        Set to 0 to stop computing types. Non-zero value lower than 100ms may hurt
        performance by preventing jedi to build its cache.
        zaEnable debug for the Completer. Mostly print extra information for experimental jedi integration.z�Enable unicode completions, e.g. \alpha<tab> . Includes completion of latex commands, unicode names, and expanding unicode characters back to latex commands.Nc���|�d|_nd|_||_|�i|_n||_g|_t	t
|��jdi|��dS)a�Create a new completer for the command line.

        Completer(namespace=ns, global_namespace=ns2) -> completer instance.

        If unspecified, the default namespace where completions are performed
        is __main__ (technically, __main__.__dict__). Namespaces should be
        given as dictionaries.

        An optional second namespace can be given.  This allows the completer
        to handle cases where both the local and global scopes need to be
        distinguished.
        NTFr.)�use_main_ns�	namespace�global_namespace�custom_matchers�superr$ry)rxr�r��kwargs�	__class__s    �r0ryzCompleter.__init__gsq���"��#�D���$�D��&�D�N��#�$&�D�!�!�$4�D�!�!���'��i����'�1�1�&�1�1�1�1�1r/c���|jrtj|_|dkr9d|vr|�|��|_n|�|��|_	|j|S#t$rYdSwxYw)z�Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        r�.N)r��__main__�__dict__r��attr_matches�matches�global_matches�
IndexError)rxr��states   r0rszCompleter.complete�s�����	/�%�.�D�N��A�:�:��d�{�{�#�0�0��6�6����#�2�2�4�8�8���	��<��&�&���	�	�	��4�4�	���s�A&�&
A4�3A4c����g}|j}t|��}tjtj���t|j�����t|j	�����fD]&}|D]!}|d|�|kr|dkr||���"�'tjd���t|j�����t|j	�����fD]L}�fd�|D��}|���D]'}|d|�|kr|dkr|||���(�M|S)z�Compute matches when text is a simple name.

        Return a list of all keywords, built-in functions and names currently
        defined in self.namespace or self.global_namespace that match.

        N�__builtins__z[^_]+(_[^_]+)+?\Zc���i|]J}��|���d�d�|�d��D����|��KS)rdc��g|]
}|d��S�rr.)rG�subs  r0�
<listcomp>z7Completer.global_matches.<locals>.<dictcomp>.<listcomp>�s��<�<�<�S�#�a�&�<�<�<r/)�matchrNr�)rGri�
snake_case_res  �r0�
<dictcomp>z,Completer.global_matches.<locals>.<dictcomp>�sd������� �&�&�t�,�,�����<�<�D�J�J�s�O�O�<�<�<�=�=�t���r/)�appendrV�keyword�kwlist�builtin_modr��keysr�r�r�r�r�)	rxr�r��match_append�n�lstri�	shortenedr�s	        @r0r�zCompleter.global_matches�s�������~����I�I���N�� �%�%�'�'����$�$�&�&�'�'���&�+�+�-�-�.�.�	
�	'�	'�C��
'�
'������8�t�#�#���(>�(>� �L��&�&�&��
'��
�#7�8�8�
����,�,�.�.�/�/��d�6K�6P�6P�6R�6R�1S�1S�T�	2�	2�C���������I�
"���(�(�
2�
2������8�t�#�#���(>�(>� �L��4��1�1�1��
2��r/c�����tjd|��}|r|�dd��\��nA|jr8tjd|j��}|sgS|�dd��\��ngS	t�|j��}n)#	t�|j��}n#gcYcYSxYwYnxYw|jr t|d��rt|��}nt|��}	tj
||��}n%#t$rYnt$r�t $rYnwxYwt#�������fd�|D��S)a�Compute matches when text contains a dot.

        Assuming the text is of the form NAME.NAME....[NAME], and is
        evaluatable in self.namespace or self.global_namespace, it will be
        evaluated and its attributes (as revealed by dir()) are used as
        possible completions.  (For class instances, class members are
        also considered.)

        WARNING: this can still invoke arbitrary C code, if an object
        with a __getattr__ hook is evaluated.

        z(\S+(\.\w+)*)\.(\w*)$rT�z(.+)\.(\w*)$r=�__all__c�:��g|]}|d���k���d|����S)Nr�r.)rG�w�attrr�r�s  ���r0r�z*Completer.attr_matches.<locals>.<listcomp>�s1���F�F�F��q��!��u��}�}�D�D�D�!�!�$�}�}�}r/)r�r��group�greedy�line_buffer�evalr�r��limit_to__all__�hasattr�get__all__entriesrr�complete_objectr�AssertionError�	ExceptionrV)	rxr��m�m2�obj�wordsr�r�r�s	      @@@r0r�zCompleter.attr_matches�s������
�H�-�t�4�4���	�����A���J�D�$�$�
�[�	���/�4�+;�<�<�B��
��	����!�A���J�D�$�$��I�	��t�T�^�,�,�C�C��	�
��4��!6�7�7����
��	�	�	�	�	�����������	�G�C��$;�$;�	�%�c�*�*�E�E���I�I�E�		��,�S�%�8�8�E�E���	�	�	��D��	�	�	���	�	�	�
�D�	����

��I�I��F�F�F�F�F�F�e�F�F�F�FsB�7B
�
B3�B&�%B3�&B.�*B3�.B3�-D�
D%�D%�$D%)NN)r*r+r,r�tagr��JEDI_INSTALLED�use_jedir�jedi_compute_type_timeout�debug�backslash_combining_completionsryrsr�r��
__classcell__�r�s@r0r$r$Hsr�������
�T�%�����
�c��c�����t�.�<�=�=�=�=@�S��S�=M�=M�
�!$��#��!
�!
�!
��S��S�
�
�	�
�D�u�G�
H�
H�
H��s�$�s�'�'�
�
'+�d�4�:�';�';�';�<?�3�d�3�;K�;K�$�
2�2�2�2�2�2�B���(���@4G�4G�4G�4G�4G�4G�4Gr/c�P�	t|d��}n	#gcYSxYwd�|D��S)z,returns the strings in the __all__ attributer�c�<�g|]}t|t���|��Sr.)�
isinstancer�)rGr�s  r0r�z%get__all__entries.<locals>.<listcomp>�s'��3�3�3�!�
�1�c� 2� 2�3�A�3�3�3r/)�getattr)rrs  r0rr�s>�����Y�'�'������	�	�	����3�3�u�3�3�3�3s��r��prefixr��extra_prefixc�N����|r|nd�t������fd�}g��fd�}|D]?}t|t��r||��r||����4||���@|sddd��D��fStjd|��}|�J�|���}	t
||zi��}	n#t$rddgfcYSwxYwd	d�d
�|D����zdz}
tj|
|tj	��}|�J�|�
��}|���}
g}�D]�}	|�|	��s�n#tttf$rY�3wxYw|t|	��d�}t|t��rt!|dz��nt!|d
z��}|d|�d��zd�}|dkr|�dd��}|�|
�|������|||fS)a*Used by dict_key_matches, matching the prefix to a list of keys

    Parameters
    ----------
    keys
        list of keys in dictionary currently being completed.
    prefix
        Part of the text already typed by the user. E.g. `mydict[b'fo`
    delims
        String of delimiters to consider when finding the current key.
    extra_prefix : optional
        Part of the text already typed in multi-key index cases. E.g. for
        `mydict['foo', "bar", 'b`, this would be `('foo', 'bar')`.

    Returns
    -------
    A tuple of three elements: ``quote``, ``token_start``, ``matched``, with
    ``quote`` being the quote that need to be used to close current string.
    ``token_start`` the position where the replacement should start occurring,
    ``matches`` a list of replacement/completion

    r.c���t|���krdS|D]!}t|ttf��sdS�"t	|���D]\}}||krdS�dS)NFT)rVrr��bytes�zip)�key�k�pt�Nprefix�prefix_tuples   ��r0�filter_prefix_tuplez,match_dict_keys.<locals>.filter_prefix_tuples�����s�8�8�w����5��	�	�A��a�#�u��.�.�
��u�u�
���l�+�+�	�	�E�A�r��B�w�w��u�u���tr/c�n��t|ttf��r��|��dSdSr�)rr�rr�)r�
filtered_keyss �r0�_add_to_filtered_keysz.match_dict_keys.<locals>._add_to_filtered_keys's=����c�C��<�(�(�	&�� � ��%�%�%�%�%�	&�	&r/rCrc�,�g|]}t|����Sr.)�repr)rGrs  r0r�z#match_dict_keys.<locals>.<listcomp>3s��6�6�6�1�t�A�w�w�6�6�6r/z["']Nz[^c3� K�|]	}d|zV��
dSrEr.r�s  r0rJz"match_dict_keys.<locals>.<genexpr><s&����6�6�!�T�A�X�6�6�6�6�6�6r/z]*$r<�"rTr>���z\")rVr�tupler��searchr�r�rrN�UNICODEr�rU�AttributeError�	TypeError�UnicodeErrorr�r$�indexr`r�)r�rr�rrr"r�quote_match�quote�
prefix_str�pattern�token_match�token_start�token_prefix�matchedr�rem�rem_reprrr!rs                  @@@r0�match_dict_keysr9�s������0$0�7�<�<�R�L��,���G�
�
�
�
�
�
�,.�M�&�&�&�&�&��%�%���a����	%�"�"�1�%�%�
2�%�%�a��j�1�1�1��!�!�!�$�$�$�$��7��1�6�6�
�6�6�6�6�6��)�G�V�,�,�K��"�"�"������E���&�5�.�"�-�-�
�
�������1�b�y���������R�W�W�6�6�v�6�6�6�6�6�6��>�G��)�G�V�R�Z�8�8�K��"�"�"��#�#�%�%�K��$�$�&�&�L��G��:�:��	��>�>�*�-�-�
��
���	�<�8�	�	�	��H�	����
�#�j�/�/�"�"�#��&0��c�&:�&:�P�4��c�	�?�?�?��S�4�Z�@P�@P���A����s� 3� 3�3�B�6�7���C�<�<� �'�'��U�3�3�H�	�����x�x�8�9�9�9�9��+�w�&�&s$�'B;�;C
�C
�E�E9�8E9r��columnc	�$�|�d��}|t|��ksEJd�t|��tt|���������t	d�|d|�D����|zS)a�
    Convert the (line,column) position of the cursor in text to an offset in a
    string.

    Parameters
    ----------
    text : str
        The text in which to calculate the cursor offset
    line : int
        Line of the cursor; 0-indexed
    column : int
        Column of the cursor 0-indexed

    Returns
    -------
    Position of the cursor in ``text``, 0-indexed.

    See Also
    --------
    position_to_cursor : reciprocal of this function

    �
z{} <= {}c3�:K�|]}t|��dzV��dS)rTN)rV)rGr�s  r0rJz%cursor_to_position.<locals>.<genexpr>us,����0�0�a�s�1�v�v��z�0�0�0�0�0�0r/N)r�rV�formatr��sum)r�r�r:�liness    r0�cursor_to_positionrA[s���.
�J�J�t���E��3�u�:�:����z�0�0��T���C��E�
�
�O�O�L�L�����0�0�5��$��<�0�0�0�0�0�6�9�9r/�offsetc��d|cxkrt|��ksnJd|�dt|�������|d|�}|�d��}|�d��}t|d��}||fS)a:
    Convert the position of the cursor in text (0 indexed) to a line
    number(0-indexed) and a column number (0-indexed) pair

    Position should be a valid position in ``text``.

    Parameters
    ----------
    text : str
        The text in which to calculate the cursor offset
    offset : int
        Position of the cursor in ``text``, 0-indexed.

    Returns
    -------
    (line, column) : (int, int)
        Line of the cursor; 0-indexed, column of the cursor 0-indexed

    See Also
    --------
    cursor_to_position : reciprocal of this function

    rz0 <= z <= Nr<rf)rVr�r?)r�rB�before�blinesr��cols      r0�position_to_cursorrGws���2
��#�#�#�#�#�d�)�)�#�#�#�#�#�#����#�d�)�)�)�&L�#�#�#�
�'�6�'�]�F�
�\�\�$�
�
�F��<�<����D�

�f�R�j�/�/�C���9�r/c�t�|tjvo*t|tt	|��|����S)z@Checks if obj is an instance of module.class_name if loaded
    )rL�modulesrrr)r�module�
class_names   r0�_safe_isinstancerL�s9��
�c�k�!�
H��s�G�M�&�$9�$9�:�F�F�G�G�Ir/c���t|��dkrdS|d}|dkrdS|d}|tjvs|dvrdS	tj|��}d|zd|zffS#t
$rYnwxYwdS)uvMatch Unicode characters back to Unicode name

    This does  ``☃`` -> ``\snowman``

    Note that snowman is not a valid python3 combining character but will be expanded.
    Though it will not recombine back to the snowman character by the completion machinery.

    This will not either back-complete standard sequences like \n, \b ...

    Returns
    =======

    Return a tuple with two elements:

    - The Unicode character that was matched (preceded with a backslash), or
        empty string,
    - a sequence (of 1), name for the match Unicode character, preceded by
        backslash, or empty if no match.
    
    r=�rCr.r'rFrf�r<r>)rV�string�
ascii_letters�unicodedatarr�KeyError)r��maybe_slash�char�unics    r0�back_unicode_name_matchesrW�s���*�4�y�y��{�{��v��r�(�K��d����v���8�D��v�#�#�#�t�y�'8�'8��v�
����%�%���D�y�$�t�)��%�%���
�
�
���
�����6s�A"�"
A/�.A/c���t|��dkrdS|d}|dkrdS|d}|tjvs|dvrdS	t|}d|z|gfS#t$rYnwxYwdS)uWMatch latex characters back to unicode name

    This does ``\ℵ`` -> ``\aleph``

    r=rNr'rFrfrO)rVrPrQrrS)r�rTrU�latexs    r0�back_latex_name_matchesrZ�s����4�y�y��{�{��v��r�(�K��d����v���8�D��v�#�#�#�t�y�'8�'8��v�
�$�T�*���D�y�%�� � ���
�
�
���
�����6s�A�
A%�$A%c�r�|j}|�d��std|z���|dd�S)a
    Get parameter name and value from Jedi Private API

    Jedi does not expose a simple way to get `param=value` from its API.

    Parameters
    ----------
    parameter
        Jedi's function `Param`

    Returns
    -------
    A string like 'a', 'b=1', '*args', '**kwargs'

    zparam zWJedi function parameter description have change format.Expected "param ...", found %r".�N)�descriptionrU�
ValueError)�	parameterr]s  r0�_formatparamchildrenr`�sT�� �'�K��!�!�(�+�+�K��<�>I�J�K�K�	K��q�r�r�?�r/c�f�t|d��rd|���}|sdS|���d}d|����dd���dzSdd�d	�d
�|���D��D����zS)aR
    Make the signature from a jedi completion

    Parameters
    ----------
    completion : jedi.Completion
        object does not complete a function type

    Returns
    -------
    a string consisting of the function signature, with the parenthesis but
    without the function name. example:
    `(a, *args, b=1, **kwargs)`

    �get_signaturesz(?)r�(rT)�maxsplitz(%s)z, c��g|]}|�|��Sr.r.�rG�fs  r0r�z#_make_signature.<locals>.<listcomp>s3��T�T�T�A�QR�T�a�T�T�Tr/c3�bK�|]*}|���D]}t|��V���+dSr�)�
defined_namesr`)rGrv�ps   r0rJz"_make_signature.<locals>.<genexpr>si����*N�*N�i�3<�3J�3J�3L�3L�*N�*N�./�+?�q�*A�*A�*N�*N�*N�*N�*N�*N�*Nr/)r�rb�	to_stringr�rN)�
completion�
signatures�c0s   r0�_make_signaturero�s���$�z�+�,�,�<��.�.�0�0�
��	��E�
�
&�
&�
(�
(��
+���2�<�<�>�>�'�'��a�'�8�8��;�;�;��4�9�9�T�T�*N�*N�S]�Sl�Sl�Sn�Sn�*N�*N�*N�T�T�T�U�U�U�Ur/c�P�eZdZUeed<eeed<eeed<eed<dS)�_CompleteResult�matched_textr��matches_origin�jedi_matchesN)r*r+r,r��__annotations__rrr.r/r0rqrqsJ�����������
�c�]�����S�M�!�!�!������r/rqc	���eZdZUdZdZeeeefe	d<e
d��d���Zedd���Z
ed	d
����d	���Zedd
d����d	���Zedd����d	���Zedd����d	���Zedd����d	���Ze
d��d���Z	d7�fd�	Zedeefd���Zdedeefd�Zdefd�Zdefd�Zdedeefd�Z defd�Z!dedeefd�Z"dedeefd �Z#d!e$d"e$dede%efd#�Z&dedeefd$�Z'd%�Z(d&�Z)d'�Z*e+d(edeefd)���Z,dedeefd*�Z-e+dede.eeeffd+���Z/dede.ee0effd,�Z1d-�Z2ded.e$de3e4fd/�Z5d0ed.e$de3e4fd1�Z6d8de.ee0effd2�Z7dddd3�de8fd4�Z9dede.ee0effd5�Z:edeefd6���Z;�xZ<S)9r%z?Extension of the completer class with IPython-specific featuresN�_IPCompleter__dict_key_regexpsr�c�^�|drt|j_dSt|j_dS)z>update the splitter and readline delims when greedy is changed�newN)�
GREEDY_DELIMS�splitterr�r��rx�changes  r0�_greedy_changedzIPCompleter._greedy_changed!s0���%�=�	*�#0�D�M� � � �#)�D�M� � � r/Fz%Whether to show dict key matches onlyr�Tz�Whether to merge completion results into a single list

        If False, only the completion results from the first non-empty
        completer will be returned.
        r�)rrTr=r=a1Instruct the completer to omit private method names

        Specifically, when completing on ``object.<tab>``.

        When 2 [default]: all names that start with '_' will be excluded.

        When 1: all 'magic' names (``__foo__``) will be excluded.

        When 0: nothing will be excluded.
        r�a3
        DEPRECATED as of version 5.0.

        Instruct the completer to use __all__ for the completion

        Specifically, when completing on ``object.<tab>``.

        When True: only those names in obj.__all__ will be included.

        When False [default]: the __all__ attribute is ignored
        zEIf True, emit profiling data for completion subsystem using cProfile.z.completion_profileszBTemplate for path at which to output profile data for completions.r�c�:�tjdt��dS)Nz�`IPython.core.IPCompleter.limit_to__all__` configuration value has been deprecated since IPython 5.0, will be made to have no effects and then removed in future version of IPython.)r6r��UserWarningr|s  r0�_limit_to_all_changedz!IPCompleter._limit_to_all_changedWs+���
�H�
�	�	�	�	�	r/c�:��t|_t��|_t	��jd
|||d�|��g|_||_tj	d��|_
tj|_tj
�dd��}|dv|_t jdkr
|j|_n|j|_tj	d��|_tj	d��|_|j|jg|_d	|_d	|_d	S)a�IPCompleter() -> completer

        Return a completer object.

        Parameters
        ----------
        shell
            a pointer to the ipython shell itself.  This is needed
            because this completer knows about magic functions, and those can
            only be accessed via the ipython instance.
        namespace : dict, optional
            an optional dict where completions are performed.
        global_namespace : dict, optional
            secondary optional dict for completions, to
            handle cases (such as IPython embedded inside functions) where
            both Python scopes are visible.
        config : Config
            traitlet's config object
        **kwargs
            passed to super class unmodified.
        )r�r�r�z([^\\] )�TERM�xterm)�dumb�emacsr&z^[\w|\s.]+\(([^)]*)\).*z[\s|\[]*(\w+)(?:\s*=\s*.*)Nr.)r�magic_escaper�r{r�ryr��shellr�r��
space_name_re�globrW�environ�get�
dumb_terminalrLrM�_clean_glob_win32�
clean_glob�_clean_glob�docstring_sig_re�docstring_kwd_re�magic_config_matches�magic_color_matches�magic_arg_matchers�custom_completers�_unicode_names)rxr�r�r�r�r��termr�s       �r0ryzIPCompleter.__init__^s#���2&���*�,�,��
�	�����	
��-��	
�	
��		
�	
�	
������
��Z��4�4����I��	��z�~�~�f�W�-�-��!�%5�5����<�7�"�"�"�4�D�O�O�"�.�D�O�!#�
�+E� F� F��� "�
�+H� I� I���

�%��$�#
���"&���#����r/rQc���|jr|jgS|jrg|j�|j�|j�|j�Sg|j�|j�|j�|j�|j�|j�S)z*All active matcher routines for completion)�dict_keys_only�dict_key_matchesr
r��file_matches�
magic_matches�python_matches�python_func_kw_matchesr{s r0�matcherszIPCompleter.matchers�s�����	+��)�*�*��=�	���%���%���!���"�	�
���%���%���#���!�	�
�"���+�
�
r/r�c����|�d��d�t��5��fd���|t|����D��cddd��S#1swxYwY��|��dS)zQ
        Wrapper around the completion methods for the benefit of emacs.
        r�rc�h��g|].}�r#�jrd��|jg��n|j��/S)r�)r
rNr�)rGrHrrxs  ��r0r�z/IPCompleter.all_completions.<locals>.<listcomp>�sW���@�@�@��39�V�T�]�V�C�H�H�f�a�f�-�.�.�.�PQ�PV�@�@�@r/NrT)�
rpartitionr:r�rVrs)rxr�rs` @r0�all_completionszIPCompleter.all_completions�s���������%�%�a�(��
!�
#�
#�	@�	@�@�@�@�@�@�!�-�-�d�C��I�I�>�>�@�@�@�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@����	@�	@�	@�	@��}�}�T�"�"�1�%�%s�0A)�)A-�0A-c�2�|�d|z��S)N�%s*�r��rxr�s  r0r�zIPCompleter._clean_glob�s���y�y����&�&�&r/c�F�d�|�d|z��D��S)Nc�:�g|]}|�dd����S)rF�/r_rfs  r0r�z1IPCompleter._clean_glob_win32.<locals>.<listcomp>�s6��2�2�2���	�	�$�s�#�#�2�2�2r/r�r�r�s  r0r�zIPCompleter._clean_glob_win32�s3��2�2����5�4�<�0�0�2�2�2�	2r/c�f���	�
�|�d��r
|dd�}d�
nd�
|j}t|���d|vsd|vr|}nV	t|��d}n?#t$r%�r|����d}ngcYSYnt$rd}YnwxYw�s|t|��krd}||c�	}n!d	}tj	�
|��}|dkr!�
fd
�|�d��D��Stj
dkr|�|��}n)|�|�d
d����}|r t!|�����	�
fd�|D��}n1�r!tj
dkr|n
�fd�|D��}n�
fd�|D��}d�|D��S)a�Match filenames, expanding ~USER type strings.

        Most of the seemingly convoluted logic in this completer is an
        attempt to handle filenames with spaces in them.  And yet it's not
        quite perfect, because Python's readline doesn't expose all of the
        GNU readline details needed for this to be done correctly.

        For a filename with a space in it, the printed completions will be
        only the parts after what's already been typed (instead of the
        full completions, as is normally done).  I don't think with the
        current (as of Python 2.3) Python readline it's possible to do
        better.�!rTNrCrcr�rfTFc�4��g|]}�t|��z��Sr.�rO�rGrg�text_prefixs  �r0r�z,IPCompleter.file_matches.<locals>.<listcomp>s'���N�N�N�!�K�"2�1�"5�"5�5�N�N�Nr/�*r&rFc�J��g|]}��zt|�d���z�� Sr�r�)rGrg�
len_lsplit�text0r�s  ���r0r�z,IPCompleter.file_matches.<locals>.<listcomp>sL���E�E�E�<=�#�U�*�'��*�+�+��7�7�8�E�E�Er/c�0��g|]}t|�����Sr.r�)rGrg�open_quotess  �r0r�z,IPCompleter.file_matches.<locals>.<listcomp>s$���B�B�B�!�%�a��5�5�B�B�Br/c�4��g|]}�t|��z��Sr.r�r�s  �r0r�z,IPCompleter.file_matches.<locals>.<listcomp>s9���<�<�<�34�'�+�A�.�.�/�<�<�<r/c�Z�g|](}tj�|��r|dzn|��)S)r�)rWrP�isdir)rG�xs  r0r�z,IPCompleter.file_matches.<locals>.<listcomp>"s3��B�B�B�Q�����q�)�)�0��#���q�B�B�Br/)rU�text_until_cursorrArr^r�r�rOrWrPrXr�rLrMr�r`rV)rxr�r��lsplit�has_protectables�m0r�r�r�r�r�s       @@@@r0r�zIPCompleter.file_matches�ss������$�?�?�3���	�����8�D��K�K��K� �2��%�&7�8�8���#�#�#�s�.?�'?�'?��F�F�
�"�#4�5�5�b�9�����
�
�
���.�4�4�[�A�A�"�E�F�F��I�I�I��F��
�
�
�����
�����	,�v�)9�&�)A�)A�A�A�#���f�J�E�$�$�$���7�%�%�d�+�+�D��2�:�:�N�N�N�N�t�y�y��~�~�N�N�N�N��<�7�"�"�����&�&�B�B�������d�B�!7�!7�8�8�B��	<��V���J�E�E�E�E�E�E�AC�E�E�E�G�G��
<�!$��� 7� 7�"�"�B�B�B�B�r�B�B�B���<�<�<�<�8:�<�<�<��C�B�'�B�B�B�Bs�A!�!*B�B�Bc����	�
��|jj���}|d}|d}|j�
�
�
z�|��
��}|��
���|�����|s��fd��	n�fd��	�	�fd�|D��}|����s|�	�
fd�|D��z
}|S)zMatch magicsr��cellc�6��|����o|�vS)z�
                Filter magics, in particular remove magics that match
                a name present in global namespace.
                �rU)�magic�	bare_textr�s ��r0r�z*IPCompleter.magic_matches.<locals>.matches=s(���
�)�)�)�4�4�5��n�4�7r/c�.��|����Sr�r�)r�r�s �r0r�z*IPCompleter.magic_matches.<locals>.matchesEs����'�'�	�2�2�2r/c�0��g|]}�|���
�|z��Sr.r.)rGrr��pre2s  ��r0r�z-IPCompleter.magic_matches.<locals>.<listcomp>Hs*���;�;�;�A����
�
�;��a��;�;�;r/c�0��g|]}�|���
�|z��Sr.r.)rGrr��pres  ��r0r�z-IPCompleter.magic_matches.<locals>.<listcomp>Js*���?�?�?��G�G�A�J�J�?�c�!�e�?�?�?r/)r��magics_manager�lsmagicr�rU�lstripr�)rxr��lsm�line_magics�cell_magics�explicit_magic�compr�r�r�r�r�s       @@@@@r0r�zIPCompleter.magic_matches$s��������j�'�/�/�1�1���&�k���&�k������3�w������-�-���K�K��$�$�	��,�,�Y�7�7���
	3�
7�
7�
7�
7�
7�
7�
7�
3�
3�
3�
3�
3�<�;�;�;�;��;�;�;�����t�$�$�	@��?�?�?�?�?�[�?�?�?�?�D��r/c�l��	�|�������	t�	��dk�rw�	ddks
�	ddk�r^tt	d�|jjD����d����}d�|D��}t�	��dkr|S�	d�d	��}|d��fd
�|D��}�	d�d	��dkr|St|��dkr�|d�kr�||����j	}|�
��}tjtj
dtj��d|��}�	fd
�|������D��SgS)z4 Match class names and attributes for %config magic rr�z%configc�H�g|]}|j�d����|�� S)Tr�)r��class_traitsr�s  r0r�z4IPCompleter.magic_config_matches.<locals>.<listcomp>Ts?��"%�"%�"%��&'�k�&>�&>�d�&>�&K�&K�"%�1�"%�"%�"%r/c��|jjSr��r�r*�r�s r0�<lambda>z2IPCompleter.magic_config_matches.<locals>.<lambda>Vs��Q�[�5I�r/�rc�&�g|]}|jj��Sr.r�r�s  r0r�z4IPCompleter.magic_config_matches.<locals>.<listcomp>Ws��B�B�B�A�1�;�/�B�B�Br/rTr�c�>��g|]}|�����|��Sr.r�)rGrH�	classnames  �r0r�z4IPCompleter.magic_config_matches.<locals>.<listcomp>`s9���!?�!?�!?��%&�\�\�)�%<�%<�!?�!�!?�!?�!?r/z^--rCc�|��g|]8}|��d���|�d��d��9S)rTrer)rUr�)rGr��textss  �r0r�z4IPCompleter.magic_config_matches.<locals>.<listcomp>lsM���8�8�8�!� �O�O�E�!�H�5�5�8����C����+�8�8�8r/)�stripr�rV�sortedrKr��
configurables�findr.r��class_get_helpr�r�r��	MULTILINE�
splitlines)
rxr��classes�
classnames�classname_texts�classname_matches�clsr�r�r�s
        @@r0r�z IPCompleter.magic_config_matchesNs������
�
���"�"�$�$���u�:�:��>�>�u�Q�x�8�3�3�u�Q�x�9�7L�7L��S�"%�"%�d�j�.F�"%�"%�"%�&�&�+I�+I�K�K�K�G�C�B��B�B�B�J��5�z�z�Q���!�!�$�A�h�n�n�S�1�1�O�'��*�I�!?�!?�!?�!?�Z�!?�!?�!?���Q�x�}�}�S�!�!�A�%�%�(�(��&�'�'�1�,�,�-�a�0�I�=�=��j�.�.�y�9�9�:�D���)�)�+�+���v�b�j����>�>��D�I�I��8�8�8�8�%)�Z�Z�\�\�%<�%<�%>�%>�8�8�8�8��	r/c�(��|���}|�d��r|�d��t|��dkr?|ddks|ddkr'|d��fd�t	j��D��SgS)	z& Match color schemes for %colors magicr'rCr=r�colorsz%colorsrTc�>��g|]}|�����|��Sr.r�)rG�colorrs  �r0r�z3IPCompleter.magic_color_matches.<locals>.<listcomp>{s;���3�3�3�u��(�(��0�0�3�U�3�3�3r/)r�rhr�rVrr�)rxr�r�rs   @r0r�zIPCompleter.magic_color_matchesqs�����
�
�����=�=����	�
�L�L������u�:�:��?�?��a��H� 4� 4��a��I�8M�8M��1�X�F�3�3�3�3�
�(:�(<�(<�3�3�3�
3��	r/�
cursor_column�cursor_linec��|jg}|j�|�|j��d�}t|||��}|re||dz
}|dkrT|jdkrd�}nE|jdkrd�}n6|jdkrd	�}n'td
�|j�����tj|d|�|��}d}		d}
	td
�|�
��jjD����}t|j��dko|jddv}
n#t$rYnwxYw|
}	n/#t $r"}|jrt%d|d��Yd}~nd}~wwxYw|	sgS	t'||�||dz�����S#t $r+}|jrt+d|z��gcYd}~SgcYd}~Sd}~wwxYw)a?
        Return a list of :any:`jedi.api.Completions` object from a ``text`` and
        cursor position.

        Parameters
        ----------
        cursor_column : int
            column position of the cursor in ``text``, 0-indexed.
        cursor_line : int
            line position of the cursor in ``text``, 0-indexed
        text : str
            text to complete

        Notes
        -----
        If ``IPCompleter.debug`` is ``True`` may return a :any:`_FakeJediCompletion`
        object containing a string with the Jedi debug information attached.
        Nc��|Sr�r.r�s r0r�z+IPCompleter._jedi_matches.<locals>.<lambda>�s��Q�r/rTr�r=c�8�|j�d��S)Nrd)rrrU�rHs r0r�z+IPCompleter._jedi_matches.<locals>.<lambda>�s��Q�V�5F�5F�s�5K�5K�1K�r/c�l�|j�d��o|j�d��S)Nrc)rrrUrhr�s r0r�z+IPCompleter._jedi_matches.<locals>.<lambda>�s1��a�f�6G�6G��6M�6M�6g�RS�RX�Ra�Ra�bf�Rg�Rg�1h�r/rc��|Sr�r.r�s r0r�z+IPCompleter._jedi_matches.<locals>.<lambda>�s���r/z'Don't understand self.omit__names == {}TFc3�:K�|]}t|d���|V��dS)�valueN)r�r�s  r0rJz,IPCompleter._jedi_matches.<locals>.<genexpr>�s4����"r�"r��^e�fg�ip�^q�^q�"r�1�"r�"r�"r�"r�"r�"rr/>r<r>z5Error detecting if completing a non-finished string :�|)r:r�zJOops Jedi has crashed, please report a bug with the following:
"""
%s
s""")r�r�r�rA�omit__namesr^r>r��Interpreter�next�_get_module�	tree_node�childrenrVr��
StopIterationrrr��filterrsrn)
rxr�r�r��
namespaces�completion_filterrBr��interpreter�try_jedi�completing_string�first_child�es
             r0�
_jedi_matcheszIPCompleter._jedi_matchess���&�n�%�
�� �,����d�3�4�4�4�&�J��#�D�+�}�E�E���
	i��v�a�x�.�C��c�z�z��#�q�(�(�(K�(K�%�%��%��*�*�(h�(h�%�%��%��*�*�(2�
�%�%�$�%N�%U�%U�VZ�Vf�%g�%g�h�h�h��&�t�G�V�G�}�j�A�A����	W� %��
f�"�"r�"r�k�.E�.E�.G�.G�.Q�.Z�"r�"r�"r�r�r��%(��(9�$:�$:�Q�$>�$e�;�CT�UV�CW�[e�Ce�!�!��
!�
�
�
���
����-�,�H�H���	W�	W�	W��z�
W��M�q�RU�V�V�V����������	W����
�	��I�	��+�[�-A�-A��]h�kl�]l�-A�-m�-m�n�n�n���	�	�	��z�
�+�,{�@A�-B�C�C�D�D�D�D�D�D�D��	�	�	�	�	�	�����		���sf�D9�5D%�=(D9�%
D2�/D9�1D2�2D9�9
E%�E � E%�-'F�
G
�G�8G
�>G�?G
�G
c��d|vrg	|�|��}|�d��r)|jr"|jdkrd�}nd�}t||��}n'#t$rg}YnwxYw|�|��}|S)z'Match attributes or global python namesr�rTc�0�tjd|��duS)Nz.*\.__.*?__)r�r���txts r0r�z,IPCompleter.python_matches.<locals>.<lambda>�s��$&�H�^�C�$@�$@�D�$H�r/c�f�tjd||�d��d���duS)Nz\._.*?r�)r�r��rindexr
s r0r�z,IPCompleter.python_matches.<locals>.<lambda>�s1��$&�H�Y�s�3�:�:�c�?�?�;K�;K�7L�$M�$M�QU�$U�r/)r�rhr�r�	NameErrorr�)rxr�r��no__names    r0r�zIPCompleter.python_matches�s����$�;�;�
��+�+�D�1�1���=�=��%�%�	8�$�*:�	8��'�1�,�,�%I�%I���%V�%V��$�X�w�7�7�G����
�
�
�����
�����)�)�$�/�/�G��s�AA�A)�(A)c�D�|�gS|������d}|j�|��}|�gS|���d�d��}g}|D]}||j�|��z
}� |S)aParse the first line of docstring for call signature.

        Docstring should be of the form 'min(iterable[, key=func])
'.
        It can also parse cython docstring of the form
        'Minuit.migrad(self, int ncall=10000, resume=True, int nsplit=1)'.
        Nr�,)r�r�r�r)�groupsr�r��findall)rx�docr��sig�retr@s      r0�!_default_arguments_from_docstringz-IPCompleter._default_arguments_from_docstring�s����;��I��z�z�|�|�&�&�(�(��+���#�*�*�4�0�0���;��I��j�j�l�l�1�o�#�#�C�(�(�����	4�	4�A��4�(�0�0��3�3�3�C�C��
r/c���|}g}tj|��rn�tj|��s�tj|��sutj|��rJ||�t
|dd����z
}t
|dd��pt
|dd��}nt|d��r|j}||�t
|dd����z
}tj	j
tj	jf�	tj|��}|�
�fd�|j���D����n#t $rYnwxYwt#t%|����S)z_Return the list of default arguments of obj if it is callable,
        or empty list otherwise.r-rCryN�__new__�__call__c3�4�K�|]\}}|j�v�|V��dSr�)�kind)rGr�v�_keepss   �r0rJz1IPCompleter._default_arguments.<locals>.<genexpr>s?�����)�)�T�Q���v��'�'��'�'�'�'�)�)r/)�inspect�	isbuiltin�
isfunction�ismethod�isclassrrr�r�	Parameter�KEYWORD_ONLY�POSITIONAL_OR_KEYWORDrv�extend�
parameters�itemsr^r�rK)rxr�call_objrrr!s     @r0�_default_argumentszIPCompleter._default_arguments�s����������S�!�!�
	(���$�S�)�)�	(�W�-=�c�-B�-B�	(���s�#�#�

(��t�=�=�#�C��B�7�7�9�9�9��$�C��T�:�:�5��s�I�t�4�4�����j�)�)�
(��<���t�5�5���9�b�1�1�3�3�	3���#�0��#�9�;��	��#�C�(�(�C��J�J�)�)�)�)�S�^�%9�%9�%;�%;�)�)�)�
)�
)�
)�
)���	�	�	��D�	�����C��H�H�~�~�s�AE�
E�Ec�V�d|vrgS|j}nC#t$r6tjdtjtjz��x}|_YnwxYw|�|j��}t|��}d}|D]!}|dkr|dz}�|dkr
|dz
}|dkrn�"gSg}tjd��j	}		|�
t|����||d	��s|���n&t|��dksnn#t$rYnwxYw�ot��}	d	}
t||dd
���D]?\}}|dkr|
dz
}
n|dkr|
dz}
|
dkr�#|dkr�*|	�|���@g}	d�|d
d
d	���}
|�t'|
|j����}t|��|	z
D]/}|�|��r|�
d|z���0n#YnxYw|S)
z9Match named parameters (kwargs) of the last open functionr�z�
                '.*?(?<!\\)' |    # single quoted strings or
                ".*?(?<!\\)" |    # double quoted strings or
                \w+          |    # identifier
                \S                # other characters
                r�)rTrcz\w+$TrfNrez%s=)�_IPCompleter__funcParamsRegexr+r�r��VERBOSE�DOTALLrr��reversedr�r�r��poprrKrr�rNr.r�r�rU)rxr��regexp�tokens�
iterTokens�openPar�token�ids�isId�
usedNamedArgs�	par_level�
next_token�
argMatches�callableObj�	namedArgs�namedArgs                r0r�z"IPCompleter.python_func_kw_matchess����$�;�;��I��,�V�V���	-�	-�	-�.0�j�:�
�Z�"�)�+�/-�/-�
-�F�T�+�+�+�	-�������� 6�7�7���f�%�%�
��w��		�		�E���|�|��1�����#����1����Q�;�;��E���I����z�'�"�"�(��	�
��
�
�4�
�+�+�,�,�,��t�C��G�}�}�%��G�G�I�I�I�u��J�'�'�3�.�.��/�� �
�
�
���
����	����
��	�!$�V�V�A�B�B�Z�!8�!8�	%�	%��E�:���|�|��Q��	�	��#����Q��	��A�~�~���S� � �����e�$�$�$�$��
�
	��(�(�3�t�t��t�9�-�-�K��/�/��[�48�N�1D�1D�E�E�I� �	�N�N�]�:�
7�
7���&�&�t�,�,�7��%�%�e�X�o�6�6�6��
7��	��D�����s5��=A�A�AD�D�
D*�)D*�BH"�"H&rc�R�t|d��}|�
|��St|t��st|dd��r4	t	|�����S#t$rgcYSwxYwt|dd��st|dd��r|jjpgSgS)N�_ipython_key_completions_�pandas�	DataFrame�numpy�ndarray�void)	rr�dictrLr�r�r�dtype�names)r�methods  r0�	_get_keyszIPCompleter._get_keyses���!��&A�B�B�����6�8�8�O��c�4� � �	)��C��;�7�7�	)�
��C�H�H�J�J�'�'�'���
�
�
��	�	�	�
����
�c�7�I�
6�
6�	)�
�c�7�F�
3�
3�	)��9�?�(�b�(��	s� A%�%A4�3A4c�z���|j�|j}n8d}tj|dz��tj|dz��d�x}|_||j�|j��}|�gS|���\}}}	t||j��}n;#t$r.	t||j
��}n#t$rgcYcYSwxYwYnwxYw|�|��}	|	s|	S|dkrt|��nd}
t|	||j
j|
���\}}}
|
s|
St|j��t|��z
}|r|�d��}||z}n|���x}}||krd�n
|||��|�d	��}d�|jt|j��d�}||kr4|r2|�|��r|t|��d�}n�|z
�||kr|�d
��s�d
z
���fd�|
D��S)z5Match string keys in a dictionary, after e.g. 'foo[' Na�(?x)
            (  # match dict-referring expression wrt greedy setting
                %s
            )
            \[   # open bracket
            \s*  # and optional whitespace
            # Capture any number of str-like objects (e.g. "a", "b", 'c')
            ((?:[uUbB]?  # string prefix (r not handled)
                (?:
                    '(?:[^']|(?<!\\)\\')*'
                |
                    "(?:[^"]|(?<!\\)\\")*"
                )
                \s*,\s*
            )*)
            ([uUbB]?  # string prefix (r not handled)
                (?:   # unclosed string
                    '(?:[^']|(?<!\\)\\')*
                |
                    "(?:[^"]|(?<!\\)\\")*
                )
            )?
            $
            z�
                                  # identifiers separated by .
                                  (?!\d)\w+
                                  (?:\.(?!\d)\w+)*
                                  zF
                                 .+
                                 )FTrC)rr�rTr�c� ��g|]
}�|z�z��Sr.r.)rGr�leading�sufs  ��r0r�z0IPCompleter.dict_key_matches.<locals>.<listcomp>�s"���3�3�3�a��!��c�!�3�3�3r/)rwr�r�r�r)r�rr�r�rr�rOr9r{r�rVr�r�r�rU)rxr��regexps�dict_key_re_fmtr�r��prefix0rrr�r�
closing_quote�token_offsetr��
text_start�	key_start�completion_start�bracket_idx�continuationrRrSs                   @@r0r�zIPCompleter.dict_key_matchesys������"�.��-�G�G��O�2�z�/�5&�#&�'�'�
�j��4%�"%�&�&�
	1�	1�	
�G�d�-����$�+�+�D�,B�C�C���=��I� %�������g�v�	��t�T�^�,�,�C�C���	�	�	�
��4��!6�7�7�����
�
�
��	�	�	�	�	�
������	�����~�~�c�"�"���	��K�(/�2�
�
�t�G�}�}�}�4��/>�t�V�T�]�Ma�p|�/}�/}�/}�,�
�|�W��	��N���/�0�0�3�t�9�9�<�
��	7����A���I�(�<�7���+0�9�9�;�;�6�I�(��	�!�!��G�G��:�&6�6�7�G��i�i��l�l��
���'��D�,B�(C�(C�(D�(D�E���z�!�!�m�!��&�&�}�5�5�
%�+�C�
�,>�,>�,?�,?�@����}�$����#�#��*�*�3�/�/�
��s�
��3�3�3�3�3�7�3�3�3�3s6�B"�"
C�-C�C�C�C�C�C�Cc���|�d��}|dkrR||dzd�}	tj|��}d|z���rd|z|gfSn#t$rYnwxYwdgfS)uMatch Latex-like syntax for unicode characters base
        on the name of the character.

        This does  ``\GREEK SMALL LETTER ETA`` -> ``η``

        Works only on valid python 3 identifier, or on combining characters that
        will combine to form a valid identifier.
        rFrfrTN�arC)�rfindrR�lookup�isidentifierrS)r��slashposr@rVs    r0�unicode_name_matchesz IPCompleter.unicode_name_matches�s����:�:�d�#�#���b�=�=��X�a�Z�[�[�!�A�
�"�)�!�,�,����H�*�*�,�,�)���6�4�&�=�(�)���
�
�
���
�����2�v�
s�2A�
A+�*A+c���|�d��}|dkr<||d���tvr�t�gfS�fd�tD��}|r�|fSdS)u{Match Latex syntax for unicode characters.

        This does both ``\alp`` -> ``\alpha`` and ``\alpha`` -> ``α``
        rFrfNc�>��g|]}|�����|��Sr.r�)rGrr@s  �r0r�z-IPCompleter.latex_matches.<locals>.<listcomp>s(���G�G�G��q�|�|�A���G�1�G�G�Gr/rN)r`r)rxr�rcr�r@s    @r0�
latex_matcheszIPCompleter.latex_matches�s���
�:�:�d�#�#���b�=�=��X�Y�Y��A��M�!�!��=��+�,�,�,�H�G�G�G�m�G�G�G���&��g�:�%��vr/c����	�|jsdS|j}|���sdSt��}||_�|_|�dd��d}||_|j|_|�	|j
��s#|j�|j
|z��}ng}tj
|j�|��||j�|j����D]e}	||��}|r8�fd�|D��}|r|cS�����	�	fd�|D��cS�I#t $rY�Ut"$r	YnwxYwdS)NrTrc�>��g|]}|�����|��Sr.r�)rG�rr�s  �r0r�z9IPCompleter.dispatch_custom_completer.<locals>.<listcomp>+s*���E�E�E�a�!�,�,�t�2D�2D�E��E�E�Er/c�b��g|]+}|��������)|��,Sr.)�lowerrU)rGrj�text_lows  �r0r�z9IPCompleter.dispatch_custom_completer.<locals>.<listcomp>0s4���M�M�M�!�a�g�g�i�i�.B�.B�8�.L�.L�M�A�M�M�Mr/)r�r�r�rr��symbolr��commandr�rUr��	s_matches�	itertools�chain�flat_matchesrlr�KeyboardInterrupt)
rxr�r��event�cmd�	try_magicrH�res�withcaserms
 `       @r0�dispatch_custom_completerz%IPCompleter.dispatch_custom_completers������%�	��F�����z�z�|�|�	��4� �!�!����
�����j�j��a� � ��#����
�"&�"8����~�~�d�/�0�0�	��.�8�8��!�C�'�)�)�I�I��I����!7�!A�!A�#�!F�!F���'�4�4�T�5K�L�L�N�N�	�	�A�
��a��h�h���N�E�E�E�E�3�E�E�E�H��(�'����#�z�z�|�|�H�M�M�M�M�s�M�M�M�M�M�M�N���
�
�
���$�
�
�
�����
�����ts�E�"!E�
E!�
E!� E!rBc	#��K�tjdtd���t��}	|jr-ddl}|���}|���nd}|�|||j	dz���D]"}|r||vr�	|V�|�
|���#n#t$r	YnwxYw|��|���t|j��tj�|jt%t'j������}t+d|��|�|��dSdS#|��|���t|j��tj�|jt%t'j������}t+d|��|�|��wwxYw)	a�
        Returns an iterator over the possible completions

        .. warning::

            Unstable

            This function is unstable, API may change without warning.
            It will also raise unless use in proper context manager.

        Parameters
        ----------
        text : str
            Full text of the current input, multi line string.
        offset : int
            Integer representing the position of the cursor in ``text``. Offset
            is 0-based indexed.

        Yields
        ------
        Completion

        Notes
        -----
        The cursor on a text can either be seen as being "in between"
        characters or "On" a character depending on the interface visible to
        the user. For consistency the cursor being on "in between" characters X
        and Y is equivalent to the cursor being "on" character Y, that is to say
        the character the cursor is on is considered as being after the cursor.

        Combining characters may span more that one position in the
        text.

        .. note::

            If ``IPCompleter.debug`` is :any:`True` will yield a ``--jedi/ipython--``
            fake Completion token to distinguish completion returned by Jedi
            and usual IPython completion.

        .. note::

            Completions are not completely deduplicated yet. If identical
            completions are coming from different sources this function does not
            ensure that each completion object will only be present once.
        zy_complete is a provisional API (as of IPython 6.0). It may change without warnings. Use in corresponding context manager.r=r�rNi�)�_timeoutzWriting profiler output to)r6r�r)rK�profile_completions�cProfile�Profile�enable�_completionsrr�rt�disabler�profiler_output_dirrWrPrNr��uuid�uuid4r��
dump_stats)rxr�rBr�r~�profilerrH�output_paths        r0r�zIPCompleter.completions<s����\	�
�>� ;�q�	J�	J�	J�	J�
�u�u��	1��'�
 �����#�+�+�-�-�����!�!�!�!����&�&�t�V�d�>\�]a�>a�&�b�b�
�
����!�t�)�)��������������	
��
!�	�	�	�
.��D�	����
�#�� � �"�"�"�!�$�":�;�;�;� �g�l�l�4�+C�S�����EV�EV�W�W���2�K�@�@�@��#�#�K�0�0�0�0�0�$�#��x�#�� � �"�"�"�!�$�":�;�;�;� �g�l�l�4�+C�S�����EV�EV�W�W���2�K�@�@�@��#�#�K�0�0�0�0�$���s+�A9B(�'E�(B6�3E�5B6�6E�BG$�	full_textc	#�K�tj��|z}|d|�}t||��\}}|�|||���\}}	}
}t	|��}|r�|D]�}
	|
j}n)#t$r|jrtd|
��d}YnwxYwt|
j
��t|
j��z
}|dkrt|
��}nd}t||z
||
j
||d���V�tj��|krn��|D]J}
t|
j
��t|
j��z
}t||z
||
j
ddd�	��V��K|�|��}|r |	r|jrt||d
ddd�
��V�|�|��sJ�t!|	|
��D]\}}t||||dd���V��dS)ax
        Core completion module.Same signature as :any:`completions`, with the
        extra `timeout` parameter (in seconds).

        Computing jedi's completion ``.type`` can be quite expensive (it is a
        lazy property) and can require some warm-up, more warm up than just
        computing the ``name`` of a completion. The warm-up can be :

            - Long warm-up the first time a module is encountered after
            install/update: actually build parse/inference tree.

            - first time the module is encountered in a session: load tree from
            disk.

        We don't want to block completions for tens of seconds so we give the
        completer a "budget" of ``_timeout`` seconds per invocation to compute
        completions types, the completions that have not yet been computed will
        be marked as "unknown" an will have a chance to be computed next round
        are things get cached.

        Keep in mind that Jedi is not the only thing treating the completion so
        keep the timeout short-ish as if we take more than 0.3 second we still
        have lots of processing to do.

        N)r�r�r�zError in Jedi getting type of �functionrCr�rz	<unknown>)r�r�r�rtrwrvz--jedi/ipython--r�none)r�r�r�rwrtrv)r�r�r�rwrvrt)�time�	monotonicrG�	_complete�iterrtrrr�rVrursror~r`rhr)rxr�rBr|�deadlinerDr�r�rrr�rsrt�iter_jm�jm�type_�deltarv�start_offsetr�ts                    r0r�zIPCompleter._completions�s�����4�>�#�#�h�.���7�F�7�#��%7�	�6�%J�%J�"��]�>B�n�n��[�]�?M�?T�?T�;��g�~�|��|�$�$���	��
�
��!��G�E�E�� �!�!�!��z�D��>��C�C�C� �E�E�E�!�����B�0�1�1�C���4D�4D�D���J�&�&� /�� 3� 3�I�I� "�I� �v��~�%+�&(�&:�&+�+4�)/�1�1�1�1�1�1��>�#�#�h�.�.��E�/��	+�	+�B���,�-�-��B�K�0@�0@�@�E��6�E�>�!'�"$�"6�"-�%+�')�+�+�+�
+�
+�
+�
+��|�|�L�1�1���	I�G�	I��
�	I��<�V�BT�%,�6�R�I�I�I�
I�
I�
I�
���|�,�,�,�,�,����0�0�	p�	p�D�A�q��<�V�!�Q�Z\�cn�o�o�o�o�o�o�o�	p�	ps�)A1�1#B�Bc�x�tjdt��|�|||d���dd�S)a�Find completions for the given text and line context.

        Note that both the text and the line_buffer are optional, but at least
        one of them must be given.

        Parameters
        ----------
        text : string, optional
            Text to perform the completion on.  If not given, the line buffer
            is split using the instance's CompletionSplitter object.
        line_buffer : string, optional
            If not given, the completer attempts to obtain the current line
            buffer via readline.  This keyword allows clients which are
            requesting for text completions in non-readline contexts to inform
            the completer of the entire text.
        cursor_pos : int, optional
            Index of the cursor in the full line buffer.  Should be provided by
            remote frontends where kernel has no access to frontend state.

        Returns
        -------
        Tuple of two items:
        text : str
            Text that was actually used in the completion.
        matches : list
            A list of completion matches.

        Notes
        -----
            This API is likely to be deprecated and replaced by
            :any:`IPCompleter.completions` in the future.

        zn`Completer.complete` is pending deprecation since IPython 6.0 and will be replaced by `Completer.completions`.r)r�r�r�r�Nr=)r6r��PendingDeprecationWarningr�)rxr�r�r�s    r0rszIPCompleter.complete�sL��D	�
�O�/�	1�	1�	1�
�~�~�+�*�SW�ef�~�g�g�hj�ij�hj�k�kr/)r�r�r�c�L��|� |�t|��nt|��}|jrtj|_|s|r|�d��|}|s|r|j�||��nd}|jr�|s|n	|d|�}|j	|j
tt|j
fD]\}||��\}}	|rJt||	dt�|jgt#t|	��t��zd��cS�]|�|}||_|jd|�|_|jD]U�t+�|����dt�}
|
r,�jgt|
��z}t||
|d��cS�Vg}
t|��dko|ddk}g}
|jr|s|s|}|�|||��}
|jr^g}
|jD]S�	|
��fd��|��D�����.#t7jt7j���Y�QxYwn%|jD]��fd��|��D��}
|
rn�t=��}t=��}|
D]5}|\}}||vr*|�|��|�|���6tA|d	��
��}d�|�!|��pgD��}|p|}|dt�}d�|D��}d
�|D��}||_"t||||
��S)aQ
        Like complete but can also returns raw jedi completions as well as the
        origin of the completion text. This could (and should) be made much
        cleaner but that will be simpler once we drop the old (and stateful)
        :any:`complete` API.

        With current provisional API, cursor_pos act both (depending on the
        caller) as the offset in the ``text`` or ``line_buffer``, or as the
        ``column`` when passing multiline strings this could/should be renamed
        but would add extra noise.

        Parameters
        ----------
        cursor_line
            Index of the line the cursor is on. 0 indexed.
        cursor_pos
            Position of the cursor in the current line/line_buffer/text. 0
            indexed.
        line_buffer : optional, str
            The current line the cursor is in, this is mostly due to legacy
            reason that readline could only give a us the single current line.
            Prefer `full_text`.
        text : str
            The current "token" the cursor is in, mostly also for historical
            reasons. as the completer would trigger only after the current line
            was parsed.
        full_text : str
            Full text of the current cell.

        Returns
        -------
        A tuple of N elements which are (likely):
            matched_text: ? the text that the complete matched
            matches: list of completions ?
            matches_origin: ? list same length as matches, and where each completion came from
            jedi_matches: list of Jedi matches, have it's own structure.
        Nr<rCr.rrgc�"��g|]}|�jf��Sr.�r,�rGr�matchers  �r0r�z)IPCompleter._complete.<locals>.<listcomp>ns1���$<�$<�$<�()�&'��(<�$=�$<�$<�$<r/c�"��g|]}|�jf��Sr.r�r�s  �r0r�z)IPCompleter._complete.<locals>.<listcomp>vs1���4�4�4� !��w�3�4�4�4�4r/c�,�t|d��S)Nr)rlr�s r0r�z'IPCompleter._complete.<locals>.<lambda>�s��CZ�[\�]^�[_�C`�C`�r/r�c��g|]}|df��S)�customr.�rGrs  r0r�z)IPCompleter._complete.<locals>.<listcomp>�s��X�X�X��q�(�m�X�X�Xr/c��g|]
}|d��Sr�r.r�s  r0r�z)IPCompleter._complete.<locals>.<listcomp>�s��4�4�4�Q�A�a�D�4�4�4r/c��g|]
}|d��S)rTr.r�s  r0r�z)IPCompleter._complete.<locals>.<listcomp>�s��3�3�3�A�1�Q�4�3�3�3r/)#rVr�r�r�r�r�r{r�r
rgrdrZrW�fwd_unicode_matchrq�
MATCHES_LIMITr,r�r�r�r�r�r
r
�merge_completionsr�r*rL�
excepthook�exc_inforKr�r�rzr�)rxr�r�r�r�r��	base_text�meth�	name_text�name_matchesr��origins�is_magic_prefixr�r��filtered_matchesrr�rH�_filtered_matches�
custom_res�_matchesr�s                      @r0r�zIPCompleter._completes9���V��-1�\��[�)�)�)�s�4�y�y�J���	/�%�.�D�N��	=��	=�#�/�/�$�/�/��<�K��	]�IT�\�4�=�+�+�K��D�D�D�Z\�D��/�	Z�$/�M���[��*��5M�I��+��2�0�2��/�	1�
Z�
Z��
+/�$�y�/�/�'�	�<��Z�*�9�l�>�M�>�6R� �-�.�s�3�|�3D�3D�m�/T�/T�T�VX�Z�Z�Z�Z�Z�Z����K�&���!%�!1�+�:�+�!>����.�	C�	C�G��7�7�;�/�/�0�0��-��@�G��
C�"�/�0�3�w�<�<�?��&�t�W�g�r�B�B�B�B�B�
C�
���d�)�)�a�-�:�D��G�s�N��%'���=�	4��	4��
(�'�	��,�,��K��4�4�K��!�	��G��=�
4�
4��4��N�N�$<�$<�$<�$<�-4�W�T�]�]�$<�$<�$<�=�=�=�=��4��N�C�L�N�N�3�3�3�3����
4� �=�
�
��4�4�4�4�%,�W�T�]�]�4�4�4�����E���u�u���5�5���	�	�A��D�A�q���}�}� �$�$�Q�'�'�'���������"�#3�9`�9`�a�a�a��X�X�T�-K�-K�D�-Q�-Q�-W�UW�X�X�X�
�&�;�*;��-�n�}�n�=��4�4�"3�4�4�4��3�3�!2�3�3�3������t�X�w��D�D�Ds�$*H�!H2c�F���|�d��}|dkr�||dzd�}|�����fd�|jD��}|r||fS�fd�|jD��}|r||fS��d����fd�|jD��}|r||fSd	Sd	S)
a}
        Forward match a string starting with a backslash with a list of
        potential Unicode completions.

        Will compute list list of Unicode character names on first call and cache it.

        Returns
        -------
        At tuple with:
            - matched text (empty if no matches)
            - list of potential completions, empty tuple  otherwise)
        rFrfrTNc�>��g|]}|�����|��Sr.r��rGr��sups  �r0r�z1IPCompleter.fwd_unicode_match.<locals>.<listcomp>�s*���M�M�M��1�<�<��;L�;L�M�!�M�M�Mr/c���g|]}�|v�|��	Sr.r.r�s  �r0r�z1IPCompleter.fwd_unicode_match.<locals>.<listcomp>�s���D�D�D��3�!�8�8�!�8�8�8r/r'c�L���g|]�t�fd��D�������� S)c3� �K�|]}|�vV��	dSr�r.)rG�ur�s  �r0rJz;IPCompleter.fwd_unicode_match.<locals>.<listcomp>.<genexpr>�s'�����4N�4N��Q�!�V�4N�4N�4N�4N�4N�4Nr/)�all)rGr��splitsups @�r0r�z1IPCompleter.fwd_unicode_match.<locals>.<listcomp>�sL���������4N�4N�4N�4N�X�4N�4N�4N�1N�1N�����r/rN)r`�upper�
unicode_namesr�)rxr�rcr@�
candidatesr�r�s     @@r0r�zIPCompleter.fwd_unicode_match�s�����:�:�:�d�#�#���b�=�=��X��\�^�^�$�A��'�'�)�)�C�M�M�M�M�T�%7�M�M�M�J��
%��*�}�$�D�D�D�D�T�%7�D�D�D�J��
%��*�}�$��y�y��~�~�H������-����J��
%��*�}�$��6��6r/c��|j�sg}tdd��D]G}	|�tjt|�������8#t$rY�DwxYwtt��|_|jS)z}List of names of unicode code points that can be completed.

        The list is lazily initialized on first access.
        Nri)	r��ranger�rRrr�chrr^�_unicode_name_compute�_UNICODE_RANGES)rxrMrHs   r0r�zIPCompleter.unicode_names�s�����&��E��1�\�*�*�
�
����L�L��!1�#�a�&�&�!9�!9�:�:�:�:��!�����D�����"7��"H�"H�D���"�"s�4A�
A�A)NNNN)NNN)=r*r+r,r-rwrr
�boolrrur!r~rr�rr�rr�r�r}rr�r�ryr�rrr�r�r�r�r�r�r�r�r�r�rr
r�rr.r��staticmethodrOr�r	rdrrgrzrr~r�r�rsrqr�r�r�rrs@r0r%r%s���������I�I�7;����d�7�l�!3�4�;�;�;��W�X���*�*���*��T�%�
8�:�:�:�N���T�����
�c��c���
��$�w�a�	����
�c��c�����d�5�
����
�c��c�����$��
T����
�c��c����
"�'�,�
Q����
�c��c����

�W�
����� ���IM�I#�I#�I#�I#�I#�I#�V��$�s�)�����X��,	&�3�	&�4��9�	&�	&�	&�	&�'�s�'�'�'�'�2�S�2�2�2�2�PC��PC�d�3�i�PC�PC�PC�PC�d(��(�(�(�(�T!��!��S�	�!�!�!�!�F�s��t�C�y�����F�#�F�3�F�S�F�X�VY�]�F�F�F�F�P�#���S�	�����,���4 � � �DJ�J�J�X��s��t�C�y�����\��&f4�C�f4�D��I�f4�f4�f4�f4�P��#��%��T�#�Y��*?�����\��,����s�H�S�M�/A�)B�����(.�.�.�`L1��L1�S�L1�8�J�3G�L1�L1�L1�L1�\Qp�c�Qp�3�Qp��Q[�H\�Qp�Qp�Qp�Qp�h'l�'l��c�S[�\_�S`�N`�Ha�'l�'l�'l�'l�RAE�4� �HE�HE�HE�%4�HE�HE�HE�HE�T8�S�8�U�3���
�3E�-F�8�8�8�8�t�#�t�C�y�#�#�#��X�#�#�#�#�#r/�rangesc	���g}|D]]\}}t||��D]G}	|�tjt	|�������8#t
$rY�DwxYw�^|Sr�)r�r�rRrrr�r^)r�rMr��stoprHs     r0r�r��s����E����
��d��u�d�#�#�	�	�A�
����[�-�c�!�f�f�5�5�6�6�6�6���
�
�
���
����	�
�Ls�4A�
A�A)r4r�)pr-�builtinsr�r�r"rqr�rWr�rPrLr�rRr�r6�
contextlibr�	importlibr�typesr�typingrrrr	r
rrr
rrr�IPython.core.errorr�IPython.core.inputtransformer2r�IPython.core.latex_symbolsrr�IPython.core.oinspectr�IPython.testing.skipdoctestr�
IPython.utilsr�IPython.utils.dir2rr�IPython.utils.pathr�IPython.utils.processr�	traitletsrrr�	ListTraitrr r!�traitlets.config.configurabler"r��__skip_doctest__r��settings�case_insensitive_completion�jedi.api.helpers�jedi.api.classesr	�ImportErrorr�r�rM�PROTECTABLESr��
FutureWarningr)r8r:rArOr�r�r]rarlrnr~�_ICr�r�r�rz�objectr�r$rrr�r9rArGrLrWrZr`rorqr%r�r.r/r0�<module>r�sQ��f�f�`��������������������	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
�����������������%�%�%�%�%�%�#�#�#�#�#�#�!�!�!�!�!�!�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�m�&�&�&�&�&�&�4�4�4�4�4�4�J�J�J�J�J�J�J�J�/�/�/�/�/�/�4�4�4�4�4�4�"�"�"�"�"�"�4�4�4�4�4�4�4�4�0�0�0�0�0�0�+�+�+�+�+�+�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�S�6�6�6�6�6�6���������K�K�K�05�D�M�-����������N�N�������N�N�N�����!�"4�5���}�
%���<�7����L�L�*�L��
�	�	�	�	�	�-�	�	�	�����*E�F�F�F�F�����������8���*&2�����%,�S�%,�U�3��c�>�2�%,�%,�%,�%,�P�s��������������@;�;�;�;�;�;�;�;�,;7�;7�;7�;7�;7�;7�;7�;7�|�z���'�3�'�S�'�C�'�'�'�'�THM�8;�8;�8;�c�8;��8;��8;�QT�8;�8;�8;�8;�v�<�7���
-�F�F�
0�F��
�0+�0+�0+�0+�0+��0+�0+�0+�hhG�hG�hG�hG�hG��hG�hG�hG�V4�4�4�?C�['�['�$�u�S�%��u�S�%�Z�7H�1I�%I�J�K�['�UX�['�be�['�"*�5��e��+<�"=�['�GL�S�RU�W[�\_�W`�M`�Ga�['�['�['�['�|:�C�:�c�:�#�:��:�:�:�:�8�C����e�C��H�o�����DI�I�I�%�3�%�5��h�s�m�1C�+D�%�%�%�%�N����s�H�S�M�/A�)B�����6�s�����,U�#�U�U�U�U�<�����j����~#�~#�~#�~#�~#�)�~#�~#�~#�@&��e�C��G�n�!5��$�s�)������s�<C�C!� C!

Youez - 2016 - github.com/yon3zu
LinuXploit