
    f9                         d dl mZ d dlmZ d dlmZ d dlmZmZ d dl	m
Z
 d dlmZ  G d de      Z G d	 d
e      Z G d de      Z G d de      Z G d de      Z G d de      Zy)    )ValueWrapper)ModuleValue)ParserTreeFilter)StubNameStubModuleName)TypingModuleFilterWrapper)ModuleContextc                   J     e Zd ZeZ fdZd Z fdZd Zd fd	Z	d Z
 xZS )StubModuleValuec                 2    t        |   |i | || _        y N)super__init__non_stub_value_set)selfr   argskwargs	__class__s       \/var/www/cvtools/html/venv/lib/python3.12/site-packages/jedi/inference/gradual/stub_value.pyr   zStubModuleValue.__init__   s    $)&)"4    c                      y)NT r   s    r   is_stubzStubModuleValue.is_stub   s    r   c                     i }| j                   D ]%  }	 |j                  }|j                   |              ' |j                  t        |                 |S # t        $ r Y Rw xY w)z
        We have to overwrite this, because it's possible to have stubs that
        don't have code for all the child modules. At the time of writing this
        there are for example no stubs for `json.tool`.
        )r   sub_modules_dictupdateAttributeErrorr   )r   namesvaluemethodr   s       r   r   z StubModuleValue.sub_modules_dict   sn     ,, 	'E'// VX&	' 	UW-/0 " s   A	A#"A#c                 n    t        | j                         |      gt        | j                               z   S )N)parent_contextorigin_scope)
StubFilter
as_contextlistiter_star_filters)r   r$   s     r   _get_stub_filtersz!StubModuleValue._get_stub_filters$   s9    ??,%
  $((*+, 	,r   c              #      K   t         |   |      }t        |d        | j                  |      }|E d {    |E d {    y 7 7 wN)r$   )r   get_filtersnextr)   )r   r$   filtersstub_filtersr   s       r   r,   zStubModuleValue.get_filters*   sN     '%l3Wd--<-H 	 s!   3A
A	A
 AA
A
c                     t        |       S r   )StubModuleContextr   s    r   _as_contextzStubModuleValue._as_context1   s     &&r   r   )__name__
__module____qualname__r   _module_name_classr   r   r   r)   r,   r2   __classcell__r   s   @r   r   r   	   s'    '5",'r   r   c                         e Zd Zd fd	Z xZS )r1   c                 $    t         |   |      S r+   )r   r,   )r   until_positionr$   r   s      r   r,   zStubModuleContext.get_filters6   s     w""==r   )NNr3   r4   r5   r,   r7   r8   s   @r   r1   r1   5   s    > >r   r1   c                   $     e Zd Z fdZd Z xZS )TypingModuleWrapperc              /   ~   K   t        |   |i |}t        |d       }|J t        |       |E d {    y 7 wr   )r   r,   r-   r   )r   r   r   r.   fr   s        r   r,   zTypingModuleWrapper.get_filters=   sE     '%t6v6$}}'**s   2=;=c                     t        |       S r   )TypingModuleContextr   s    r   r2   zTypingModuleWrapper._as_contextD   s    "4((r   )r3   r4   r5   r,   r2   r7   r8   s   @r   r>   r>   <   s    )r   r>   c                        e Zd Z fdZ xZS )rB   c              /   r   K   t        |   |i |}t        t        |d              |E d {    y 7 wr   )r   r,   r   r-   )r   r   r   r.   r   s       r   r,   zTypingModuleContext.get_filtersI   s6     '%t6v6'Wd(;<<s   ,757r<   r8   s   @r   rB   rB   H   s     r   rB   c                   "     e Zd ZeZ fdZ xZS )r%   c                    t         |   |      sy|j                         }|y|j                  dv r|j                  j                  dvry|j
                  }|j                  d      r#|j                  d      r|j                  d      syy)NF)import_fromimport_name)import_as_namedotted_as_name___T)r   _is_name_reachableget_definitiontypeparentr    
startswithendswith)r   name
definitionnr   s       r   rM   zStubFilter._is_name_reachableR   s    w)$/ ((*
??<<{{'KKJJ<<all4&8QZZ=Mr   )r3   r4   r5   r   
name_classrM   r7   r8   s   @r   r%   r%   O   s    J r   r%   c                       e Zd Zy)VersionInfoN)r3   r4   r5   r   r   r   rX   rX   e   s    r   rX   N)jedi.inference.base_valuer   jedi.inference.value.moduler   jedi.inference.filtersr   jedi.inference.namesr   r   jedi.inference.gradual.typingr   jedi.inference.contextr	   r   r1   r>   rB   r%   rX   r   r   r   <module>r_      sa    2 3 3 9 C 0)'k )'X> >	)/ 	)- ! ,	, 	r   