PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/hc_python/lib/python3.12/site-packages/platformdirs/__pycache__/
Upload File :
Current File : //opt/hc_python/lib/python3.12/site-packages/platformdirs/__pycache__/unix.cpython-312.pyc

�

���g�(����dZddlmZddlZddlZddlmZddlmZddl	m
Z
mZddlm
Z
e
rdd	lmZej d
k(rdd�ZnddlmZGd
�de
�Zdd�Zdd�ZdgZy)zUnix.�)�annotationsN)�ConfigParser)�Path)�
TYPE_CHECKING�NoReturn�)�PlatformDirsABC)�Iterator�win32c��d}t|��)Nzshould only be used on Unix)�RuntimeError)�msgs �@/opt/hc_python/lib/python3.12/site-packages/platformdirs/unix.py�getuidrs��+���3���)rc��eZdZdZedd��Zedd��Zedd��Zedd��Zedd��Z	edd��Z
edd��Zedd	��Zedd
��Z
edd��Zedd��Zedd
��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zdd�Zdd�Zy)�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>`.

    c���tjjdd�}|j�stjjd�}|j
|�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��selfrs  r�
user_data_dirzUnix.user_data_dir'sG���z�z�~�~�o�r�2���z�z�|��7�7�%�%�&6�7�D��0�0��6�6rc��tjjdd�}|j�sdtj�d�}|jtj�D�cgc]}|j
|���c}Scc}w)N�
XDG_DATA_DIRSrz/usr/local/sharez
/usr/share)rrrr�pathsep�splitr�r r�ps   r�_site_data_dirszUnix._site_data_dirs2sc���z�z�~�~�o�r�2���z�z�|�%�b�j�j�\��<�D�>B�j�j����>T�U�>T���1�1�!�4�>T�U�U��Us�&Bc�z�|j}|js|dStjj	|�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 �dirss  r�
site_data_dirzUnix.site_data_dir9s2���#�#���~�~���7�N��z�z���t�$�$rc���tjjdd�}|j�stjjd�}|j
|�S)z�
        :return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or
         ``$XDG_CONFIG_HOME/$appname/$version``
        �XDG_CONFIG_HOMErz	~/.configrrs  r�user_config_dirzUnix.user_config_dirFsG���z�z�~�~�/��4���z�z�|��7�7�%�%�k�2�D��0�0��6�6rc���tjjdd�}|j�sd}|j	tj
�D�cgc]}|j
|���c}Scc}w)N�XDG_CONFIG_DIRSrz/etc/xdg)rrrrr%r$rr&s   r�_site_config_dirszUnix._site_config_dirsQsW���z�z�~�~�/��4���z�z�|��D�>B�j�j����>T�U�>T���1�1�!�4�>T�U�U��Us�A/c�z�|j}|js|dStjj	|�S)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)r4r*rr$r+r,s  r�site_config_dirzUnix.site_config_dirXs2���%�%���~�~���7�N��z�z���t�$�$rc���tjjdd�}|j�stjjd�}|j
|�S)z�
        :return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or
         ``~/$XDG_CACHE_HOME/$appname/$version``
        �XDG_CACHE_HOMErz~/.cacherrs  r�user_cache_dirzUnix.user_cache_diresG���z�z�~�~�.��3���z�z�|��7�7�%�%�j�1�D��0�0��6�6rc�$�|jd�S)zO:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``z
/var/cache)r�r s r�site_cache_dirzUnix.site_cache_dirps���0�0��>�>rc���tjjdd�}|j�stjjd�}|j
|�S)z�
        :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or
         ``$XDG_STATE_HOME/$appname/$version``
        �XDG_STATE_HOMErz~/.local/staterrs  r�user_state_dirzUnix.user_state_dirusH���z�z�~�~�.��3���z�z�|��7�7�%�%�&6�7�D��0�0��6�6rc��|j}|jr1tjj	|d�}|j|�|S)zg:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it�log)r?�opinionrrr+�_optionally_create_directoryrs  r�user_log_dirzUnix.user_log_dir�s=���"�"���<�<��7�7�<�<��e�,�D��-�-�d�3��rc��tdd�S)zC:return: documents directory tied to the user, e.g. ``~/Documents``�XDG_DOCUMENTS_DIRz~/Documents��_get_user_media_dirr;s r�user_documents_dirzUnix.user_documents_dir�s��#�#6�
�F�Frc��tdd�S)zC:return: downloads directory tied to the user, e.g. ``~/Downloads``�XDG_DOWNLOAD_DIRz~/DownloadsrGr;s r�user_downloads_dirzUnix.user_downloads_dir�s��#�#5�}�E�Erc��tdd�S)zA:return: pictures directory tied to the user, e.g. ``~/Pictures``�XDG_PICTURES_DIRz
~/PicturesrGr;s r�user_pictures_dirzUnix.user_pictures_dir�s��#�#5�|�D�Drc��tdd�S)z=:return: videos directory tied to the user, e.g. ``~/Videos``�XDG_VIDEOS_DIRz~/VideosrGr;s r�user_videos_dirzUnix.user_videos_dir�s��#�#3�Z�@�@rc��tdd�S)z;:return: music directory tied to the user, e.g. ``~/Music``�
XDG_MUSIC_DIRz~/MusicrGr;s r�user_music_dirzUnix.user_music_dir�s��#�?�I�>�>rc��tdd�S)z?:return: desktop directory tied to the user, e.g. ``~/Desktop``�XDG_DESKTOP_DIRz	~/DesktoprGr;s r�user_desktop_dirzUnix.user_desktop_dir�s��#�#4�k�B�Brc�D�tjjdd�}|j�s`tj
j
d�r4dt���}t|�j�sdt���}n
dt���}|j|�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�existsrrs  r�user_runtime_dirzUnix.user_runtime_dir�s����z�z�~�~�/��4���z�z�|��|�|�&�&�'G�H�'���z�2���D�z�(�(�*�*�6�8�*�5�D�#�F�H�:�.���0�0��6�6rc���tjjdd�}|j�s$tj
j
d�rd}nd}|j|�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.
        rZrr[z/var/runz/run)rrrrr_r`rarrs  r�site_runtime_dirzUnix.site_runtime_dir�sP���z�z�~�~�/��4���z�z�|��|�|�&�&�'G�H�!�����0�0��6�6rc�8�|j|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_multipathr.r;s r�site_data_pathzUnix.site_data_path�s���4�4�T�5G�5G�H�Hrc�8�|j|j�S)zj:return: config path shared by the users, returns the first item, even if ``multipath`` is set to ``True``)rgr6r;s r�site_config_pathzUnix.site_config_path�s���4�4�T�5I�5I�J�Jrc�8�|j|j�S)zi:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``)rgr<r;s r�site_cache_pathzUnix.site_cache_path�s���4�4�T�5H�5H�I�Irc#�TK�|j��|jEd{���y7��w)z4:yield: all user and site configuration directories.N)r1r4r;s r�iter_config_dirszUnix.iter_config_dirs�s!�����"�"�"��)�)�)�)���(�&�(c#�TK�|j��|jEd{���y7��w)z+:yield: all user and site data directories.N)r!r(r;s r�iter_data_dirszUnix.iter_data_dirs�s!����� � � ��'�'�'�'�roN)�return�str)rrz	list[str])rrr)rrz
Iterator[str])�__name__�
__module__�__qualname__�__doc__�propertyr!r(r.r1r4r6r9r<r?rDrIrLrOrRrUrXrcrerhrjrlrnrq�rrrrs���
��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�*�
(rrc��t|�}|�Otjj|d�j	�}|stj
j
|�}|S)Nr)�_get_user_dirs_folderrrrrrr)�env_var�fallback_tilde_path�	media_dirs   rrHrH�sM��%�g�.�I����J�J�N�N�7�B�/�5�5�7�	�����*�*�+>�?�I��rc��tt�j�dz}|j�r�t	�}|j�5}|j
d|j����ddd�||dvry|d|jd�}|jdtjjd��Sy#1swY�XxYw)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�~)
rrr1rbr�open�read_string�readr�replacerrr)�key�user_dirs_config_path�parser�streamrs     rr{r{�s���!���!7�!7�8�;K�K���#�#�%����
"�
'�
'�
)�V����������8�9�*��f�U�m�#���e�}�S�!�'�'��,���|�|�G�R�W�W�%7�%7��%<�=�=��*�
)�s�#C�C)rrr)r|rsr}rsrrrs)r�rsrrz
str | None)rw�
__future__rrr_�configparserr�pathlibr�typingrr�apir	�collections.abcr
r`rrrHr{�__all__ryrr�<module>r�s^���"�	�
�%��*� ��(��<�<�7�� �
�N(�?�N(�b��4��r

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic