
    q"h(                        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
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 jrSS jrS/rg)zUnix.    )annotationsN)ConfigParser)Path)TYPE_CHECKINGNoReturn   )PlatformDirsABC)Iteratorwin32c                     Sn [        U 5      e)Nzshould only be used on Unix)RuntimeError)msgs    O/var/www/html/env/lib/python3.13/site-packages/pip/_vendor/platformdirs/unix.pygetuidr      s    +3    )r   c                     \ 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rSS jrSrg) Unix   af  
On Unix/Linux, we follow the `XDG Basedir Spec <https://specifications.freedesktop.org/basedir-spec/basedir-spec-
latest.html>`_.

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                  R                  SS5      nUR                  5       (       d  [         R                  R                  S5      nU R                  U5      $ )z~
:return: data directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or
 ``$XDG_DATA_HOME/$appname/$version``
XDG_DATA_HOME z~/.local/shareosenvirongetstrippath
expanduser_append_app_name_and_versionselfr   s     r   user_data_dirUnix.user_data_dir'   sI     zz~~or2zz||77%%&67D0066r   c                   [         R                  R                  SS5      nUR                  5       (       d  S[         R                   S3nUR                  [         R                  5       Vs/ s H  o R                  U5      PM     sn$ s  snf )NXDG_DATA_DIRSr   z/usr/local/sharez
/usr/share)r   r   r   r   pathsepsplitr   r!   r   ps      r   _site_data_dirsUnix._site_data_dirs2   sc    zz~~or2zz||%bjj\<D>Bjj>TU>T11!4>TUUUs   +Bc                    U R                   nU R                  (       d  US   $ [        R                  R	                  U5      $ )a:  
:return: data directories shared by users (if `multipath <platformdirs.api.PlatformDirsABC.multipath>` is
 enabled and ``XDG_DATA_DIRS`` is set and a multi path the response is also a multi path separated by the
 OS path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version``
r   )r*   	multipathr   r&   joinr!   dirss     r   site_data_dirUnix.site_data_dir9   s2     ##~~7Nzzt$$r   c                    [         R                  R                  SS5      nUR                  5       (       d  [         R                  R                  S5      nU R                  U5      $ )z}
:return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or
 ``$XDG_CONFIG_HOME/$appname/$version``
XDG_CONFIG_HOMEr   z	~/.configr   r    s     r   user_config_dirUnix.user_config_dirF   sI     zz~~/4zz||77%%k2D0066r   c                    [         R                  R                  SS5      nUR                  5       (       d  SnUR	                  [         R
                  5       Vs/ s H  o R                  U5      PM     sn$ s  snf )NXDG_CONFIG_DIRSr   z/etc/xdg)r   r   r   r   r'   r&   r   r(   s      r   _site_config_dirsUnix._site_config_dirsQ   sW    zz~~/4zz||D>Bjj>TU>T11!4>TUUUs   A6c                    U R                   nU R                  (       d  US   $ [        R                  R	                  U5      $ )a  
:return: config directories shared by users (if `multipath <platformdirs.api.PlatformDirsABC.multipath>`
 is enabled and ``XDG_CONFIG_DIRS`` is set and a multi path the response is also a multi path separated by
 the OS path separator), e.g. ``/etc/xdg/$appname/$version``
r   )r9   r-   r   r&   r.   r/   s     r   site_config_dirUnix.site_config_dirX   s2     %%~~7Nzzt$$r   c                    [         R                  R                  SS5      nUR                  5       (       d  [         R                  R                  S5      nU R                  U5      $ )z|
:return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or
 ``~/$XDG_CACHE_HOME/$appname/$version``
XDG_CACHE_HOMEr   z~/.cacher   r    s     r   user_cache_dirUnix.user_cache_dire   sI     zz~~.3zz||77%%j1D0066r   c                $    U R                  S5      $ )zO:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``z
/var/cache)r   r!   s    r   site_cache_dirUnix.site_cache_dirp   s     00>>r   c                    [         R                  R                  SS5      nUR                  5       (       d  [         R                  R                  S5      nU R                  U5      $ )z
:return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or
 ``$XDG_STATE_HOME/$appname/$version``
XDG_STATE_HOMEr   z~/.local/stater   r    s     r   user_state_dirUnix.user_state_diru   sJ     zz~~.3zz||77%%&67D0066r   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_state_dir` if not opinionated else ``log`` in itlog)rH   opinionr   r   r.   _optionally_create_directoryr    s     r   user_log_dirUnix.user_log_dir   s=     ""<<77<<e,D--d3r   c                    [        SS5      $ )zC:return: documents directory tied to the user, e.g. ``~/Documents``XDG_DOCUMENTS_DIRz~/Documents_get_user_media_dirrC   s    r   user_documents_dirUnix.user_documents_dir   s     ##6FFr   c                    [        SS5      $ )zC:return: downloads directory tied to the user, e.g. ``~/Downloads``XDG_DOWNLOAD_DIRz~/DownloadsrR   rC   s    r   user_downloads_dirUnix.user_downloads_dir   s     ##5}EEr   c                    [        SS5      $ )zA:return: pictures directory tied to the user, e.g. ``~/Pictures``XDG_PICTURES_DIRz
~/PicturesrR   rC   s    r   user_pictures_dirUnix.user_pictures_dir   s     ##5|DDr   c                    [        SS5      $ )z=:return: videos directory tied to the user, e.g. ``~/Videos``XDG_VIDEOS_DIRz~/VideosrR   rC   s    r   user_videos_dirUnix.user_videos_dir   s     ##3Z@@r   c                    [        SS5      $ )z;:return: music directory tied to the user, e.g. ``~/Music``XDG_MUSIC_DIRz~/MusicrR   rC   s    r   user_music_dirUnix.user_music_dir   s     #?I>>r   c                    [        SS5      $ )z?:return: desktop directory tied to the user, e.g. ``~/Desktop``XDG_DESKTOP_DIRz	~/DesktoprR   rC   s    r   user_desktop_dirUnix.user_desktop_dir   s     ##4kBBr   c                b   [         R                  R                  SS5      nUR                  5       (       dj  [        R
                  R                  S5      (       a9  S[        5        3n[        U5      R                  5       (       d  S[        5        3nOS[        5        3nU R                  U5      $ )aJ  
:return: runtime directory tied to the user, e.g. ``/run/user/$(id -u)/$appname/$version`` or
 ``$XDG_RUNTIME_DIR/$appname/$version``.

 For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/user/$(id -u)/$appname/$version`` if
 exists, otherwise ``/tmp/runtime-$(id -u)/$appname/$version``, if``$XDG_RUNTIME_DIR``
 is not set.
XDG_RUNTIME_DIRr   freebsdopenbsdnetbsdz/var/run/user/z/tmp/runtime-z
/run/user/)r   r   r   r   sysplatform
startswithr   r   existsr   r    s     r   user_runtime_dirUnix.user_runtime_dir   s     zz~~/4zz||||&&'GHH'z2Dz((***68*5D#FH:.0066r   c                    [         R                  R                  SS5      nUR                  5       (       d)  [        R
                  R                  S5      (       a  SnOSnU R                  U5      $ )a5  
:return: 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.
rk   r   rl   z/var/runz/run)r   r   r   r   rp   rq   rr   r   r    s     r   site_runtime_dirUnix.site_runtime_dir   sU     zz~~/4zz||||&&'GHH!0066r   c                8    U R                  U R                  5      $ )zh:return: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``) _first_item_as_path_if_multipathr1   rC   s    r   site_data_pathUnix.site_data_path   s     44T5G5GHHr   c                8    U R                  U R                  5      $ )zj:return: config path shared by the users, returns the first item, even if ``multipath`` is set to ``True``)rz   r<   rC   s    r   site_config_pathUnix.site_config_path   s     44T5I5IJJr   c                8    U R                  U R                  5      $ )zi:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``)rz   rD   rC   s    r   site_cache_pathUnix.site_cache_path   s     44T5H5HIIr   c              #  T   #    U R                   v   U R                   Sh  vN   g N7f)z4:yield: all user and site configuration directories.N)r5   r9   rC   s    r   iter_config_dirsUnix.iter_config_dirs   s      """))))   (&(c              #  T   #    U R                   v   U R                   Sh  vN   g N7f)z+:yield: all user and site data directories.N)r"   r*   rC   s    r   iter_data_dirsUnix.iter_data_dirs   s         ''''r    N)returnstr)r   z	list[str])r   r   )r   zIterator[str])__name__
__module____qualname____firstlineno____doc__propertyr"   r*   r1   r5   r9   r<   r@   rD   rH   rN   rT   rX   r\   r`   rd   rh   rt   rw   r{   r~   r   r   r   __static_attributes__r   r   r   r   r      s   
 7 7 V V 
% 
% 7 7 V V 
% 
% 7 7 ? ? 7 7   G G F F E E A A ? ? C C 7 7& 7 7* I I K K J J*
(r   r   c                    [        U 5      nUcT  [        R                  R                  U S5      R	                  5       nU(       d  [        R
                  R                  U5      nU$ )Nr   )_get_user_dirs_folderr   r   r   r   r   r   )env_varfallback_tilde_path	media_dirs      r   rS   rS      sM    %g.IJJNN7B/557	**+>?Ir   c                   [        [        5       R                  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)zo
Return directory from user-dirs.dirs config file.

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

zuser-dirs.dirsz[top]
Ntop"z$HOME~)r   r   r5   rs   r   openread_stringreadr   replacer   r   r   )keyuser_dirs_config_pathparserstreamr   s        r   r   r      s     !!7!78;KK##%%"'')V89 * Um#e}S!'',||GRWW%7%7%<== *)s   #C
C)r   r   )r   r   r   r   r   r   )r   r   r   z
str | None)r   
__future__r   r   rp   configparserr   pathlibr   typingr   r   apir	   collections.abcr
   rq   r   r   rS   r   __all__r   r   r   <module>r      s^     " 	 
 %  *  (<<7 
 N(? N(b4 r   