
    ^h!                        S SK r S SKrS SKrS SKrS SKJr  S SKJr  S SK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Jr  S
 rS rS rS rSS jrS rS rSS jrS rS rS rS r SS jr!SS jr"S r#S r$S r% " S S5      r&g)     N)Path)ZipFile)zipimporterZipImportError)all_suffixes)access)debug)parser_utils)KnownContentFileIO	ZipFileIOc                  "    [         R                  $ N)syspath     f/home/james-whalen/.local/lib/python3.13/site-packages/jedi/inference/compiled/subprocess/functions.pyget_sys_pathr      s    88Or   c                 0    [         R                  " U 40 UD6$ r   )r   load_module)inference_statekwargss     r   r   r      s    o888r   c                 p    U R                   R                  U5      n[        UR                  U5      " U0 UD6$ r   )compiled_subprocessget_access_handlegetattrr   )r   id	attributeargsr   handles         r   get_compiled_method_returnr!      s3    00BB2FF6==),d=f==r   c                 .    [         R                  " X5      $ r   )r   create_access_path)r   objs     r   create_simple_objectr%      s    $$_::r   c                     Ub  U[         R                  s[         l        n [        SSU0UD6Ub  W[         l        $ $ ! [         a     Ub  W[         l        ggf = f! Ub  W[         l        f f = f)zC
Returns Tuple[Union[NamespaceInfo, FileIO, None], Optional[bool]]
	full_nameNNr   )r   r   _find_moduleImportError)r   sys_pathr'   r   temps        r   get_module_infor-   !   s     !388$:i:6: CH    CH   CH  s!   = 
AA AA A-c                 "    [         R                  $ r   )r   builtin_module_names)r   s    r   get_builtin_module_namesr0   0   s    ###r   c                     Ue)z=
Raise an error to simulate certain problems for unit tests.
r   )r   exception_types     r   _test_raise_errorr3   4   s
     r   c                     Ub6  [        U[        R                  S9  [        R                  R                  5         Ub*  [        U5        [        R                  R                  5         gg)zD
Force some prints in the subprocesses. This exists for unit tests.
N)file)printr   stderrflushstdout)r   r7   r9   s      r   _test_printr:   ;   sJ     f3::&

f

 r   c                     [        5        HN  n[        R                  R                  U SU-   5      n[        R                  R	                  U5      (       d  ML  Us  $    g)zR
The __init__ file can be searched in a directory. If found return it, else
None.
__init__N)r   osr   joinexists)directory_pathsuffixr   s      r   _get_init_pathrB   G   sF    
 .ww||NJ,?@77>>$K ! r   c                 .    [         R                  " U5      $ r   )r
   safe_literal_eval)r   values     r   rD   rD   S   s    ))%00r   c                  *    [        [        U 0 UD65      $ r   )list_iter_module_names)r   r   s     r   iter_module_namesrI   W   s    "D3F344r   c              #   2  #    U H  n S [         R                  " U5       5       nU H  u  pVU(       a%  US:w  a  UR                  5       (       a  Uv   M-  M/  M1  UR                  S5      (       a  US S nO[        R                  " U5      nU(       d  Ml  SU;  d  Mt  US:w  d  M|  Uv   M     M     g ! [         aY     [        U5      n[	        UR
                  UR                  5      n N! [         a    [        R                  " SU5          GM
  f = ff = f7f)Nc              3   X   #    U  H   oR                   UR                  5       4v   M"     g 7fr   )nameis_dir).0entrys     r   	<genexpr>%_iter_module_names.<locals>.<genexpr>_   s     VEUEJJ7EUs   (*z"Not possible to list directory: %s__pycache__z.pyi.r<   )r=   scandirOSErrorr   _zip_list_subdirectoryarchiveprefixr   r	   warningisidentifierendswithinspectgetmodulename)r   pathsr   dir_entrieszip_import_inforL   rM   modnames           r   rH   rH   [   s    	VRZZPTEUVK (LD =(T->->-@-@J .A( ==(("3BiG%33D9G7s'1*,% (   	
"-d"3 5#++_-C-CE! BDI	sX   DB1A*DDD$D1
D<+C)'D)!D
DDDDDc                    SnSn[         R                   H  nU(       a!  U[        R                  R                  :w  a  SnOUn UR
                  nU" X5      nUc  MG  UR                  S:X  a  MY  UR                  nUcA  UR                  (       d0  U(       d  U OUn[        X$R                  R                  5      n	U	S4s  $   O   [        XU5      $ ! [         a     M  f = f)a  
Provides information about a module.

This function isolates the differences in importing libraries introduced with
python 3.3 on; it gets a module name and optionally a path. It will return a
tuple containin an open file for the module (if not builtin), the filename
or the name of the module if it is a builtin one and a boolean indicating
if the module is contained in a package.
NfrozenT)r   	meta_path	importlib	machinery
PathFinder	find_specAttributeErrororiginloaderhas_locationImplicitNSInfosubmodule_search_locations_path_find_module_py33)
stringr   r'   is_global_searchspecrl   finderpri   implicit_ns_infos
             r   r)   r)   ~   s     DF--)*=*=*H*H HAA	((I #{{h&[[F~d&7&7*.FI	#1)=\=\=b=b#c '--1  4 V622'  	 	s   C
CCc                    U(       d8  [         R                  R                  R                  X5      nUb  UR                  nUc2  Uc/   [         R
                  R                  U 5      nUb  UR                  nUc  [        SR                  U 5      5      e[        X 5      $ ! [         a  n[        S[        U5      -   5      eS nAff = f)NzOriginally  zCouldn't find a loader for {})rf   rg   rh   ri   rl   util
ValueErrorr*   reprformat_from_loader)rr   r   rl   r'   rs   rt   es          r   rq   rq      s    ""--77E[[F~$,	8>>++F3D ~9@@HII''  	8 ntAw677	8s   .B 
C'B>>Cc                     U R                   nU" U5      n U R                  nU" U5      n [        U 5      R                  nU[        R                  R                  R                  La  U R	                  U5      nO[        X5      nUc  S U4$ [        U [        5      (       a!  [        XW[        U R                  5      5      U4$ [        XW5      U4$ ! [         a    Sn Nf = f! [         a    S U4s $ f = f! [         a    [        S5      ef = f)NFz$get_source was not defined on loader)
is_packagerj   get_filenametype
get_sourcer*   rf   rg   SourceFileLoader_get_source
isinstancer   r   r   rX   r   )rl   rr   is_package_methodr   r   module_pathfcodes           r   r}   r}      s    /"-- 'v.
+** #6*BL## 		##44???   (6*|Z&+&&D,@A:MMk0*<<C  
   Z   B@AABs-   C C! C5 CC!C21C25Dc                 x    U R                  U5      n U R                  U5      $ ! [         a    [        SUS9ef = f)zu
This method is here as a replacement for SourceLoader.get_source. That
method returns unicode, but we prefer bytes.
z'source not available through get_data())rL   )r   get_datarV   r*   )rl   fullnamer   s      r   r   r      sJ    
 x(D)t$$ )C') 	))s   $ 9c              #     #    [        U 5      n[        U5      nUR                  5       nU HP  n[        U5      nUR                  U:X  d  M   UR	                  U5      nUR
                  UR                  S5      4v   MR     g 7f)N/)r   r   namelistparentrelative_torL   r\   )zip_pathzip_subdir_pathzip_filezip_content_file_pathsraw_file_name	file_paths         r   rW   rW      st     x H?+O%..0/'	.!--o>I..-"8"8"===	 0s   AB 5B c                       \ rS rSrSrS rSrg)rn      z;Stores information returned from an implicit namespace specc                     Xl         X l        g r   rL   r_   )selfrL   r_   s      r   r<   ImplicitNSInfo.__init__   s    	
r   r   N)__name__
__module____qualname____firstlineno____doc__r<   __static_attributes__r   r   r   rn   rn      s
    Er   rn   r(   )NNT)NNNT)'r   r=   r]   rf   pathlibr   zipfiler   	zipimportr   r   importlib.machineryr   jedi.inference.compiledr   jedir	   r
   jedi.file_ior   r   r   r   r!   r%   r-   r0   r3   r:   rB   rD   rI   rH   r)   rq   r}   r   rW   rn   r   r   r   <module>r      s    
 	     1 , *   69>
;$		15 &F'3T(,$=N
)> r   