HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/platformdirs/__pycache__/unix.cpython-310.pyc
o

j�h�(�@s�dZddlmZddlZddlZddlmZddlmZddl	m
Z
mZddlm
Z
e
r2dd	lmZejd
kr=dd
d�ZnddlmZGdd�de
�Zddd�Zddd�ZdgZdS)zUnix.�)�annotationsN)�ConfigParser)�Path)�
TYPE_CHECKING�NoReturn�)�PlatformDirsABC)�Iterator�win32�returnrcCsd}t|��)Nzshould only be used on Unix)�RuntimeError)�msg�r�</usr/local/lib/python3.10/dist-packages/platformdirs/unix.py�getuidsr)rc@sJeZdZdZed6dd��Zed7dd��Zed6d	d
��Zed6dd��Zed7d
d��Z	ed6dd��Z
ed6dd��Zed6dd��Zed6dd��Z
ed6dd��Zed6dd��Zed6dd��Zed6dd��Zed6dd ��Zed6d!d"��Zed6d#d$��Zed6d%d&��Zed6d'd(��Zed8d*d+��Zed8d,d-��Zed8d.d/��Zd9d1d2�Zd9d3d4�Zd5S):�Unixa�
    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>`.

    r�strcC�,tj�dd�}|��stj�d�}|�|�S)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��selfrrrr�
user_data_dir'�
zUnix.user_data_dir�	list[str]cs>tj�dd�}|��sdtj�d�}�fdd�|�tj�D�S)N�
XDG_DATA_DIRSrz/usr/local/sharez
/usr/sharec�g|]}��|��qSr�r��.0�p�rrr�
<listcomp>7�z(Unix._site_data_dirs.<locals>.<listcomp>)rrrr�pathsep�splitrrr)r�_site_data_dirs2szUnix._site_data_dirscC� |j}|js
|dStj�|�S)aZ
        :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.�	multipathrr,�join�r�dirsrrr�
site_data_dir9�zUnix.site_data_dircCr)z�
        :return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or
         ``$XDG_CONFIG_HOME/$appname/$version``
        �XDG_CONFIG_HOMErz	~/.configrrrrr�user_config_dirFr!zUnix.user_config_dircs4tj�dd�}|��s
d}�fdd�|�tj�D�S)N�XDG_CONFIG_DIRSrz/etc/xdgcr$rr%r&r)rrr*Vr+z*Unix._site_config_dirs.<locals>.<listcomp>)rrrrr-r,rrr)r�_site_config_dirsQszUnix._site_config_dirscCr/)a2
        :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)r9r0rr,r1r2rrr�site_config_dirXr5zUnix.site_config_dircCr)z�
        :return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or
         ``~/$XDG_CACHE_HOME/$appname/$version``
        �XDG_CACHE_HOMErz~/.cacherrrrr�user_cache_direr!zUnix.user_cache_dircCs
|�d�S)zO:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``z
/var/cacher%r)rrr�site_cache_dirp�
zUnix.site_cache_dircCr)z�
        :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or
         ``$XDG_STATE_HOME/$appname/$version``
        �XDG_STATE_HOMErz~/.local/staterrrrr�user_state_dirur!zUnix.user_state_dircCs(|j}|jrtj�|d�}|�|�|S)zg:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it�log)r@�opinionrrr1�_optionally_create_directoryrrrr�user_log_dir�s

zUnix.user_log_dircC�
tdd�S)zC:return: documents directory tied to the user, e.g. ``~/Documents``�XDG_DOCUMENTS_DIRz~/Documents��_get_user_media_dirr)rrr�user_documents_dir�r>zUnix.user_documents_dircCrE)zC:return: downloads directory tied to the user, e.g. ``~/Downloads``�XDG_DOWNLOAD_DIRz~/DownloadsrGr)rrr�user_downloads_dir�r>zUnix.user_downloads_dircCrE)zA:return: pictures directory tied to the user, e.g. ``~/Pictures``�XDG_PICTURES_DIRz
~/PicturesrGr)rrr�user_pictures_dir�r>zUnix.user_pictures_dircCrE)z=:return: videos directory tied to the user, e.g. ``~/Videos``�XDG_VIDEOS_DIRz~/VideosrGr)rrr�user_videos_dir�r>zUnix.user_videos_dircCrE)z;:return: music directory tied to the user, e.g. ``~/Music``�
XDG_MUSIC_DIRz~/MusicrGr)rrr�user_music_dir�r>zUnix.user_music_dircCrE)z?:return: desktop directory tied to the user, e.g. ``~/Desktop``�XDG_DESKTOP_DIRz	~/DesktoprGr)rrr�user_desktop_dir�r>zUnix.user_desktop_dircCs^tj�dd�}|��s*tj�d�r$dt���}t|��	�s#dt���}ndt���}|�
|�S)az
        :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/)rrrr�sys�platform�
startswithrr�existsrrrrr�user_runtime_dir�s
�
zUnix.user_runtime_dircCs6tj�dd�}|��stj�d�rd}nd}|�|�S)am
        :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.
        rTrrUz/var/runz/run)rrrrrYrZr[rrrrr�site_runtime_dir�s
zUnix.site_runtime_dirrcC�|�|j�S)zh:return: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``)� _first_item_as_path_if_multipathr4r)rrr�site_data_path��zUnix.site_data_pathcCr_)zj:return: config path shared by the users, returns the first item, even if ``multipath`` is set to ``True``)r`r:r)rrr�site_config_path�rbzUnix.site_config_pathcCr_)zi:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``)r`r=r)rrr�site_cache_path�rbzUnix.site_cache_path�
Iterator[str]cc��|jV|jEdHdS)z4:yield: all user and site configuration directories.N)r7r9r)rrr�iter_config_dirs���zUnix.iter_config_dirsccrf)z+:yield: all user and site data directories.N)r r.r)rrr�iter_data_dirs�rhzUnix.iter_data_dirsN)rr)rr")rr)rre)�__name__�
__module__�__qualname__�__doc__�propertyr r.r4r7r9r:r<r=r@rDrIrKrMrOrQrSr]r^rarcrdrgrirrrrrs\




r�env_varr�fallback_tilde_pathcCs6t|�}|durtj�|d���}|stj�|�}|S)Nr)�_get_user_dirs_folderrrrrrr)rorp�	media_dirrrrrH�srH�key�
str | NonecCs�tt�j�d}|��rHt�}|���}|�d|�����Wd�n1s(wY||dvr5dS|d|�d�}|�	dt
j�d��SdS)z{
    Return directory from user-dirs.dirs config file.

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

    zuser-dirs.dirsz[top]
N�top�"z$HOME�~)
rrr7r\r�open�read_string�readr�replacerrr)rs�user_dirs_config_path�parser�streamrrrrrq�s
�rq)rr)rorrprrr)rsrrrt)rm�
__future__rrrY�configparserr�pathlibr�typingrr�apir�collections.abcr	rZrrrHrq�__all__rrrr�<module>s&

R

�