Your IP : 216.73.216.213
B
��\, � @ s\ d Z ddlZddlZddlmZ G dd� d�ZG dd� d�Zee ed�d d
�Zdd� ZdS )
zIVarious context related utilities, including inference and call contexts.� N)�Optionalc @ sL e Zd ZdZdZddd�Zdd� Zdd � Zd
d� Ze j
dd
� �Zdd� ZdS )�InferenceContextz�Provide context for inference
Store already inferred nodes to save time
Account for already visited nodes to infinite stop infinite recursion
)�path�
lookupname�callcontext� boundnode�inferred�
extra_contextNc C s2 |pt � | _d | _d | _d | _|p$i | _i | _d S )N)�setr r r r r r )�selfr r � r �@/opt/alt/python37/lib/python3.7/site-packages/astroid/context.py�__init__ s
zInferenceContext.__init__c C s, | j }||f| jkrdS | j�||f� dS )z�Push node into inference path
:return: True if node is already in context path else False
:rtype: bool
Allows one to see if the given node has already
been looked at for this inference contextTF)r r �add)r �node�namer r r
�pushP s
zInferenceContext.pushc C s, t | j| jd�}| j|_| j|_| j|_|S )z�Clone inference path
For example, each side of a binary operation (BinOp)
starts with the same context but diverge as each side is inferred
so the InferenceContext will need be cloned)r )r r r r r r )r �cloner r r
r _ s
zInferenceContext.clonec c s4 g }x|D ]}|� |� |V q
W t|�| j|<