← Back
Editing: strings.cpython-311.pyc
� p�{c � � � d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z e � � Z G d� de� � Zd � Z d � Zd� Zd� Zd � Zd� Zdd�ZdS )ap This module is here for string completions. This means mostly stuff where strings are returned, like `foo = dict(bar=3); foo["ba` would complete to `"bar"]`. It however does the same for numbers. The difference between string completions and other completions is mostly that this module doesn't return defined names in a module, but pretty much an arbitrary string. � N)�AbstractArbitraryName)�infer_call_of_leaf)� Completion)�cut_value_at_positionc � � e Zd ZdZdZdS )� StringName�stringFN)�__name__� __module__�__qualname__�api_type� is_value_name� � �2/usr/lib/python3/dist-packages/jedi/api/strings.pyr r s � � � � � ��H��M�M�Mr r c �| � |}|dk r|� � � }d}|rt |||d�� � }|dk r�|�||urt ||� � }| � |� � }|� � � } | j dv r:t || � � } t t | j | |�dn|||�� � � � S g S )N�[� T)� invert_result)�atom�trailer�name)�fuzzy) �get_previous_leaf�get_quote_endingr �create_context�typer �list�_completions_for_dicts�inference_state)�module_context� code_lines�leaf�positionr r �bracket_leaf� cut_end_quote�context�before_bracket_leaf�valuess r � complete_dictr* s� � ��L��s����-�-�/�/���M� � [�(���X�UY�Z�Z�Z� ��s����>�d�,�6�6�*�4��:�:�F� �/�/��=�=��*�<�<�>�>���#�'B�B�B�'��1D�E�E�F��.��.���n���&���� � � � � � �Ir c # �. K � t t |� � d� �� � D ]r}t ||� � }|� |� � rKt | |d t |� � pd � � � }t | |d t |� � |�� � V � �sd S )Nc � � t | � � S )N)�repr)�xs r �<lambda>z(_completions_for_dicts.<locals>.<lambda>5 s � �$�q�'�'� r )�key)�stack�like_name_length�is_fuzzy)�sorted�_get_python_keys�_create_repr_string� startswithr �lenr )r �dicts�literal_stringr&