ó
    Ñ]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
  SSKJr  SSKJrJr  S	S
KJr  S	SKJr  \(       a  SSKJr  \R,                  S:X  a  SS jrOSSKJr   " S S\5      r " S S\\5      rSS jrSS jrS/rg)zUnix.é    )ÚannotationsN)ÚConfigParser)Úcached_property)ÚPath)Ú
gettempdir)ÚTYPE_CHECKINGÚNoReturné   )ÚXDGMixin)ÚPlatformDirsABC)ÚIteratorÚwin32c                 ó   • Sn [        U 5      e)Nzshould only be used on Unix)ÚRuntimeError)Úmsgs    ÚN/home/mande/repo/quber/.venv/lib/python3.13/site-packages/platformdirs/unix.pyÚgetuidr      s   € Ø+ˆÜ˜3ÓÐó    )r   c                  óH  • \ rS rSrS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#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r"S&S jr#S r$g!)'Ú_UnixDefaultsé   z–Default directories for Unix/Linux without XDG environment variable overrides.

The XDG env var handling is in :class:`~platformdirs._xdg.XDGMixin`.

c                óB   • U R                   =(       a    [        5       S:H  $ )Nr   )Úuse_site_for_rootr   ©Úselfs    r   Ú	_use_siteÚ_UnixDefaults._use_site$   s   € à×%Ñ%×7¬&«(°a©-Ð7r   c                ó^   • U R                  [        R                  R                  S5      5      $ )z|:returns: data directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or ``$XDG_DATA_HOME/$appname/$version``ú~/.local/share©Ú_append_app_name_and_versionÚosÚpathÚ
expanduserr   s    r   Úuser_data_dirÚ_UnixDefaults.user_data_dir(   ó%   € ð ×0Ñ0´·±×1CÑ1CÐDTÓ1UÓVÐVr   c                óF   • U R                  S5      U R                  S5      /$ )Nú/usr/local/shareú
/usr/share©r!   r   s    r   Ú_site_data_dirsÚ_UnixDefaults._site_data_dirs-   s%   € à×1Ñ1Ð2DÓEÀt×GhÑGhÐiuÓGvÐwÐwr   c                ó^   • U R                  [        R                  R                  S5      5      $ )z{:returns: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or ``$XDG_CONFIG_HOME/$appname/$version``ú	~/.configr    r   s    r   Úuser_config_dirÚ_UnixDefaults.user_config_dir1   s$   € ð ×0Ñ0´·±×1CÑ1CÀKÓ1PÓQÐQr   c                ó&   • U R                  S5      /$ )Nz/etc/xdgr+   r   s    r   Ú_site_config_dirsÚ_UnixDefaults._site_config_dirs6   s   € à×1Ñ1°*Ó=Ð>Ð>r   c                ó^   • U R                  [        R                  R                  S5      5      $ )zx:returns: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or ``$XDG_CACHE_HOME/$appname/$version``z~/.cacher    r   s    r   Úuser_cache_dirÚ_UnixDefaults.user_cache_dir:   s$   € ð ×0Ñ0´·±×1CÑ1CÀJÓ1OÓPÐPr   c                ó$   • U R                  S5      $ )zP:returns: cache directory shared by users, e.g. ``/var/cache/$appname/$version``z
/var/cacher+   r   s    r   Úsite_cache_dirÚ_UnixDefaults.site_cache_dir?   s   € ð ×0Ñ0°Ó>Ð>r   c                ó^   • U R                  [        R                  R                  S5      5      $ )z~:returns: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or ``$XDG_STATE_HOME/$appname/$version``z~/.local/stater    r   s    r   Úuser_state_dirÚ_UnixDefaults.user_state_dirD   r'   r   c                ó$   • U R                  S5      $ )zN:returns: state directory shared by users, e.g. ``/var/lib/$appname/$version``z/var/libr+   r   s    r   Úsite_state_dirÚ_UnixDefaults.site_state_dirI   s   € ð ×0Ñ0°Ó<Ð<r   c                ó¢   • U R                   nU R                  (       a1  [        R                  R	                  US5      nU R                  U5        U$ )zh:returns: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in itÚlog)r<   Úopinionr"   r#   ÚjoinÚ_optionally_create_directory©r   r#   s     r   Úuser_log_dirÚ_UnixDefaults.user_log_dirN   s=   € ð ×"Ñ"ˆØ�<�<Ü—7‘7—<‘<  eÓ,ˆDØ×-Ñ-¨dÔ3Øˆr   c                ó$   • U R                  S5      $ )z²:returns: log directory shared by users, e.g. ``/var/log/$appname/$version``

Unlike `user_log_dir`, ``opinion`` has no effect since ``/var/log`` is inherently a log directory.

z/var/logr+   r   s    r   Úsite_log_dirÚ_UnixDefaults.site_log_dirW   s   € ð ×0Ñ0°Ó<Ð<r   c                ó   • [        SS5      $ )zD:returns: documents directory tied to the user, e.g. ``~/Documents``ÚXDG_DOCUMENTS_DIRz~/Documents©Ú_get_user_media_dirr   s    r   Úuser_documents_dirÚ _UnixDefaults.user_documents_dir`   s   € ô #Ð#6¸ÓFÐFr   c                ó   • [        SS5      $ )zD:returns: downloads directory tied to the user, e.g. ``~/Downloads``ÚXDG_DOWNLOAD_DIRz~/DownloadsrN   r   s    r   Úuser_downloads_dirÚ _UnixDefaults.user_downloads_dire   s   € ô #Ð#5°}ÓEÐEr   c                ó   • [        SS5      $ )zB:returns: pictures directory tied to the user, e.g. ``~/Pictures``ÚXDG_PICTURES_DIRz
~/PicturesrN   r   s    r   Úuser_pictures_dirÚ_UnixDefaults.user_pictures_dirj   s   € ô #Ð#5°|ÓDÐDr   c                ó   • [        SS5      $ )z>:returns: videos directory tied to the user, e.g. ``~/Videos``ÚXDG_VIDEOS_DIRz~/VideosrN   r   s    r   Úuser_videos_dirÚ_UnixDefaults.user_videos_diro   s   € ô #Ð#3°ZÓ@Ð@r   c                ó   • [        SS5      $ )z<:returns: music directory tied to the user, e.g. ``~/Music``ÚXDG_MUSIC_DIRz~/MusicrN   r   s    r   Úuser_music_dirÚ_UnixDefaults.user_music_dirt   s   € ô # ?°IÓ>Ð>r   c                ó   • [        SS5      $ )z@:returns: desktop directory tied to the user, e.g. ``~/Desktop``ÚXDG_DESKTOP_DIRz	~/DesktoprN   r   s    r   Úuser_desktop_dirÚ_UnixDefaults.user_desktop_diry   s   € ô #Ð#4°kÓBÐBr   c                ó@   • [         R                  R                  S5      $ )z?:returns: bin directory tied to the user, e.g. ``~/.local/bin``z~/.local/bin)r"   r#   r$   r   s    r   Úuser_bin_dirÚ_UnixDefaults.user_bin_dir~   s   € ô �w‰w×!Ñ! .Ó1Ð1r   c                ó   • g)z@:returns: bin directory shared by users, e.g. ``/usr/local/bin``z/usr/local/bin© r   s    r   Úsite_bin_dirÚ_UnixDefaults.site_bin_dirƒ   s   € ð  r   c                ó|   • [         R                  R                  [         R                  R                  S5      S5      $ )zW:returns: applications directory tied to the user, e.g. ``~/.local/share/applications``r   Úapplications)r"   r#   rD   r$   r   s    r   Úuser_applications_dirÚ#_UnixDefaults.user_applications_dirˆ   s)   € ô �w‰w�|‰|œBŸG™G×.Ñ.Ð/?Ó@À.ÓQÐQr   c                ón   • S Vs/ s H#  n[         R                  R                  US5      PM%     sn$ s  snf )N)r)   r*   rn   )r"   r#   rD   )r   Úps     r   Ú_site_applications_dirsÚ%_UnixDefaults._site_applications_dirs�   s+   € á9[Ó\Ò9[°A”—‘—‘˜Q Ö/Ñ9[Ñ\Ð\ùÒ\s   …*2c                ó„   • U R                   nU R                  (       a  [        R                  R	                  U5      $ US   $ )zR:returns: applications directory shared by users, e.g. ``/usr/share/applications``r   )rs   Ú	multipathr"   ÚpathseprD   )r   Údirss     r   Úsite_applications_dirÚ#_UnixDefaults.site_applications_dir‘   s1   € ð ×+Ñ+ˆØ(,¯¯Œr�z‰z�‰˜tÓ$ÐC¸DÀ¹GÐCr   c                óˆ  • [         R                  R                  S5      (       a  S[        5        3nO?[         R                  R                  S5      (       a  S[        5        3nOS[        5        3n[        R
                  " U[        R                  5      (       d  [        5        S[        5        3nU R                  U5      $ )aX  :returns: runtime directory tied to the user, e.g. ``$XDG_RUNTIME_DIR/$appname/$version``.

If ``$XDG_RUNTIME_DIR`` is unset, tries the platform default (``/tmp/run/user/$(id -u)`` on OpenBSD, ``/var/run/user/$(id -u)`` on FreeBSD/NetBSD, ``/run/user/$(id -u)`` otherwise). If the default is not writable, falls back to a temporary directory.

Úopenbsdz/tmp/run/user/)ÚfreebsdÚnetbsdz/var/run/user/z
/run/user/z	/runtime-)	ÚsysÚplatformÚ
startswithr   r"   ÚaccessÚW_OKr   r!   rF   s     r   Úuser_runtime_dirÚ_UnixDefaults.user_runtime_dir—   s“   € ô �<‰<×"Ñ" 9×-Ñ-Ø#¤F£H :Ð.‰DÜ�\‰\×$Ñ$Ð%:×;Ñ;Ø#¤F£H :Ð.‰Dà¤£˜zÐ*ˆDÜ�yŠy˜œrŸw™w×'Ñ'Ü “l�^ 9¬V«X¨JÐ7ˆDØ×0Ñ0°Ó6Ð6r   c                óv   • [         R                  R                  S5      (       a  SnOSnU R                  U5      $ )a.  :returns: runtime directory shared by users, e.g. ``/run/$appname/$version`` or ``$XDG_RUNTIME_DIR/$appname/$version``.

Note that this behaves almost exactly like `user_runtime_dir` if ``$XDG_RUNTIME_DIR`` is set, but will fall back to paths associated to the root user instead of a regular logged-in user if it's not set.

If you wish to ensure that a logged-in root user path is returned e.g. ``/run/user/0``, use `user_runtime_dir` instead.

For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/$appname/$version`` if ``$XDG_RUNTIME_DIR`` is not set.

)r}   r|   r~   z/var/runz/run)r   r€   r�   r!   rF   s     r   Úsite_runtime_dirÚ_UnixDefaults.site_runtime_dir¨   s5   € ô �<‰<×"Ñ"Ð#C×DÑDØ‰DàˆDØ×0Ñ0°Ó6Ð6r   c                ó8   • U R                  U R                  5      $ )zi:returns: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``)Ú _first_item_as_path_if_multipathÚsite_data_dirr   s    r   Úsite_data_pathÚ_UnixDefaults.site_data_path¹   s   € ð ×4Ñ4°T×5GÑ5GÓHÐHr   c                ó8   • U R                  U R                  5      $ )zg:returns: config path shared by users, returns the first item, even if ``multipath`` is set to ``True``)rŠ   Úsite_config_dirr   s    r   Úsite_config_pathÚ_UnixDefaults.site_config_path¾   s   € ð ×4Ñ4°T×5IÑ5IÓJÐJr   c                ó8   • U R                  U R                  5      $ )zj:returns: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``)rŠ   r9   r   s    r   Úsite_cache_pathÚ_UnixDefaults.site_cache_pathÃ   s   € ð ×4Ñ4°T×5HÑ5HÓIÐIr   c              #  óv   #   • U R                   (       d  U R                  v •  U R                   Sh  v•N   g N7f)z4:yield: all user and site configuration directories.N)r   r0   r3   r   s    r   Úiter_config_dirsÚ_UnixDefaults.iter_config_dirsÈ   s'   é € à�~�~Ø×&Ñ&Ò&Ø×)Ñ)×)Ó)ùó   ‚/9±7²9c              #  óv   #   • U R                   (       d  U R                  v •  U R                   Sh  v•N   g N7f)z+:yield: all user and site data directories.N)r   r%   r,   r   s    r   Úiter_data_dirsÚ_UnixDefaults.iter_data_dirsÎ   s'   é € à�~�~Ø×$Ñ$Ò$Ø×'Ñ'×'Ó'ùr˜   rj   N)ÚreturnÚbool©rœ   Ústr)rœ   z	list[str])rœ   r   )rœ   zIterator[str])%Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Úpropertyr%   r,   r0   r3   r6   r9   r<   r?   rG   rJ   rP   rT   rX   r\   r`   rd   rg   rk   ro   rs   ry   r„   r‡   rŒ   r�   r“   r–   rš   Ú__static_attributes__rj   r   r   r   r      sM  † ñð ó8ó ð8ð óWó ðWð óxó ðxð óRó ðRð ó?ó ð?ð óQó ðQð ó?ó ð?ð óWó ðWð ó=ó ð=ð óó ðð ó=ó ð=ð óGó ðGð óFó ðFð óEó ðEð óAó ðAð ó?ó ð?ð óCó ðCð ó2ó ð2ð ó ó ð ð óRó ðRð ó]ó ð]ð óDó ðDð
 ó7ó ð7ð  ó7ó ð7ð  óIó ðIð óKó ðKð óJó ðJô*÷(r   r   c                  óð   ^ • \ rS rSrSr\SU 4S jj5       r\SU 4S jj5       r\SU 4S jj5       r\SU 4S jj5       r	\SU 4S jj5       r
\SU 4S jj5       r\SU 4S	 jj5       r\SU 4S
 jj5       rSrU =r$ )ÚUnixéÕ   aN  On Unix/Linux, we follow the `XDG Basedir Spec <https://specifications.freedesktop.org/basedir/latest/>`_.

The spec allows overriding directories with environment variables. The examples shown are the default values,
alongside the name of the environment variable that overrides them. Makes use of the `appname
<platformdirs.api.PlatformDirsABC.appname>`, `version <platformdirs.api.PlatformDirsABC.version>`, `multipath
<platformdirs.api.PlatformDirsABC.multipath>`, `opinion <platformdirs.api.PlatformDirsABC.opinion>`, `ensure_exists
<platformdirs.api.PlatformDirsABC.ensure_exists>`.

c                óR   >• U R                   (       a  U R                  $ [        TU ]  $ )zb:returns: data directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   r‹   Úsuperr%   ©r   Ú	__class__s    €r   r%   ÚUnix.user_data_dirà   s!   ø€ ð &*§^§^ˆt×!Ñ!ÐN¼¹Ñ9NÐNr   c                óR   >• U R                   (       a  U R                  $ [        TU ]  $ )zd:returns: config directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   r�   r«   r0   r¬   s    €r   r0   ÚUnix.user_config_dirå   s!   ø€ ð (,§~§~ˆt×#Ñ#ÐR¼5¹7Ñ;RÐRr   c                óR   >• U R                   (       a  U R                  $ [        TU ]  $ )zc:returns: cache directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   r9   r«   r6   r¬   s    €r   r6   ÚUnix.user_cache_dirê   ó!   ø€ ð '+§n§nˆt×"Ñ"ÐP¼%¹'Ñ:PÐPr   c                óR   >• U R                   (       a  U R                  $ [        TU ]  $ )zc:returns: state directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   r?   r«   r<   r¬   s    €r   r<   ÚUnix.user_state_dirï   r³   r   c                óR   >• U R                   (       a  U R                  $ [        TU ]  $ )za:returns: log directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   rJ   r«   rG   r¬   s    €r   rG   ÚUnix.user_log_dirô   ó!   ø€ ð %)§N§Nˆt× Ñ ÐL¼¹Ñ8LÐLr   c                óR   >• U R                   (       a  U R                  $ [        TU ]  $ )zj:returns: applications directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   ry   r«   ro   r¬   s    €r   ro   ÚUnix.user_applications_dirù   s!   ø€ ð .2¯^¯^ˆt×)Ñ)Ð^ÄÁÑA^Ð^r   c                óR   >• U R                   (       a  U R                  $ [        TU ]  $ )ze:returns: runtime directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   r‡   r«   r„   r¬   s    €r   r„   ÚUnix.user_runtime_dirþ   s!   ø€ ð )-¯¯ˆt×$Ñ$ÐT¼E¹GÑ<TÐTr   c                óR   >• U R                   (       a  U R                  $ [        TU ]  $ )za:returns: bin directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   rk   r«   rg   r¬   s    €r   rg   ÚUnix.user_bin_dir  r¸   r   rj   rž   )r    r¡   r¢   r£   r¤   r¥   r%   r0   r6   r<   rG   ro   r„   rg   r¦   Ú__classcell__)r­   s   @r   r¨   r¨   Õ   s¸   ø† ñð öOó ðOð öSó ðSð öQó ðQð öQó ðQð öMó ðMð ö_ó ð_ð öUó ðUð öMó öMr   r¨   c                óh   • [        U 5      =n(       a  U$ [        R                  R                  U5      $ )N)Ú_get_user_dirs_folderr"   r#   r$   )Úenv_varÚfallback_tilde_pathÚ	media_dirs      r   rO   rO   	  s.   € Ü)¨'Ó2Ð2€yÕ2ØÐÜ�7‰7×ÑÐ1Ó2Ð2r   c                ó<  • [         R                  R                  SS5      R                  5       =(       d    [         R                  R                  S5      n[        U5      S-  nUR                  5       (       a”  [        5       nUR                  5        nUR                  SUR                  5        35        SSS5        XS   ;  a  gUS   U    R                  S5      nUR                  S	[         R                  R                  S
5      5      $ g! , (       d  f       N^= f)znReturn directory from user-dirs.dirs config file.

See https://freedesktop.org/wiki/Software/xdg-user-dirs/.

ÚXDG_CONFIG_HOMEÚ r/   zuser-dirs.dirsz[top]
NÚtopÚ"z$HOMEÚ~)r"   ÚenvironÚgetÚstripr#   r$   r   Úexistsr   ÚopenÚread_stringÚreadÚreplace)ÚkeyÚconfig_homeÚuser_dirs_config_pathÚparserÚstreamr#   s         r   rÁ   rÁ     sà   € ô —*‘*—.‘.Ð!2°BÓ7×=Ñ=Ó?×bÄ2Ç7Á7×CUÑCUÐVaÓCb€KÜ  Ó-Ð0@Ñ@ÐØ×#Ñ#×%Ñ%Ü“ˆà"×'Ñ'Ô)¨VØ×Ñ ¨¯©«¨Ð8Ô9÷ *ð ˜U‘mÓ#Øà�e‰}˜SÑ!×'Ñ'¨Ó,ˆØ�|‰|˜G¤R§W¡W×%7Ñ%7¸Ó%<Ó=Ð=à÷ *Õ)ús   Â#DÄ
D)rœ   r	   )rÂ   rŸ   rÃ   rŸ   rœ   rŸ   )rÓ   rŸ   rœ   z
str | None)r¤   Ú
__future__r   r"   r   Úconfigparserr   Ú	functoolsr   Úpathlibr   Útempfiler   Útypingr   r	   Ú_xdgr   Úapir   Úcollections.abcr   r€   r   r   r¨   rO   rÁ   Ú__all__rj   r   r   Ú<module>râ      sx   ðÙ å "ã 	Û 
Ý %Ý %Ý Ý ß *å Ý  æÝ(à‡<�<�7Óõ õ
 ôu(�Oô u(ôp1Mˆ8�]ô 1Môh3ôð0 ð�r   