← Back
Editing: helpers.cpython-311.pyc
� p�{c7 � �� � d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm Z d� Z d� Zdd�Zd � Z d � Zd� Zd� Zd � Zd� Zd� Z G d� de� � Zed� � � Zdd�Zd� Zd� ZdS )� N)�chain)�contextmanager)�treec � � | j }d|v sd|v rdS t j � t j dd� � }t t j t j |� � dz t | � � � � � � S )Nz dist-packagesz site-packagesF�lib�pythonz\d.\d)�parts�os�path�join�sys�prefix�bool�re�match�escape�str)r r � base_paths �8/usr/lib/python3/dist-packages/jedi/inference/helpers.py�is_stdlib_pathr sm � � �J�E��%���?�e�#;�#;��u�����S�Z���9�9�I������9�-�-��8�#�d�)�)�D�D�E�E�E� c � � t j | � � }g }| j D ]c}t |t j � � rt j |� � }||_ nt |� � }||_ |� |� � �d||_ |S )zO Much, much faster than copy.deepcopy, but just for parser tree nodes. )�copy�children� isinstancer �Leaf�parent� deep_ast_copy�append)�obj�new_obj�new_children�child� new_childs r r r s� � � �i��n�n�G� �L��� '� '���e�T�Y�'�'� '�� �%�(�(�I�&�I���%�e�,�,�I�&�I�����I�&�&�&�&�#�G���Nr Fc �� � |j }|j dk r ddlm} |� | j � � S |j dk s||j d |j d fvrC|dk rddlm} |S |j dk r| � |� � S | � |� � S |j }|j � |� � }|r|}n|d z }|j d k r5|} | d z } |j | } | j dk rn�|j | d z |� }n|j d } |j d |� }| dk r|d } |d d � }| � | � � }ddlm} |D ]} | | ||� � }�|S )a� Creates a "call" node that consist of all ``trailer`` and ``power`` objects. E.g. if you call it with ``append``:: list([]).append(3) or None You would get a node with the content ``list([]).append`` back. This generates a copy of the original ast node. If you're using the leaf, e.g. the bracket `)` it will return ``list([])``. We use this function for two purposes. Given an expression ``bar.foo``, we may want to - infer the type of ``foo`` to offer completions after foo - infer the type of ``bar`` to be able to jump to the definition of foo The option ``cut_own_trailer`` must be set to true for the second purpose. �fstringr )�compiled�trailer����:)� NO_VALUES�atom� � error_nodeT�awaitN)� infer_trailer) r �type�jedi.inferencer'