B
    7ุr\  ใ               @   s$   G d d de ZG dd de ZdS )c               @   s   e Zd ZdddZdd ZdS )ฺBaseContextNc             C   s   || _ || _d S )N)ฺ	evaluatorฺparent_context)ฺselfr   r   ฉ r   ๚2lib/python3.7/site-packages/jedi/common/context.pyฺ__init__   s    zBaseContext.__init__c             C   s"   | }x|j d kr|S |j }qW d S )N)r   )r   ฺcontextr   r   r   ฺget_root_context   s
    
zBaseContext.get_root_context)N)ฺ__name__ฺ
__module__ฺ__qualname__r   r	   r   r   r   r   r      s   
r   c               @   sp   e Zd Zdd Zedd Zedd Zedd Zd	d
 Zdd Z	dd Z
dd Zdd Zdd Zdd ZdS )ฺBaseContextSetc             G   s   t || _d S )N)ฺsetฺ_set)r   ฺargsr   r   r   r      s    zBaseContextSet.__init__c             C   s   |   t|กS )N)ฺfrom_setr   )ฺclsฺiterabler   r   r   ฺfrom_iterable   s    zBaseContextSet.from_iterablec             C   s   |  }||_ |S )N)r   )r   ฺset_r   r   r   r   r      s    zBaseContextSet.from_setc             C   sD   t  }t|}x*|D ]"}t|tr.||jO }q||O }qW |  |กS )z7
        Used to work with an iterable of set.
        )r   ฺlistฺ
isinstancer   r   r   )r   ZsetsZ
aggregatedr   r   r   r   ฺ	from_sets   s    

zBaseContextSet.from_setsc             C   s   t |  | j|jB กS )N)ฺtyper   r   )r   ฺotherr   r   r   ฺ__or__*   s    zBaseContextSet.__or__c             c   s   x| j D ]
}|V  qW d S )N)r   )r   ฺelementr   r   r   ฺ__iter__-   s    zBaseContextSet.__iter__c             C   s
   t | jS )N)ฺboolr   )r   r   r   r   ฺ__bool__1   s    zBaseContextSet.__bool__c             C   s
   t | jS )N)ฺlenr   )r   r   r   r   ฺ__len__4   s    zBaseContextSet.__len__c             C   s"   d| j jd dd | jD กf S )Nz%s(%s)z, c             s   s   | ]}t |V  qd S )N)ฺstr)ฺ.0ฺsr   r   r   ๚	<genexpr>8   s    z*BaseContextSet.__repr__.<locals>.<genexpr>)ฺ	__class__r
   ฺjoinr   )r   r   r   r   ฺ__repr__7   s    zBaseContextSet.__repr__c             C   s   t |  t|| jกS )N)r   r   ฺfilterr   )r   Zfilter_funcr   r   r   r)   :   s    zBaseContextSet.filterc                s    fdd}|S )Nc                 s"   t   fddjD กS )Nc             3   s   | ]}t | V  qd S )N)ฺgetattr)r#   r   )r   ฺkwargsฺnamer   r   r%   @   s   z=BaseContextSet.__getattr__.<locals>.mapper.<locals>.<genexpr>)r   r   r   )r   r+   )r,   r   )r   r+   r   ฺmapper>   s    z*BaseContextSet.__getattr__.<locals>.mapperr   )r   r,   r-   r   )r,   r   r   ฺ__getattr__=   s    zBaseContextSet.__getattr__N)r
   r   r   r   ฺclassmethodr   r   r   r   r   r   r!   r(   r)   r.   r   r   r   r   r      s   r   N)ฺobjectr   r   r   r   r   r   ฺ<module>   s   