
    ^h                        S SK r S SKJr  S SKJr  S SKJr  S SKJrJ	r	  S SK
JrJrJrJr  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJr  S SKJr  S SKJr   " S S\5      r " S S5      r " S S\5      r " S S\\5      rg)    N)Path)Optional)inference_state_method_cache)AbstractNameDefinition
ModuleName)GlobalNameFilterParserTreeFilter
DictFilterMergedFilter)compiled)	TreeValue)SubModuleName)values_from_qualified_names)create_simple_object)ValueSetModuleContextc                   ,    \ rS rSrSrSrSS jrS rSrg)	_ModuleAttributeName   z9
For module attributes like __file__, __str__ and so on.
instanceNc                 (    Xl         X l        X0l        g N)parent_contextstring_name_string_value)selfparent_moduler   string_values       U/home/james-whalen/.local/lib/python3.13/site-packages/jedi/inference/value/module.py__init___ModuleAttributeName.__init__   s    +&)    c                     U R                   b6  U R                   n[        [        U R                  R                  U5      /5      $ [
        R                  " U R                  R                  5      $ r   )r   r   r   r   inference_stater   get_string_value_set)r   ss     r    infer_ModuleAttributeName.infer   s`    )""A$T%8%8%H%H!L   ,,T-@-@-P-PQQr#   )r   r   r   r   )	__name__
__module____qualname____firstlineno____doc__api_typer!   r(   __static_attributes__ r#   r    r   r      s     H*
Rr#   r   c                   .    \ rS rSr\" 5       S 5       rSrg)SubModuleDictMixin%   c                     0 nU R                  5       (       aX  U R                  R                  R                  U R	                  5       5      nU H  n[        U R                  5       U5      X'   M!     U$ )zN
Lists modules in the directory of this module (if this module is a
package).
)
is_packager%   compiled_subprocessiter_module_names
py__path__r   
as_context)r   namesmodsnames       r    sub_modules_dict#SubModuleDictMixin.sub_modules_dict&   sd     ??'';;MM!D +DOO,=tD  r#   r1   N)r*   r+   r,   r-   r   r>   r0   r1   r#   r    r3   r3   %   s    !# $r#   r3   c                       \ rS rSr\rSS jrS rS rS r	\
\" 5       S 5       5       r\" 5       S 5       rS	 r\" / 5      S
 5       rS rSrg)ModuleMixin:   Nc              #   "  #    [        [        U R                  5       US9[        U R                  5       5      5      v   [	        U R                  5       5      v   [	        U R                  5       5      v   U R                  5        S h  vN   g  N7f)N)r   origin_scope)r   r	   r:   r   r
   r>   _module_attributes_dictiter_star_filters)r   rD   s     r    get_filtersModuleMixin.get_filters=   st     #0) T__./
 	
 ..01155788))+++s   BBBBc                 8    [        U R                  SS5      u  nU$ )Ntypes
ModuleType)r   r%   )r   cs     r    py__class__ModuleMixin.py__class__I   s    ()=)=wUr#   c                     g)NTr1   r   s    r    	is_moduleModuleMixin.is_moduleM   s    r#   c                     g)NFr1   rP   s    r    is_stubModuleMixin.is_stubP   s    r#   c                 >    U R                  X R                  S   5      $ N)_module_name_classstring_namesrP   s    r    r=   ModuleMixin.nameS   s      &&t->->r-BCCr#   c                    ^  / SQn[        U 4S jU 5       5      nT R                  5       nUb  [        T S[        U5      5      US'   U$ )N)__package__r.   r*   c              3   >   >#    U  H  o[        TU5      4v   M     g 7fr   )r   ).0nr   s     r    	<genexpr>6ModuleMixin._module_attributes_dict.<locals>.<genexpr>\   s     Eu!+D!45us   __file__)dict
py__file__r   str)r   r;   dctpaths   `   r    rE   #ModuleMixin._module_attributes_dictX   sE    6EuEE 24SYOC
O
r#   c              #      #    U R                  5        H&  n[        UR                  5       S 5      nUc   eUv   M(     g 7fr   )star_importsnextrG   )r   star_modulefs      r    rF   ModuleMixin.iter_star_filtersb   s<     ,,.K[,,.5A= =G /s   <>c                    SSK Jn  / nU R                  5       nU R                  R	                  5        H  nUR                  5       (       d  M  U" U R                  UR                  5       S   UUR                  S9R                  5       nU H,  n[        U[        5      (       d  M  X&R                  5       -  nM.     X%-  nM     U$ )Nr   )ImporterrX   )import_pathmodule_contextlevel)jedi.inference.importsrq   r:   	tree_nodeiter_importsis_star_importr%   	get_pathsrt   follow
isinstanceModuleValuerk   )r   rq   modulesrs   inewmodules          r    rk   ModuleMixin.star_importsk   s    3*,,.A!!(( !b 1#1''	
 &(  "F!&+66#6#6#88 "  / r#   c                     g)z
A module doesn't have a qualified name, but it's important to note that
it's reachable and not `None`. With this information we can add
qualified names on top for all value children.
r1   r1   rP   s    r    get_qualified_namesModuleMixin.get_qualified_names   s     r#   r1   r   )r*   r+   r,   r-   r   rY   rG   rM   rQ   rT   propertyr   r=   rE   rF   rk   r   r0   r1   r#   r    rA   rA   :   sw    #
, !#D $ D "# $ ""% &(r#   rA   c                   x   ^  \ rS rSrSr  SU 4S jjrU 4S jrS rS\\	   4S jr
S rS	 rS
 rS rS rSrU =r$ )r|      r   c                    > [         TU ]  US US9  X@l        Uc  S U l        OUR                  U l        XPl        X0l        X`l        g )N)r   rv   )superr!   file_io_pathrh   rZ   
code_lines_is_package)r   r%   module_noder   r   rZ   r6   	__class__s          r    r!   ModuleValue.__init__   sM    ! 	 	

 ?)-DJ DJ($%r#   c                 p   > U R                   b  U R                   R                  S:X  a  g[        TU ]  5       $ )Nz.pyiT)r   suffixr   rT   )r   r   s    r    rT   ModuleValue.is_stub   s0    ::!djj&7&76&A w  r#   c                 T    U R                   c  g SR                  U R                   5      $ )N.)rZ   joinrP   s    r    
py__name__ModuleValue.py__name__   s&    $xx))**r#   returnc                 R    U R                   c  gU R                   R                  5       $ )z/
In contrast to Python's __file__ can be None.
N)r   absoluterP   s    r    re   ModuleValue.py__file__   s$     ::zz""$$r#   c                     U R                   $ r   )r   rP   s    r    r6   ModuleValue.is_package   s    r#   c                 x    U R                   c  / $ U R                  (       a  U R                   $ U R                   S S $ rW   )rZ   r   rP   s    r    py__package__ModuleValue.py__package__   s;    $I$$$  "%%r#   c                 B   U R                   (       d  gSR                  U R                  SS 5      nSnUS   U;   d	  US   U;   a  [        5       nU R                  R                  5        Hm  n[        R                  R                  X@R                  R                  5      n[        R                  R                  U5      (       d  M\  UR                  U5        Mo     U(       a  [        U5      $ U R                  5       nUc   e[        R                  R                  U5      /$ )z
In case of a package, this returns Python's __path__ attribute, which
is a list of paths (strings).
Returns None if the module is not a package.
N 2   )zdeclare_namespace(__name__)zextend_path(__path__r      )r   r   r   setr%   get_sys_pathosrh   r=   r   isdiraddlistre   dirname)r   first_few_linesoptionspathsr'   otherfiles          r    r9   ModuleValue.py__path__   s      ''$//#2"67 J1:(GAJ/,I EE))668Q		(=(=>77==''IIe$ 9 E{"  %&&r#   c                     [        U 5      $ r   r   rP   s    r    _as_contextModuleValue._as_context   s    T""r#   c                     SU R                   R                  < SU R                  5       < SU R                  R                  S   < SU R                  R
                  S   < SU R                  5       < S3$ )N<z: @r   -z	 is_stub=>)r   r*   r   rv   	start_posend_posrT   rP   s    r    __repr__ModuleValue.__repr__   sN    NN##T__%6NN$$Q')?)?)BLLN
 	
r#   )r   r   r   r   rZ   )NNF)r*   r+   r,   r-   r/   r!   rT   r   r   r   re   r6   r   r9   r   r   r0   __classcell__)r   s   @r    r|   r|      sL    HIM/4& !+
%HTN % &'B#
 
r#   r|   )r   pathlibr   typingr   jedi.inference.cacher   jedi.inference.namesr   r   jedi.inference.filtersr   r	   r
   r   jedi.inferencer   jedi.inference.base_valuer   r   jedi.inference.helpersr   jedi.inference.compiledr   r   jedi.inference.contextr   r   r3   rA   r|   r1   r#   r    <module>r      sh    	   = C _ _ # / . > 8 . 0R1 R( *L$ L^]
+y ]
r#   