U
    nuf{                     @   s(   d dl mZ d dlmZmZ dd ZdS )    )Path)TYPESHED_PATHcreate_stub_modulec           
      C   s   |j }t|}|jdkstz|t}W n tk
r>   Y n0X |d}|jdd }|j	dkrn|dd }|dk	r| j
|dd}t| |||||}	|	| j|< |	S dS )	z\
    This function is given a random .pyi file and should return the proper
    module.
    z.pyi    N__init__F)Zprefer_stubs)pathr   suffixAssertionErrorrelative_tor   
ValueErrorwith_suffixpartsnameimport_moduler   Zstub_module_cache)
Zinference_stateZgrammarZfile_ioZimport_namesZmodule_noder	   relative_pathrestZactual_value_setZstub r   @/tmp/pip-unpacked-wheel-ol4ehs9f/jedi/inference/gradual/utils.pyload_proper_stub_module   s0    

    
r   N)pathlibr   Zjedi.inference.gradual.typeshedr   r   r   r   r   r   r   <module>   s   