ó
    ‘Rj�'  ã                  óÒ   • S r SSKJr  SSKrSSKrSSKJr  SSKJr  SSK	J
r
  \(       a  SSKJr   " S	 S
\
5      rSS jrSS jrSS jrSS jrSS jr\" SS9" \" 5       5      rS
/rg)zWindows.é    )ÚannotationsN)Ú	lru_cache)ÚTYPE_CHECKINGé   )ÚPlatformDirsABC)ÚCallablec                  ój  • \ rS rSrSr\SS j5       rSS.SS jjr\SS j5       r\SS j5       r	\SS	 j5       r
\SS
 j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       rSrg)ÚWindowsé   aØ  
`MSDN on where to store app data files <https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid>`_.

Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`, `appauthor
<platformdirs.api.PlatformDirsABC.appauthor>`, `version <platformdirs.api.PlatformDirsABC.version>`, `roaming
<platformdirs.api.PlatformDirsABC.roaming>`, `opinion <platformdirs.api.PlatformDirsABC.opinion>`, `ensure_exists
<platformdirs.api.PlatformDirsABC.ensure_exists>`.

c                óž   • U R                   (       a  SOSn[        R                  R                  [	        U5      5      nU R                  U5      $ )z·
:return: data directory tied to the user, e.g.
 ``%USERPROFILE%\AppData\Local\$appauthor\$appname`` (not roaming) or
 ``%USERPROFILE%\AppData\Roaming\$appauthor\$appname`` (roaming)
ÚCSIDL_APPDATAÚCSIDL_LOCAL_APPDATA)ÚroamingÚosÚpathÚnormpathÚget_win_folderÚ_append_parts)ÚselfÚconstr   s      ÚLD:\diplom_project\venv\Lib\site-packages\pip/_vendor/platformdirs/windows.pyÚuser_data_dirÚWindows.user_data_dir   s<   € ð $(§<§<‘Ð5JˆÜ�w‰w×Ñ¤¨uÓ 5Ó6ˆØ×!Ñ! $Ó'Ð'ó    N©Úopinion_valuec               óæ  • / nU R                   (       a«  U R                  SLa0  U R                  =(       d    U R                   nUR                  U5        UR                  U R                   5        Ub"  U R                  (       a  UR                  U5        U R                  (       a  UR                  U R                  5        [
        R                  R                  " U/UQ76 nU R                  U5        U$ )NF)	ÚappnameÚ	appauthorÚappendÚopinionÚversionr   r   ÚjoinÚ_optionally_create_directory)r   r   r   ÚparamsÚauthors        r   r   ÚWindows._append_parts&   s¡   € ØˆØ�<�<Ø�~‰~ UÒ*ØŸ™×7¨4¯<©<�Ø—‘˜fÔ%Ø�M‰M˜$Ÿ,™,Ô'ØÑ(¨T¯\¯\Ø—‘˜mÔ,Ø�|�|Ø—‘˜dŸl™lÔ+Ü�w‰w�|Š|˜DÐ* 6Ò*ˆØ×)Ñ)¨$Ô/Øˆr   c                ót   • [         R                  R                  [        S5      5      nU R	                  U5      $ )zT:return: data directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname``ÚCSIDL_COMMON_APPDATA©r   r   r   r   r   ©r   r   s     r   Úsite_data_dirÚWindows.site_data_dir5   s/   € ô �w‰w×Ñ¤Ð/EÓ FÓGˆØ×!Ñ! $Ó'Ð'r   c                ó   • U R                   $ )zC:return: config directory tied to the user, same as `user_data_dir`©r   ©r   s    r   Úuser_config_dirÚWindows.user_config_dir;   ó   € ð ×!Ñ!Ð!r   c                ó   • U R                   $ )zF:return: config directory shared by the users, same as `site_data_dir`)r,   r0   s    r   Úsite_config_dirÚWindows.site_config_dir@   r3   r   c                ór   • [         R                  R                  [        S5      5      nU R	                  USS9$ )z¯
:return: cache directory tied to the user (if opinionated with ``Cache`` folder within ``$appname``) e.g.
 ``%USERPROFILE%\AppData\Local\$appauthor\$appname\Cache\$version``
r   ÚCacher   r*   r+   s     r   Úuser_cache_dirÚWindows.user_cache_dirE   s4   € ô �w‰w×Ñ¤Ð/DÓ EÓFˆØ×!Ñ! $°gÐ!Ð>Ð>r   c                ór   • [         R                  R                  [        S5      5      nU R	                  USS9$ )zd:return: cache directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname\Cache\$version``r)   r8   r   r*   r+   s     r   Úsite_cache_dirÚWindows.site_cache_dirN   s4   € ô �w‰w×Ñ¤Ð/EÓ FÓGˆØ×!Ñ! $°gÐ!Ð>Ð>r   c                ó   • U R                   $ )zB:return: state directory tied to the user, same as `user_data_dir`r/   r0   s    r   Úuser_state_dirÚWindows.user_state_dirT   r3   r   c                ó¢   • U R                   nU R                  (       a1  [        R                  R	                  US5      nU R                  U5        U$ )zg:return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in itÚLogs)r   r!   r   r   r#   r$   r+   s     r   Úuser_log_dirÚWindows.user_log_dirY   s=   € ð ×!Ñ!ˆØ�<�<Ü—7‘7—<‘<  fÓ-ˆDØ×-Ñ-¨dÔ3Øˆr   c                óR   • [         R                  R                  [        S5      5      $ )zN:return: documents directory tied to the user e.g. ``%USERPROFILE%\Documents``ÚCSIDL_PERSONAL©r   r   r   r   r0   s    r   Úuser_documents_dirÚWindows.user_documents_dirb   s   € ô �w‰w×Ñ¤Ð/?Ó @ÓAÐAr   c                óR   • [         R                  R                  [        S5      5      $ )zN:return: downloads directory tied to the user e.g. ``%USERPROFILE%\Downloads``ÚCSIDL_DOWNLOADSrG   r0   s    r   Úuser_downloads_dirÚWindows.user_downloads_dirg   s   € ô �w‰w×Ñ¤Ð/@Ó AÓBÐBr   c                óR   • [         R                  R                  [        S5      5      $ )zL:return: pictures directory tied to the user e.g. ``%USERPROFILE%\Pictures``ÚCSIDL_MYPICTURESrG   r0   s    r   Úuser_pictures_dirÚWindows.user_pictures_dirl   s   € ô �w‰w×Ñ¤Ð/AÓ BÓCÐCr   c                óR   • [         R                  R                  [        S5      5      $ )zH:return: videos directory tied to the user e.g. ``%USERPROFILE%\Videos``ÚCSIDL_MYVIDEOrG   r0   s    r   Úuser_videos_dirÚWindows.user_videos_dirq   ó   € ô �w‰w×Ñ¤¨Ó ?Ó@Ð@r   c                óR   • [         R                  R                  [        S5      5      $ )zF:return: music directory tied to the user e.g. ``%USERPROFILE%\Music``ÚCSIDL_MYMUSICrG   r0   s    r   Úuser_music_dirÚWindows.user_music_dirv   rV   r   c                óR   • [         R                  R                  [        S5      5      $ )zK:return: desktop directory tied to the user, e.g. ``%USERPROFILE%\Desktop``ÚCSIDL_DESKTOPDIRECTORYrG   r0   s    r   Úuser_desktop_dirÚWindows.user_desktop_dir{   s   € ô �w‰w×Ñ¤Ð/GÓ HÓIÐIr   c                ó°   • [         R                  R                  [         R                  R                  [	        S5      S5      5      nU R                  U5      $ )zm
:return: runtime directory tied to the user, e.g.
 ``%USERPROFILE%\AppData\Local\Temp\$appauthor\$appname``
r   ÚTemp)r   r   r   r#   r   r   r+   s     r   Úuser_runtime_dirÚWindows.user_runtime_dir€   s?   € ô �w‰w×Ñ¤§¡§¡¬^Ð<QÓ-RÐTZÓ [Ó\ˆØ×!Ñ! $Ó'Ð'r   c                ó   • U R                   $ )zF:return: runtime directory shared by users, same as `user_runtime_dir`)ra   r0   s    r   Úsite_runtime_dirÚWindows.site_runtime_dir‰   s   € ð ×$Ñ$Ð$r   © )ÚreturnÚstr)r   rh   r   ú
str | Nonerg   rh   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úpropertyr   r   r,   r1   r5   r9   r<   r?   rC   rH   rL   rP   rT   rY   r]   ra   rd   Ú__static_attributes__rf   r   r   r
   r
      s_  † ñð ó(ó ð(ð GK÷ ð ó(ó ð(ð
 ó"ó ð"ð ó"ó ð"ð ó?ó ð?ð ó?ó ð?ð
 ó"ó ð"ð óó ðð óBó ðBð óCó ðCð óDó ðDð óAó ðAð óAó ðAð óJó ðJð ó(ó ð(ð ó%ó ó%r   r
   c                óÚ   • [        U 5      nUb  U$ SSSS.R                  U 5      nUc  SU  3n[        U5      e[        R                  R                  U5      nUc  SU 3n[        U5      eU$ )z&Get folder from environment variables.ÚAPPDATAÚALLUSERSPROFILEÚLOCALAPPDATA)r   r)   r   úUnknown CSIDL name: zUnset environment variable: )Ú(get_win_folder_if_csidl_name_not_env_varÚgetÚ
ValueErrorr   Úenviron)Ú
csidl_nameÚresultÚenv_var_nameÚmsgs       r   Úget_win_folder_from_env_varsr~   �   s‡   € ä5°jÓA€FØÑØˆð #Ø 1Ø-ñ÷ 
�cˆ*ƒoð	 ð
 ÑØ$ Z LÐ1ˆÜ˜‹oÐÜ�Z‰Z�^‰^˜LÓ)€FØ�~Ø,¨\¨NÐ;ˆÜ˜‹oÐØ€Mr   c                óL  • U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S	5      $ U S
:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ g)zMGet a folder for a CSIDL name that does not exist as an environment variable.rF   ÚUSERPROFILEÚ	DocumentsrK   Ú	DownloadsrO   ÚPicturesrS   ÚVideosrX   ÚMusicN)r   r   r#   r   ry   )rz   s    r   rv   rv   ¤   s  € àÐ%Ó%Ü�w‰w�|‰|œBŸG™G×,Ñ,¬R¯Z©Z¸Ñ-FÓGÈÓUÐUàÐ&Ó&Ü�w‰w�|‰|œBŸG™G×,Ñ,¬R¯Z©Z¸Ñ-FÓGÈÓUÐUàÐ'Ó'Ü�w‰w�|‰|œBŸG™G×,Ñ,¬R¯Z©Z¸Ñ-FÓGÈÓTÐTà�_Ó$Ü�w‰w�|‰|œBŸG™G×,Ñ,¬R¯Z©Z¸Ñ-FÓGÈÓRÐRà�_Ó$Ü�w‰w�|‰|œBŸG™G×,Ñ,¬R¯Z©Z¸Ñ-FÓGÈÓQÐQØr   c           	     ó  • SSSSSSSSS	.R                  U 5      nUc  SU  3n[        U5      e[        R                  S:w  a  [        eSS
KnUR                  UR                  S5      nUR                  XA5      u  pV[        U5      $ )z¬
Get folder from the registry.

This is a fallback technique at best. I'm not sure if using the registry for these guarantees us the correct answer
for all CSIDL_* names.

ÚAppDatazCommon AppDatazLocal AppDataÚPersonalz&{374DE290-123F-4565-9164-39C4925E467B}zMy PictureszMy VideozMy Music)r   r)   r   rF   rK   rO   rS   rX   Nru   Úwin32r   z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)
rw   rx   ÚsysÚplatformÚNotImplementedErrorÚwinregÚOpenKeyÚHKEY_CURRENT_USERÚQueryValueExrh   )rz   Úshell_folder_namer}   r�   ÚkeyÚ	directoryÚ_s          r   Úget_win_folder_from_registryr•   ·   s—   € ð #Ø 0Ø.Ø$ØCØ)Ø#Ø#ñ	÷ 
�cˆ*ƒoð ð Ñ Ø$ Z LÐ1ˆÜ˜‹oÐÜ
‡|�|�wÓÜ!Ð!Ûà
�.‰.˜×1Ñ1Ð3vÓ
w€CØ×&Ñ& sÓ>�L€IÜˆy‹>Ðr   c           
     ó  • SSK nSSSSSSS	S
SS.	R                  U 5      nUc  SU  3n[        U5      eUR                  S5      n[	        US5      nUR
                  R                  SUSSU5        [        S U 5       5      (       a?  UR                  S5      nUR                  R                  UR                  US5      (       a  UnU S:X  a*  [        R                  R                  UR                  S5      $ UR                  $ )zGet folder with ctypes.r   Né   é#   é   é   é'   é   é   é(   r   )	r   r)   r   rF   rO   rS   rX   rK   r\   ru   i   Úwindllc              3  ó>   #   • U  H  n[        U5      S :„  v •  M     g7f)éÿ   N)Úord)Ú.0Úcs     r   Ú	<genexpr>Ú,get_win_folder_via_ctypes.<locals>.<genexpr>ñ   s   é € Ð
%¢˜AŒ3ˆq‹6�CŽ<¢ùs   ‚rK   r‚   )Úctypesrw   rx   Úcreate_unicode_bufferÚgetattrÚshell32ÚSHGetFolderPathWÚanyÚkernel32ÚGetShortPathNameWÚvaluer   r   r#   )rz   r§   Úcsidl_constr}   ÚbufrŸ   Úbuf2s          r   Úget_win_folder_via_ctypesr³   Õ   sþ   € ó ð Ø "Ø!ØØØØØØ"$ñ
÷ 
�cˆ*ƒoð ð ÑØ$ Z LÐ1ˆÜ˜‹oÐà
×
&Ñ
& tÓ
,€CÜ�V˜XÓ&€FØ
‡N�N×#Ñ# D¨+°t¸QÀÔDô Ñ
%¡Ó
%×%Ñ%Ø×+Ñ+¨DÓ1ˆØ�?‰?×,Ñ,¨S¯Y©Y¸¸d×CÑCØˆCàÐ&Ó&Ü�w‰w�|‰|˜CŸI™I {Ó3Ð3à�9‰9Ðr   c                 óž   •  SS K n [        U S5      (       a  [        $   SS Kn[
        $ ! [         a     Nf = f! [         a	    [        s $ f = f)Nr   rŸ   )r§   Úhasattrr³   ÚImportErrorr�   r•   r~   )r§   r�   s     r   Ú_pick_get_win_folderr·   ü   s^   € ð-Ûô �6˜8×$Ñ$Ü,Ð,ð %ð,Ûô ,Ð+øô ó Ùðûô ó ,Ü+Ò+ð,ús   ‚) Ÿ9 ©
6µ6¹AÁA)Úmaxsize)rz   rh   rg   rh   )rz   rh   rg   ri   )rg   zCallable[[str], str])rn   Ú
__future__r   r   rŠ   Ú	functoolsr   Útypingr   Úapir   Úcollections.abcr   r
   r~   rv   r•   r³   r·   r   Ú__all__rf   r   r   Ú<module>r¿      sj   ðÙ å "ã 	Û 
Ý Ý  å  æÝ(ô|%ˆoô |%ô~ô*ô&ô<$ôN,ñ   4Ò(Ñ)=Ó)?Ó@€ð ð�r   