Format: application/x-python-code
1 o
2
3 �h7 � @ s� d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm Z dd� Z
4 dd� Zd$d
5 d�Zdd
6 � Z
7 dd� Zdd� Zdd� Zdd� Zdd� Zdd� ZG dd� de�Zedd� �Zd%dd�Zd d!� Zd"d#� ZdS )&� N)�chain)�contextmanager)�treec C sJ | j }d|v sd|v r
8 dS tj�tjdd�}tt�t� |�d t
9 | ���S )Nz
10 dist-packagesz
11 site-packagesF�lib�pythonz\d.\d)�parts�os�path�join�sys�prefix�bool�re�match�escape�str)r r � base_path� r �Lc:\Users\shubh\Videos\agent\nova\Lib\site-packages\jedi/inference/helpers.py�is_stdlib_path s
12 r c C sZ t � | �}g }| jD ]}t|tj�rt � |�}||_nt|�}||_|�|� q
13 ||_|S )zO
14 Much, much faster than copy.deepcopy, but just for parser tree nodes.
15 )�copy�children�
16 isinstancer ZLeaf�parent�
17 deep_ast_copy�append)�objZnew_objZnew_children�child� new_childr r r r s
18
19
20 r Fc C sL |j }|jdkrddlm} |�| j�S |jdks%||jd |jd fvr@|dkr1ddlm} |S |jdkr;| � |�S | � |�S |j }|j�
21 |�}|rN|}n|d }|jd
22 krt|} | d 8 } |j| }
23 |
24 jdkrinqZ|j| d |� }n|jd }
25 |jd |� }|
26 dkr�|d }
27 |d d
28 � }| � |
29 �}ddlm}
30 |D ]}|
31 | ||�}q�|S )a�
32 Creates a "call" node that consist of all ``trailer`` and ``power``
33 objects. E.g. if you call it with ``append``::
34
35 list([]).append(3) or None
36
37 You would get a node with the content ``list([]).append`` back.
38
39 This generates a copy of the original ast node.
40
41 If you're using the leaf, e.g. the bracket `)` it will return ``list([])``.
42
43 We use this function for two purposes. Given an expression ``bar.foo``,
44 we may want to
45 - infer the type of ``foo`` to offer completions after foo
46 - infer the type of ``bar`` to be able to jump to the definition of foo
47 The option ``cut_own_trailer`` must be set to true for the second purpose.
48 Zfstringr )�compiled�trailer������:)� NO_VALUESZatom� Z
49 error_nodeT�awaitN)�
50 infer_trailer)
51 r �typeZjedi.inferencer Zget_string_value_set�inference_stater Zjedi.inference.base_valuer# Z
52 infer_node�indexZjedi.inference.syntax_treer&