ó
    Ð]jŸ@  ã                   óü   • S r 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  SSKJr  SS	KJrJr  SS
KJrJrJr  SSKJr  SSKJr  SSKJrJr  SSKJr  SrSr Sr!S r"S r# " S S5      r$S r%S r&SS jr'S r(g)aŒ  
Projects are a way to handle Python projects within Jedi. For simpler plugins
you might not want to deal with projects, but if you want to give the user more
flexibility to define sys paths and Python interpreters for a project,
:class:`.Project` is the perfect way to allow for that.

Projects can be saved to disk and loaded again, to allow project definitions to
be used across repositories.
é    N)ÚPath)Úchain)Údebug)Úget_cached_default_environmentÚcreate_environment)ÚWrongVersion)Úsearch_in_module)Úsplit_search_stringÚget_module_names)Úload_module_from_pathÚload_namespace_from_pathÚiter_module_names)Údiscover_buildout_paths)Ú%inference_state_as_method_param_cache)Ú%recurse_find_python_folders_and_filesÚsearch_in_file_ios)ÚFolderIOz.jedi)zsetup.pyz.gitz.hgzrequirements.txtzMANIFEST.inzpyproject.tomlé   c                 ó   ^ • U 4S jnU$ )Nc               ?   ó2  >#   • / n/ nT" U 0 UD6 H‚  nUR                   R                  nUb  XR;   a  M#  UR                  S:X  a:  UR                  b-  UR                  U;   a  MR  UR	                  UR                  5        Uv •  UR	                  U5        M„     g 7f)NÚmodule)Ú_nameÚ	tree_nameÚtypeÚmodule_pathÚappend)ÚargsÚkwargsÚfound_tree_nodesÚfound_modulesÚ
definitionÚ	tree_nodeÚfuncs         €ÚM/home/mande/repo/quber/.venv/lib/python3.13/site-packages/jedi/api/project.pyÚwrapperÚ(_try_to_skip_duplicates.<locals>.wrapper"   s”   øé € ØÐØˆÙ Ð/¨Ô/ˆJØ"×(Ñ(×2Ñ2ˆIØÑ$¨Ó)FÙØ�‰ (Ó*¨z×/EÑ/EÑ/QØ×)Ñ)¨]Ó:ÙØ×$Ñ$ Z×%;Ñ%;Ô<ØÒØ×#Ñ# IÖ.ò 0ùs   ƒBB© )r#   r%   s   ` r$   Ú_try_to_skip_duplicatesr(   !   s   ø€ õ/ð €Nó    c              #   ój   #   • [        5       nU  H  nX!;   a  M
  UR                  U5        Uv •  M!     g 7f©N)ÚsetÚadd)ÚpathÚusedÚps      r$   Ú_remove_duplicates_from_pathr1   2   s.   é € Ü‹5€DÛˆØ‹9ÙØ�‰�ŒØŒò	 ùs   ‚13c                   ó  • \ rS rSrSrSr\S 5       r\S 5       r\	S 5       r
S rSSSS	S
S. SS jjr\S 5       r\S 5       r\S 5       r\S 5       r\" 5       S 5       r\" 5       SS j5       rS rSS.S jrS r\SS j5       rS rSrg)ÚProjecté;   zÒ
Projects are a simple way to manage Python folders and define how Jedi does
import resolution. It is mostly used as a parameter to :class:`.Script`.
Additionally there are functions to search a whole project.
Nc                 ó,   • U R                  [        5      $ r+   )ÚjoinpathÚ_CONFIG_FOLDER©Ú	base_paths    r$   Ú_get_config_folder_pathÚProject._get_config_folder_pathC   s   € à×!Ñ!¤.Ó1Ð1r)   c                 óJ   • [         R                  U 5      R                  S5      $ )Nzproject.json)r3   r:   r6   r8   s    r$   Ú_get_json_pathÚProject._get_json_pathG   s   € ä×.Ñ.¨yÓ9×BÑBÀ>ÓRÐRr)   c                 ó  • [        U[        5      (       a  [        U5      n[        U R	                  U5      5       n[
        R                  " U5      u  p4SSS5        WS:X  a  U " S0 WD6$ [        S5      e! , (       d  f       N'= f)zÓ
Loads a project from a specific path. You should not provide the path
to ``.jedi/project.json``, but rather the path to the project folder.

:param path: The path of the directory you want to use as a project.
Nr   zEThe Jedi version of this project seems newer than what we can handle.r'   )Ú
isinstanceÚstrr   Úopenr=   ÚjsonÚloadr   )Úclsr.   ÚfÚversionÚdatas        r$   rD   ÚProject.loadK   sq   € ô �dœC× Ñ Ü˜“:ˆDÜ�#×$Ñ$ TÓ*Ô+¨qÜ ŸIšI a›L‰MˆG÷ ,ð �a‹<Ù‘;˜‘;ÐäØWóð ÷ ,Õ+ús   »A5Á5
Bc                 ó  • [        U R                  5      nUR                  SS5        UR                  SS5        UR                  5        VVs0 s H  u  p#UR	                  S5      U_M     nnn[        US   5      US'   U R                  U R                  5      R                  SSS9  [        U R                  U R                  5      S5       n[        R                  " [        U4U5      sSSS5        $ s  snnf ! , (       d  f       g= f)	zK
Saves the project configuration in the project in ``.jedi/project.json``.
Ú_environmentNÚ_djangoÚ_r.   T)ÚparentsÚexist_okÚw)ÚdictÚ__dict__ÚpopÚitemsÚlstriprA   r:   Ú_pathÚmkdirrB   r=   rC   ÚdumpÚ_SERIALIZER_VERSION)ÚselfrH   ÚkÚvrF   s        r$   ÚsaveÚProject.save_   sÐ   € ô �D—M‘MÓ"ˆØ�‰� Ô&Ø�‰�˜DÔ!Ø-1¯Z©Z¬\Ô:ª\¡T Q�—‘˜“˜qÒ ©\ˆÑ:Ü˜4 ™<Ó(ˆˆV‰à×$Ñ$ T§Z¡ZÓ0×6Ñ6¸tÈdÐ6ÑSÜ�$×%Ñ% d§j¡jÓ1°3Ô7¸1Ü—9’9Ô1°4Ð8¸!Ó<÷ 8Ñ7ùó	 ;÷ 8Õ7ús   ÁC4ÃC:Ã:
DFr'   T)Úenvironment_pathÚload_unsafe_extensionsÚsys_pathÚadded_sys_pathÚsmart_sys_pathc                ó  • [        U[        5      (       a  [        U5      R                  5       nXl        X l        Ub  [        [        [        U5      5      nX@l        X`l	        X0l
        SU l        [        [        [        U5      5      U l        g)aœ  
:param path: The base path for this project.
:param environment_path: The Python executable path, typically the path
    of a virtual environment.
:param load_unsafe_extensions: Default False, Loads extensions that are not in the
    sys path and in the local directories. With this option enabled,
    this is potentially unsafe if you clone a git repository and
    analyze it's code, because those compiled extensions will be
    important and therefore have execution privileges.
:param sys_path: list of str. You can override the sys path if you
    want. By default the ``sys.path.`` is generated by the
    environment (virtualenvs, etc).
:param added_sys_path: list of str. Adds these paths at the end of the
    sys path.
:param smart_sys_path: If this is enabled (default), adds paths from
    local directories. Otherwise you will have to rely on your packages
    being properly configured on the ``sys.path``.
NF)r@   rA   r   ÚabsoluterV   Ú_environment_pathÚlistÚmapÚ	_sys_pathÚ_smart_sys_pathÚ_load_unsafe_extensionsrL   rb   )rZ   r.   r_   r`   ra   rb   rc   s          r$   Ú__init__ÚProject.__init__m   st   € ô: �dœC× Ñ Ü˜“:×&Ñ&Ó(ˆDØŒ
à!1ÔØÑäœC¤ XÓ.Ó/ˆHØ!ŒØ-ÔØ'=Ô$ØˆŒä"¤3¤s¨NÓ#;Ó<ˆÔØGr)   c                 ó   • U R                   $ )z!
The base path for this project.
)rV   ©rZ   s    r$   r.   ÚProject.pathš   s   € ð
 �z‰zÐr)   c                 ó   • U R                   $ )zb
The sys path provided to this project. This can be None and in that
case will be auto generated.
)ri   ro   s    r$   ra   ÚProject.sys_path¡   s   € ð �~‰~Ðr)   c                 ó   • U R                   $ )z]
If the sys path is going to be calculated in a smart way, where
additional paths are added.
)rj   ro   s    r$   rc   ÚProject.smart_sys_path©   s   € ð ×#Ñ#Ð#r)   c                 ó   • U R                   $ )z-
Wheter the project loads unsafe extensions.
)rk   ro   s    r$   r`   ÚProject.load_unsafe_extensions±   s   € ð
 ×+Ñ+Ð+r)   c                 ó’   • [        UR                  R                  5       5      n UR                  S5        U$ ! [         a     U$ f = f)NÚ )rg   ÚenvironmentÚget_sys_pathÚremoveÚ
ValueError)rZ   Úinference_statera   s      r$   Ú_get_base_sys_pathÚProject._get_base_sys_path¸   sN   € ô ˜×3Ñ3×@Ñ@ÓBÓCˆð	Ø�O‰O˜BÔð ˆøô ó 	ØØˆð	ús   ¥8 ¸
AÁAc                 óh  • [        U R                  5      n/ nU R                  c  [        U R                  U5      5      nO[        U R                  5      nU R                  (       aþ  UR                  [        U R                  5      5        UR                  bÍ  U[        [        [        UUR                  5      5      -  nU(       aŸ  / nUR                  R                   Hu  nX€R                  :X  d  U R                  UR                  ;  a    OKU(       d&  UR                  S5      R                  5       (       a  M[  UR                  [        U5      5        Mw     U[        U5      -  nU R                  (       a$  UR                  [        U R                  5      5        XV-   U-   n	[        [!        U	5      5      $ )zk
Keep this method private for all users of jedi. However internally this
one is used like a public method.
ú__init__.py)rg   rb   ri   r~   rj   r   rA   rV   Úscript_pathrh   r   rN   r6   Úis_fileÚreversedrL   r1   )
rZ   r}   Úadd_parent_pathsÚadd_init_pathsÚsuffixedÚprefixedra   Ú	traversedÚparent_pathr.   s
             r$   Ú_get_sys_pathÚProject._get_sys_pathÂ   sU  € ô ˜×+Ñ+Ó,ˆØˆà�>‰>Ñ!Ü˜D×3Ñ3°OÓDÓE‰Hä˜DŸN™NÓ+ˆHà××Ø�O‰OœC §
¡
›OÔ,à×*Ñ*Ñ6ØœC¤Ô%<Ø#Ø#×/Ñ/ó&ó ñ �ö
 $ð !#�IØ'6×'BÑ'B×'JÔ'J˜Ø&¯*©*Ó4Ø#'§:¡:°[×5HÑ5HÓ#HÙ!Þ-Ø$/×$8Ñ$8¸Ó$G×$OÑ$O×$QÑ$QÙ$Ø!×(Ñ(¬¨[Ó)9Ö:ñ (Kð ¤¨Ó 3Ñ3�Hà�<�<Ø�O‰OœC §
¡
›OÔ,àÑ" XÑ-ˆÜÔ0°Ó6Ó7Ð7r)   c                 ó¶   • U R                   cA  U R                  b%  [        U R                  SS9U l         U R                   $ [        5       U l         U R                   $ )NF)Úsafe)rK   rf   r   r   ro   s    r$   Úget_environmentÚProject.get_environmentò   sX   € Ø×ÑÑ$Ø×%Ñ%Ñ1Ü$6°t×7MÑ7MÐTYÑ$Z�Ô!ð × Ñ Ð ô %CÓ$D�Ô!Ø× Ñ Ð r)   ©Ú
all_scopesc                ó    • U R                  XS9$ )aÏ  
Searches a name in the whole project. If the project is very big,
at some point Jedi will stop searching. However it's also very much
recommended to not exhaust the generator. Just display the first ten
results to the user.

There are currently three different search patterns:

- ``foo`` to search for a definition foo in any file or a file called
  ``foo.py`` or ``foo.pyi``.
- ``foo.bar`` to search for the ``foo`` and then an attribute ``bar``
  in it.
- ``class foo.bar.Bar`` or ``def foo.bar.baz`` to search for a specific
  API type.

:param bool all_scopes: Default False; searches not only for
    definitions on the top level of a module level, but also in
    functions and classes.
:yields: :class:`.Name`
r‘   ©Ú_search_func)rZ   Ústringr’   s      r$   ÚsearchÚProject.searchú   s   € ð* × Ñ  Ð Ð?Ð?r)   c                 ó,   • U R                   " U4SS0UD6$ )a=  
Like :meth:`.Script.search`, but completes that string. An empty string
lists all definitions in a project, so be careful with that.

:param bool all_scopes: Default False; searches not only for
    definitions on the top level of a module level, but also in
    functions and classes.
:yields: :class:`.Completion`
ÚcompleteTr”   )rZ   r–   r   s      r$   Úcomplete_searchÚProject.complete_search  s   € ð × Ò  ÑA°$ÐA¸&ÑAÐAr)   c              #   ób  #   • SSK Jn  U" SU S9nUR                  nUR                  5       n[        R
                  " SX5        [        U5      u  p‰U	S   n
U
S-   n[        [        [        U R                  5      5      5      n/ nU Hå  u  pïUcK  UR                  5       nUU
:X  d  UU:X  a-  UR                  S5      n [        UU5      R                  5       nOZMS  UR#                  U5        [%        UR&                  5      R(                  U
S	-   U
S
-   4;   a  [        Xo5      R                  5       nOM«  [        R
                  " SU5        [+        UUUR(                  /UU	USSS9 S h  v•N   Mç     [-        XmX¢S9 HZ  n[/        UR0                  US9nU Vs/ s H  nUR3                  U5      PM     nn[5        U5      n[+        UUUUU	USS9 S h  v•N   M\     U R7                  U5       Vs/ s H  nUU R                  :w  d  M  UPM     nn[9        [;        XgU5      5      n[+        UUUUU	USS9 S h  v•N   g ! [         a[    UR                  S5      n [        UU5      R                  5       n GN?! [         a    [!        Xn5      R                  5       n  GNff = ff = f GN9s  snf  NØs  snf  N|7f)Nr   )ÚScriptrx   )Úprojectz!Search for string %s, complete=%sz-stubsr�   z__init__.pyiz.pyz.pyizSearch of a specific module %sT)ÚnamesÚwanted_typeÚwanted_namesrš   ÚconvertÚignore_imports)rš   r‘   )r    r¡   r¢   rš   r¤   )r    r¡   r¢   rš   r£   )Újedirž   Ú_inference_stateÚ_get_module_contextr   Údbgr
   r   r   rA   rV   Úget_base_nameÚget_file_ior   Ú
as_contextÚFileNotFoundErrorr   r   r   r.   Únamer	   r   r   r"   Úcreate_nameÚ_remove_importsr‹   rg   r   )rZ   r–   rš   r’   rž   Úsr}   Úempty_module_contextr¡   r¢   r­   Ústub_folder_nameÚiosÚfile_iosÚ	folder_ioÚfile_ioÚ	file_namerF   ÚmÚmodule_contextr    Únr0   ra   s                           r$   r•   ÚProject._search_func  sÍ  é € õ 	 Ù�2˜tÑ$ˆØ×,Ñ,ˆØ ×4Ñ4Ó6Ðä�	Š	Ð5°vÔHÜ$7¸Ó$?Ñ!ˆØ˜A‰ˆØ (™?Ðä3´H¼SÀÇÁ»_Ó4MÓNˆØˆó #&ÑˆIØ‰Ø%×3Ñ3Ó5�	Ø Ó$¨	Ð5EÓ(EØ!×-Ñ-¨mÓ<�AðbÜ1°/À1ÓE×PÑPÓR™ñ à—‘ Ô(Ü˜Ÿ™Ó%×*Ñ*¨t°e©|¸TÀF¹]Ð.KÓKÜ-¨oÓG×RÑRÓT‘Aáä�IŠIÐ6¸Ô:Ü'ØØØ—v‘v�hØ'Ø)Ø!ØØ#ñ	÷ 	ò 	ñ/ #&ôF 1°Ø15ôJˆNä$ ^×%=Ñ%=È*ÑUˆEÙ<AÓBºE°q�^×/Ñ/°Ö2¹EˆEÐBÜ# EÓ*ˆEÜ'ØØØØ'Ø)Ø!Ø#ñ÷ ò ñJð" ×)Ñ)¨/Ô:ó
Ú:�!à�D—J‘J‰÷ Ñ:ð 	ð 
ô
 Ô& ÈhÓWÓXˆÜ#ØØ ØØ#Ø%ØØñ
÷ 	
ñ 	
øôe -ó bØ%×1Ñ1°.ÓA˜ðbÜ 5°oÀqÓ I× TÑ TÓ V›AøÜ0ó bÜ 8¸Ó T× _Ñ _Ó aœAðbúð	búò 	ùò Cñùò
ñ	
ùs—   ‚B8J/Â;H6ÃBJ/Å%JÅ&-J/ÆJ!Æ.J/ÇJ&ÇJ/Ç)J(ÈJ(È)J/È0J-È1J/È6JÉI/É,J/É/#JÊJÊJ/ÊJÊJÊJ/Ê!J/Ê(J/c                 óT   • SU R                   R                  < SU R                  < S3$ )NÚ<z: Ú>)Ú	__class__Ú__name__rV   ro   s    r$   Ú__repr__ÚProject.__repr__q  s   � Ø!Ÿ^™^×4Ô4°d·j´jÐAÐAr)   )rL   rK   rf   rk   rV   rj   ri   rb   )ÚreturnN)TF)FF)rÀ   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rK   Ústaticmethodr:   r=   ÚclassmethodrD   r]   rl   Úpropertyr.   ra   rc   r`   r   r~   r‹   r�   r—   r›   r(   r•   rÁ   Ú__static_attributes__r'   r)   r$   r3   r3   ;   s$  † ñð
 €Làñ2ó ð2ð ñSó ðSð ñó ðò&=ð$ Ø$ØØØñ+Hð 
õ+HðZ ñó ðð ñó ðð ñ$ó ð$ð ñ,ó ð,ñ +Ó,ñó -ðñ +Ó,ó-8ó -ð-8ò^!ð ,1õ @ò.
Bð óQ
ó ðQ
õfBr)   r3   c                 óŽ   • [          H*  n U R                  U5      R                  5       (       a    gM,     g! [         a     M<  f = f)NTF)Ú_CONTAINS_POTENTIAL_PROJECTr6   ÚexistsÚOSError)r.   r­   s     r$   Ú_is_potential_projectrÐ   u  sJ   € ß+ˆð	Ø�}‰}˜TÓ"×)Ñ)×+Ñ+Ùñ ,ñ ,ð øô ó 	Úð	ús   ‹$6¶
AÁAc                 óÌ   •  [        U R                  S5      S5       nSUR                  5       ;   sSSS5        $ ! , (       d  f       g= f! [        [        [
        4 a     gf = f)zADetects the path of the very well known Django library (if used) z	manage.pyÚrbs   DJANGO_SETTINGS_MODULENF)rB   r6   Úreadr¬   ÚIsADirectoryErrorÚPermissionError)Ú	directoryrF   s     r$   Ú_is_django_pathr×     sQ   € ðÜ�)×$Ñ$ [Ó1°4Ô8¸AØ,°·±³Ñ8÷ 9×8×8ûäÔ0´/ÐBó Ùðús+   ‚A �:°	A º
AÁA ÁA ÁA#Á"A#c                 óì  • U c  [         R                  " 5       n O [        U [        5      (       a  [        U 5      n U R	                  5       nSnSn[        U/UR                  5       H  n [        R                  U5      s  $    Ub  [        U5      $ Ub  [        U5      $ U R'                  5       (       a  U OU R(                  n[        U5      $ ! [        [        [        4 a     O[         a     MŠ  f = fUc=  UR                  S5      R                  5       (       a  M·  UR                  5       (       d  Un[!        U5      (       a  [        U5      nSUl        Us  $ Ub  Mù  [%        U5      (       d  GM  UnGM  )a-  
If a project is not defined by the user, Jedi tries to define a project by
itself as well as possible. Jedi traverses folders until it finds one of
the following:

1. A ``.jedi/config.json``
2. One of the following files: ``setup.py``, ``.git``, ``.hg``,
   ``requirements.txt`` and ``MANIFEST.in``.
Nr�   T)r   Úcwdr@   rA   re   r   rN   r3   rD   r¬   rÔ   rÕ   ÚNotADirectoryErrorr6   rÎ   rƒ   r×   rL   rÐ   Úis_dirÚparent)r.   ÚcheckÚprobable_pathÚfirst_no_init_fileÚdirrŸ   Úcurdirs          r$   Úget_default_projectrâ   ˆ  sB  € ð �|Ü�xŠx‹z‰Ü	�Dœ#×	Ñ	Ü�D‹zˆà�M‰M‹O€EØ€MØÐÜ�e�W˜eŸm™mÖ,ˆð	Ü—<‘< Ó$Ò$ñ -ð0 Ñ Ü�}Ó%Ð%àÑ%ÜÐ)Ó*Ð*à—[‘[—]‘]‰T¨¯©€FÜ�6‹?Ðøô9 "Ô#4´oÐFó 	ÙÜ!ó 	Úð	úð Ñ%Ø�|‰|˜MÓ*×1Ñ1×3Ñ3ñ Ø—[‘[—]‘]Ø%(Ð"ä˜3×ÑÜ˜c“lˆGØ"ˆGŒOØŠNàÓ Ô%:¸3×%?Ô%?Ø‹Ms   Á)CÃC0Ã#	C0Ã/C0c                 óp   • U  Vs/ s H$  nUR                   b  UR                  S;  d  M"  UPM&     sn$ s  snf )N)r   Ú	namespace)r   Úapi_type)r    rº   s     r$   r¯   r¯   ¼  s<   € áóÚˆaØ�;‰;Ñ !§*¡*Ð4KÑ"K÷ 	
‘5ñð ùò s   …!3ª3r+   ))rÇ   rC   Úpathlibr   Ú	itertoolsr   r¥   r   Újedi.api.environmentr   r   Újedi.api.exceptionsr   Újedi.api.completionr	   Újedi.api.helpersr
   r   Újedi.inference.importsr   r   r   Újedi.inference.sys_pathr   Újedi.inference.cacher   Újedi.inference.referencesr   r   Újedi.file_ior   r7   rÍ   rY   r(   r1   r3   rÐ   r×   râ   r¯   r'   r)   r$   Ú<module>rñ      s}   ðñó Ý Ý å ß SÝ ,Ý 0ß B÷0ñ 0å ;Ý Fß _Ý !à€àRð ð Ð òò"÷wBñ wBòt	òô1óhr)   