Ë
    hKêjNQ  ã                  óÖ  — U d Z ddlmZ ddlZddlZddlZddlZddlZddlm	Z	 ddl
mZ ddlmZ ddlmZmZmZ dd	lmZmZmZ dd
lmZmZ erddlmZ ej6                  dk(  rd#d„Zn	 ddlmZ  G d„ de«      Z G d„ dee«      Z  ejB                  dejD                  «      Z#de$d<   d$d„Z%d%d„Z&d&d„Z'ddœd'd„Z(d(d„Z)d)d„Z* e+«       Z,de$d <   d!Z-de$d"<   dgZ.y# e$ r	 ddlmZ Y Œxw xY w)*zUnix.é    )ÚannotationsN)Úsuppress)ÚPath)Ú
gettempdir)ÚTYPE_CHECKINGÚFinalÚNoReturné   )ÚXDGMixinÚ_expand_userÚ_xdg_dir)ÚPlatformDirsABCÚRuntimeDirWarning)ÚIteratorÚwin32c                 ó   — d} t        | «      ‚)Nzshould only be used on Unix)ÚRuntimeError)Úmsgs    úV/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/platformdirs/unix.pyÚgeteuidr      s   € Ø+ˆÜ˜3ÓÐó    )r   )Úgetuidc                  ó  — e Zd ZdZed!d„«       Zed"d„«       Zed#d„«       Zed"d„«       Zed#d„«       Z	ed"d„«       Z
ed"d„«       Zed"d	„«       Zed"d
„«       Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Zd$d„Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Zed#d„«       Zd"d„Z d"d„Z!ed"d„«       Z"y )%Ú_UnixDefaultszžDefault directories for Unix/Linux without XDG environment variable overrides.

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

    c                ó8   — | j                   xr t        «       dk(  S )Nr   )Úuse_site_for_rootr   ©Úselfs    r   Ú	_use_sitez_UnixDefaults._use_site)   s   € à×%Ñ%Ò8¬'«)°q©.Ð8r   c                ó:   — | j                  t        d«      d¬«      S )zsData directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or ``$XDG_DATA_HOME/$appname/$version``.ú~/.local/shareT©Úprivate©Ú_append_app_name_and_versionr   r   s    r   Úuser_data_dirz_UnixDefaults.user_data_dir-   ó!   € ð ×0Ñ0´Ð>NÓ1OÐY]Ð0Ó^Ð^r   c                óF   — | j                  d«      | j                  d«      gS )Nú/usr/local/shareú
/usr/share©Ú_join_app_name_and_versionr   s    r   Ú_site_data_dirsz_UnixDefaults._site_data_dirs2   s%   € à×/Ñ/Ð0BÓCÀT×EdÑEdÐeqÓErÐsÐsr   c                ó:   — | j                  t        d«      d¬«      S )zrConfig directory tied to the user, e.g. ``~/.config/$appname/$version`` or ``$XDG_CONFIG_HOME/$appname/$version``.ú	~/.configTr"   r$   r   s    r   Úuser_config_dirz_UnixDefaults.user_config_dir6   s    € ð ×0Ñ0´¸kÓ1JÐTXÐ0ÓYÐYr   c                ó&   — | j                  d«      gS )Nz/etc/xdgr+   r   s    r   Ú_site_config_dirsz_UnixDefaults._site_config_dirs;   s   € à×/Ñ/°
Ó;Ð<Ð<r   c                ó:   — | j                  t        d«      d¬«      S )zoCache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or ``$XDG_CACHE_HOME/$appname/$version``.z~/.cacheTr"   r$   r   s    r   Úuser_cache_dirz_UnixDefaults.user_cache_dir?   s    € ð ×0Ñ0´¸jÓ1IÐSWÐ0ÓXÐXr   c                ó(   — | j                  dd¬«      S )zGCache directory shared by users, e.g. ``/var/cache/$appname/$version``.z
/var/cacheFr"   ©r%   r   s    r   Úsite_cache_dirz_UnixDefaults.site_cache_dirD   s   € ð ×0Ñ0°ÀuÐ0ÓMÐMr   c                ó:   — | j                  t        d«      d¬«      S )zuState directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or ``$XDG_STATE_HOME/$appname/$version``.z~/.local/stateTr"   r$   r   s    r   Úuser_state_dirz_UnixDefaults.user_state_dirI   r'   r   c                ó(   — | j                  dd¬«      S )zEState directory shared by users, e.g. ``/var/lib/$appname/$version``.z/var/libFr"   r6   r   s    r   Úsite_state_dirz_UnixDefaults.site_state_dirN   s   € ð ×0Ñ0°ÀUÐ0ÓKÐKr   c                óœ   — | j                   }| j                  r3t        j                  j	                  |d«      }| j                  |d¬«       |S )z_Log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it.ÚlogTr"   )r9   ÚopinionÚosÚpathÚjoinÚ_optionally_create_directory©r   r@   s     r   Úuser_log_dirz_UnixDefaults.user_log_dirS   sB   € ð ×"Ñ"ˆØ�<Š<Ü—7‘7—<‘<  eÓ,ˆDØ×-Ñ-¨d¸DÐ-ÔAØˆr   c                ó(   — | j                  dd¬«      S )z¹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/logFr"   r6   r   s    r   Úsite_log_dirz_UnixDefaults.site_log_dir\   s   € ð ×0Ñ0°ÀUÐ0ÓKÐKr   c                ó&   — | j                  dd«      S )z;Documents directory tied to the user, e.g. ``~/Documents``.ÚXDG_DOCUMENTS_DIRz~/Documents©Ú_user_media_dirr   s    r   Úuser_documents_dirz _UnixDefaults.user_documents_dire   ó   € ð ×#Ñ#Ð$7¸ÓGÐGr   c                ó&   — | j                  dd«      S )z;Downloads directory tied to the user, e.g. ``~/Downloads``.ÚXDG_DOWNLOAD_DIRz~/DownloadsrI   r   s    r   Úuser_downloads_dirz _UnixDefaults.user_downloads_dirj   s   € ð ×#Ñ#Ð$6¸ÓFÐFr   c                ó&   — | j                  dd«      S )z9Pictures directory tied to the user, e.g. ``~/Pictures``.ÚXDG_PICTURES_DIRz
~/PicturesrI   r   s    r   Úuser_pictures_dirz_UnixDefaults.user_pictures_diro   ó   € ð ×#Ñ#Ð$6¸ÓEÐEr   c                ó&   — | j                  dd«      S )z5Videos directory tied to the user, e.g. ``~/Videos``.ÚXDG_VIDEOS_DIRz~/VideosrI   r   s    r   Úuser_videos_dirz_UnixDefaults.user_videos_dirt   s   € ð ×#Ñ#Ð$4°jÓAÐAr   c                ó&   — | j                  dd«      S )z3Music directory tied to the user, e.g. ``~/Music``.ÚXDG_MUSIC_DIRz~/MusicrI   r   s    r   Úuser_music_dirz_UnixDefaults.user_music_diry   s   € ð ×#Ñ# O°YÓ?Ð?r   c                ó&   — | j                  dd«      S )z7Desktop directory tied to the user, e.g. ``~/Desktop``.ÚXDG_DESKTOP_DIRz	~/DesktoprI   r   s    r   Úuser_desktop_dirz_UnixDefaults.user_desktop_dir~   s   € ð ×#Ñ#Ð$5°{ÓCÐCr   c                ó&   — | j                  dd«      S )z9Projects directory tied to the user, e.g. ``~/Projects``.ÚXDG_PROJECTS_DIRz
~/ProjectsrI   r   s    r   Úuser_projects_dirz_UnixDefaults.user_projects_dirƒ   rS   r   c                ó&   — | j                  dd«      S )z;Public share directory tied to the user, e.g. ``~/Public``.ÚXDG_PUBLICSHARE_DIRz~/PublicrI   r   s    r   Úuser_publicshare_dirz"_UnixDefaults.user_publicshare_dirˆ   s   € ð ×#Ñ#Ð$9¸:ÓFÐFr   c                ó&   — | j                  dd«      S )z;Templates directory tied to the user, e.g. ``~/Templates``.ÚXDG_TEMPLATES_DIRz~/TemplatesrI   r   s    r   Úuser_templates_dirz _UnixDefaults.user_templates_dir�   rL   r   c                óX   — t        |«      x}r| j                  |«       |S t        |«      S ©N)Ú_get_user_dirs_folderÚ"_optionally_create_media_directoryr   )r   ÚkeyÚdefaultr@   s       r   rJ   z_UnixDefaults._user_media_dir’   s0   € Ü(¨Ó-Ð-ˆ4Ð-Ø×3Ñ3°DÔ9ØˆKÜ˜GÓ$Ð$r   c                ó   — t        d«      › d�S )z@Fonts directory tied to the user, e.g. ``~/.local/share/fonts``.r!   z/fonts©r   r   s    r   Úuser_fonts_dirz_UnixDefaults.user_fonts_dir˜   s   € ô Ð/Ó0Ð1°Ð8Ð8r   c                ó   — | j                   S )zCPreference directory tied to the user, same as ``user_config_dir``.)r0   r   s    r   Úuser_preference_dirz!_UnixDefaults.user_preference_dir�   s   € ð ×#Ñ#Ð#r   c                ó   — t        d«      S )z6Bin directory tied to the user, e.g. ``~/.local/bin``.z~/.local/binrm   r   s    r   Úuser_bin_dirz_UnixDefaults.user_bin_dir¢   s   € ô ˜NÓ+Ð+r   c                 ó   — y)z7Bin directory shared by users, e.g. ``/usr/local/bin``.z/usr/local/bin© r   s    r   Úsite_bin_dirz_UnixDefaults.site_bin_dir§   s   € ð  r   c                ó>   — t        d«      › t        j                  › d�S )zNApplications directory tied to the user, e.g. ``~/.local/share/applications``.r!   Úapplications)r   r?   Úsepr   s    r   Úuser_applications_dirz#_UnixDefaults.user_applications_dir¬   s    € ô Ð/Ó0Ð1´"·&±&°¸ÐFÐFr   c                óh   — dD �cg c]"  }t         j                  j                  |d«      ‘Œ$ c}S c c}w )N)r)   r*   rw   )r?   r@   rA   )r   Úps     r   Ú_site_applications_dirsz%_UnixDefaults._site_applications_dirs±   s%   € à9[Ö\°A”—‘—‘˜Q Õ/Ò\Ð\ùÒ\s   …'/c                ó  — t         j                  j                  d«      rdt        «       › �}n:t         j                  j                  d«      rdt        «       › �}ndt        «       › �}t	        |d¬«      r| j                  «       S |S )NÚopenbsdz/tmp/run/user/)ÚfreebsdÚnetbsdz/var/run/user/z
/run/user/F©Ú
missing_ok)ÚsysÚplatformÚ
startswithr   Ú_runtime_dir_problemÚ_temp_runtime_dirrC   s     r   Ú_default_runtime_dirz"_UnixDefaults._default_runtime_dirµ   sp   € Ü�<‰<×"Ñ" 9Ô-Ø#¤G£I ;Ð/‰DÜ�\‰\×$Ñ$Ð%:Ô;Ø#¤G£I ;Ð/‰Dà¤£	˜{Ð+ˆDÜ+?ÀÐQVÕ+Wˆt×%Ñ%Ó'ÐaÐ]aÐar   c                óN  — t        «       › dt        «       › �}t        t        «      5  | j	                  |d¬«       d d d «       t        || j                   d¬«      x}rd|› d�}t        |«      ‚| j                  rt        |«      j                  t        «       |S # 1 sw Y   ŒaxY w)Nú	/runtime-Tr"   F©r‚   Ú
check_modezruntime directory z; set XDG_RUNTIME_DIR instead)r   r   r   ÚFileExistsErrorrB   r†   Úensure_existsÚPermissionErrorr   ÚchmodÚ_RUNTIME_DIR_MODE)r   r@   Úproblemr   s       r   r‡   z_UnixDefaults._temp_runtime_dir¾   s£   € ä“,�˜y¬«¨Ð4ˆÜ”oÓ&ñ 	BØ×-Ñ-¨d¸DÐ-ÔA÷	Bä*¨4À×@RÑ@RÐ<RÐ_dÔeÐeˆ7ÐeØ& w iÐ/LÐMˆCÜ! #Ó&Ð&à×ÒÜ�‹J×ÑÔ.Ô/Øˆ÷	Bð 	Bús   §BÂB$c                óp   — t         j                  j                  d«      rd}nd}| j                  |d¬«      S )aT  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/runFr"   )rƒ   r„   r…   r%   rC   s     r   Úsite_runtime_dirz_UnixDefaults.site_runtime_dirË   s7   € ô �<‰<×"Ñ"Ð#CÔDØ‰DàˆDØ×0Ñ0°¸uÐ0ÓEÐEr   N)ÚreturnÚbool©r•   Ústr)r•   z	list[str]©rj   r˜   rk   r˜   r•   r˜   )#Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   r&   r-   r0   r2   r4   r7   r9   r;   rD   rF   rK   rO   rR   rV   rY   r\   r_   rb   re   rJ   rn   rp   rr   ru   ry   r|   rˆ   r‡   r”   rt   r   r   r   r   "   s[  „ ñð ò9ó ð9ð ò_ó ð_ð òtó ðtð òZó ðZð ò=ó ð=ð òYó ðYð òNó ðNð ò_ó ð_ð òLó ðLð òó ðð òLó ðLð òHó ðHð òGó ðGð òFó ðFð òBó ðBð ò@ó ð@ð òDó ðDð òFó ðFð òGó ðGð òHó ðHó%ð ò9ó ð9ð ò$ó ð$ð ò,ó ð,ð ò ó ð ð òGó ðGð ò]ó ð]óbóð òFó ñFr   r   c                  ób  ‡ — e Zd ZdZedˆ fd„«       Zedˆ fd„«       Zedˆ fd„«       Zedˆ fd„«       Zedˆ fd„«       Z	edˆ fd„«       Z
edˆ fd„«       Zdd	„Zdˆ fd
„Zedˆ fd„«       Zedˆ fd„«       Zdˆ fd„Zdˆ fd„Zedˆ fd„«       Zedˆ fd„«       Zedˆ fd„«       Zedˆ fd„«       Zˆ xZS )ÚUnixaf  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                óH   •— | j                   r| j                  S t        ‰| �  S )zYData directory tied to the user, or site equivalent when root with ``use_site_for_root``.)r   Úsite_data_dirÚsuperr&   ©r   Ú	__class__s    €r   r&   zUnix.user_data_dirê   s!   ø€ ð &*§^¢^ˆt×!Ñ!ÐN¼¹Ñ9NÐNr   c                óH   •— | j                   r| j                  S t        ‰| �  S )z[Config directory tied to the user, or site equivalent when root with ``use_site_for_root``.)r   Úsite_config_dirr£   r0   r¤   s    €r   r0   zUnix.user_config_dirï   s!   ø€ ð (,§~¢~ˆt×#Ñ#ÐR¼5¹7Ñ;RÐRr   c                óH   •— | j                   r| j                  S t        ‰| �  S )zZCache directory tied to the user, or site equivalent when root with ``use_site_for_root``.)r   r7   r£   r4   r¤   s    €r   r4   zUnix.user_cache_dirô   ó!   ø€ ð '+§n¢nˆt×"Ñ"ÐP¼%¹'Ñ:PÐPr   c                óH   •— | j                   r| j                  S t        ‰| �  S )zZState directory tied to the user, or site equivalent when root with ``use_site_for_root``.)r   r;   r£   r9   r¤   s    €r   r9   zUnix.user_state_dirù   r©   r   c                óH   •— | j                   r| j                  S t        ‰| �  S )zXLog directory tied to the user, or site equivalent when root with ``use_site_for_root``.)r   rF   r£   rD   r¤   s    €r   rD   zUnix.user_log_dirþ   ó!   ø€ ð %)§N¢Nˆt× Ñ ÐL¼¹Ñ8LÐLr   c                óH   •— | j                   r| j                  S t        ‰| �  S )zaApplications directory tied to the user, or site equivalent when root with ``use_site_for_root``.)r   Úsite_applications_dirr£   ry   r¤   s    €r   ry   zUnix.user_applications_dir  s!   ø€ ð .2¯^ª^ˆt×)Ñ)Ð^ÄÁÑA^Ð^r   c                óÞ  •— | j                   rt        t        | �  S t	        d«      x}sd}n„t        t        |«      «      x}s+t        t        «      5  | j                  |d¬«       ddd«       t        ||xs | j                   ¬«      xs t        |«      x}s| j                  |d¬«      S d|› �}t        |› d| j                  «       x}› �«       | j                  |d¬«      S # 1 sw Y   ŒxY w)	a²  Runtime directory tied to the user, e.g. ``$XDG_RUNTIME_DIR/$appname/$version``.

        Accepts ``$XDG_RUNTIME_DIR`` only as a directory, not a symlink, that the user owns with mode ``0700``, as the
        XDG spec requires, and only below parents no other user can replace. Creates a missing one that way under
        ``ensure_exists``. When the variable is unset or fails that check, emits one
        :class:`~platformdirs.RuntimeDirWarning` per cause and falls back to the platform default
        (``/tmp/run/user/<uid>`` on OpenBSD, ``/var/run/user/<uid>`` on FreeBSD/NetBSD, ``/run/user/<uid>`` elsewhere)
        if it passes the same check, else to ``runtime-<uid>`` in the temporary directory. Root with
        ``use_site_for_root`` gets the site equivalent.

        :raises PermissionError: if the temporary fallback is a symlink, not a directory, owned by another user, or
            missing right after its creation.

        ÚXDG_RUNTIME_DIRzXDG_RUNTIME_DIR is not setTr"   Nr�   zXDG_RUNTIME_DIR z, falling back to )r   r£   r   r”   r   r–   Ú_runtime_dir_parent_problemr   ÚOSErrorrB   r†   rŽ   r%   Ú
_warn_oncerˆ   )r   r@   ÚreasonÚskippedr’   Úfallbackr¥   s         €r   Úuser_runtime_dirzUnix.user_runtime_dir  s  ø€ ð  �>Š>äœ 4Ñ9Ð9Ü Ð!2Ó3Ð3�Ð3Ø1‰Fô  $Ô$?ÀÓ$EÓFÐF�GÐFÜœgÓ&ñ JØ×5Ñ5°dÀDÐ5ÔI÷Jô 0°ÀÒAbÐPT×PbÑPbÐLbÔcò 5Ü.¨tÓ4ð5�ð 5ð ×8Ñ8¸ÀtÐ8ÓLÐLØ'¨ yÐ1ˆFÜ�f�XÐ/¸T×=VÑ=VÓ=XÐ1X°Ð/ZÐ[Ô\Ø×0Ñ0°À4Ð0ÓHÐH÷Jð Jús   ÁC#Ã#C,c                ó.   — dd„}| j                  ||«      S )aW  Like :meth:`~platformdirs.api.PlatformDirsABC.place_runtime_file`.

        Creates the runtime directory before checking it, so another user cannot create it in between.

        :raises PermissionError: if the temporary fallback is a symlink, not a directory, owned by another user, or
            missing right after its creation.

        c                ó(   — d| _         | j                  S )NT)rŽ   Úuser_runtime_path)Úlookups    r   Úcreatedz(Unix.place_runtime_file.<locals>.created6  s   € Ø#'ˆFÔ Ø×+Ñ+Ð+r   )r»   r   r•   r   )Ú_place_file)r   Únamer¼   s      r   Úplace_runtime_filezUnix.place_runtime_file,  s   € ó	,ð ×Ñ ¨Ó.Ð.r   c                ó>   •— t        t        t        ‰| �  |«      «      S rg   )ÚfilterÚ_in_own_runtime_dirr£   Ú_find_runtime_files)r   r¾   r¥   s     €r   rÃ   zUnix._find_runtime_files<  s   ø€ ÜÔ)¬5©7Ñ+FÀtÓ+LÓMÐMr   c                óH   •— | j                   r| j                  S t        ‰| �  S )zXBin directory tied to the user, or site equivalent when root with ``use_site_for_root``.)r   ru   r£   rr   r¤   s    €r   rr   zUnix.user_bin_dir?  r¬   r   c                óL   •— | j                   rt        t        | �  S t        ‰| �  S )zcFonts directory tied to the user, ignoring ``$XDG_DATA_HOME`` when root with ``use_site_for_root``.)r   r£   r   rn   r¤   s    €r   rn   zUnix.user_fonts_dirD  s"   ø€ ð 8<·~²~Œu”X˜tÑ3ÐaÌ5É7ÑKaÐar   c                ó>   •— | j                   rd S t        ‰| �	  |«      S rg   )r   r£   Ú_xdg_media_dir)r   Úenv_varr¥   s     €r   rÇ   zUnix._xdg_media_dirI  s   ø€ à—~’~ˆtÐJ¬5©7Ñ+AÀ'Ó+JÐJr   c                óR   •— | j                   rt        |«      S t        ‰| �  ||«      S rg   )r   r   r£   rJ   )r   rj   rk   r¥   s      €r   rJ   zUnix._user_media_dirM  s'   ø€ Ø(,¯ªŒ|˜GÓ$Ða¼E¹GÑ<SÐTWÐY`Ó<aÐar   c                óH   •— | j                   r| j                  S t        ‰| �  S )zYData path tied to the user, or the first site entry when root with ``use_site_for_root``.)r   Úsite_data_pathr£   Úuser_data_pathr¤   s    €r   rÌ   zUnix.user_data_pathP  r©   r   c                óH   •— | j                   r| j                  S t        ‰| �  S )z[Config path tied to the user, or the first site entry when root with ``use_site_for_root``.)r   Úsite_config_pathr£   Úuser_config_pathr¤   s    €r   rÏ   zUnix.user_config_pathU  s!   ø€ ð )-¯ªˆt×$Ñ$ÐT¼E¹GÑ<TÐTr   c                óH   •— | j                   r| j                  S t        ‰| �  S )zfPreference path tied to the user, or the first site config entry when root with ``use_site_for_root``.)r   rÎ   r£   Úuser_preference_pathr¤   s    €r   rÑ   zUnix.user_preference_pathZ  s!   ø€ ð )-¯ªˆt×$Ñ$ÐX¼E¹GÑ<XÐXr   c                óH   •— | j                   r| j                  S t        ‰| �  S )zaApplications path tied to the user, or the first site entry when root with ``use_site_for_root``.)r   Úsite_applications_pathr£   Úuser_applications_pathr¤   s    €r   rÔ   zUnix.user_applications_path_  s!   ø€ ð /3¯nªnˆt×*Ñ*Ð`Ä%Á'ÑB`Ð`r   r—   )r¾   ústr | os.PathLike[str]r•   r   )r¾   rÕ   r•   zIterator[Path])rÈ   r˜   r•   ú
str | Noner™   )r•   r   )rš   r›   rœ   r�   rž   r&   r0   r4   r9   rD   ry   r·   r¿   rÃ   rr   rn   rÇ   rJ   rÌ   rÏ   rÑ   rÔ   Ú__classcell__)r¥   s   @r   r    r    ß   s>  ø„ ñð ôOó ðOð ôSó ðSð ôQó ðQð ôQó ðQð ôMó ðMð ô_ó ð_ð ô!Ió ð!IóF/õ Nð ôMó ðMð ôbó ðbõKõbð ôQó ðQð ôUó ðUð ôYó ðYð ôaó ôar   r    a  
    [ \t]*(?P<key>\w+)[ \t]*=[ \t]*  # KEY=, blanks allowed around the key and after the =
    (?:
        "(?P<quoted>(?:[^"\\]|\\.)*)"  # a double-quoted value with backslash escapes, text after it ignored
        |(?P<bare>[^"\s](?:[^ \t\n]|[ \t]+[^ \t\n\#])*)  # or an unquoted value; blanks join it only before a word
                                                         # that starts no comment, and each run is matched once so
                                                         # long runs stay linear
    )
    r   Ú_USER_DIRS_LINEc                ó\  — t        d«      xs t        d«      }t        |«      dz  }d}	 |j                  t	        j
                  «       d¬«      5 }|D ]2  }t        j                  |«      x}sŒ|d   | k(  sŒ$t        |«      xs |}Œ4 	 ddd«       |S # 1 sw Y   |S xY w# t        $ r Y yw xY w)a  Return directory from user-dirs.dirs config file.

    ``xdg-user-dirs-update`` writes shell assignments, so match each line like ``xdg-user-dir`` does and keep the last
    valid assignment to ``key``.

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

    ÚXDG_CONFIG_HOMEr/   zuser-dirs.dirsNÚsurrogateescape)ÚencodingÚerrorsrj   )
r   r   r   Úopenrƒ   ÚgetfilesystemencodingrØ   ÚmatchÚ_resolve_user_dirs_valuer²   )rj   Úconfig_homeÚuser_dirs_config_pathÚfolderÚstreamÚlineÚentrys          r   rh   rh   s  sÉ   € ô Ð,Ó-ÒJ´¸kÓ1J€KÜ  Ó-Ð0@Ñ@ÐØ€Fðà"×'Ñ'´×1JÑ1JÓ1LÐUfÐ'Ógð 	GÐkqØò G�Ü,×2Ñ2°4Ó8Ð8�EÑ8¸eÀE¹lÈcÓ>QÜ5°eÓ<ÒFÀ‘FñG÷	Gð €M÷	Gð €Mûô ò Ùðús;   ª%B ÁBÁ-BÁ6BÂB ÂBÂB ÂB Â	B+Â*B+c                ó  — | d   €| d   n| d   }|dk(  s|j                  d«      r,t        d«      j                  d«      |j                  d«      }}n|j                  d«      rd}ny | d   �t	        j
                  dd	|«      }|› |› �xs dS )
NÚquotedÚbarez$HOMEz$HOME/ú~ú/Ú z\\([$`"\\])z\1)r…   r   ÚrstripÚremoveprefixÚreÚsub)rç   ÚvalueÚprefixs      r   rá   rá   Š  s™   € Ø" 8™_Ð4ˆE�&ŠM¸%À¹/€EØ�Ò˜5×+Ñ+¨HÔ5ä$ SÓ)×0Ñ0°Ó5°u×7IÑ7IÈ'Ó7R�‰Ø	×	Ñ	˜#Ô	Ø‰àØˆX�Ð"ä—‘�~ u¨eÓ4ˆØˆX�e�WÐÒ$ Ð$r   c                óœ   — t        «       › dt        «       › �t        d«      fD ]'  }|sŒ| j                  |«      sŒt	        |dd¬«       c S  y)NrŠ   r°   Fr‹   T)r   r   r   Úis_relative_tor†   )r@   Úbases     r   rÂ   rÂ   ™  sV   € ô “L�> ¬7«9¨+Ð6¼ÐARÓ8SÐTò VˆÚ�D×'Ñ'¨Õ-Ü+¨D¸UÈuÔUÐUÒUðVð r   T)rŒ   c          	     ó"  ‡ — 	 t        j                  t        t        ‰ «      «      «      }|j                  dz  }t        j                  |j                  «      dft        j                  |j                  «       df|j                  t        «       x}k7  d|j                  › d|› �f|xr	 |t        k7  d	|d
›dt        d
›�ff}t        ˆ fd„|D «       d«      S # t        $ r |rdcY S ‰ › d�cY S t
        $ r}‰ › d|j                  › �cY d}~S d}~ww xY w)a  Return why ``path`` fails the checks of Qt's ``checkXdgRuntimeDir``, or ``None`` if it passes.

    A missing ``path`` passes under ``missing_ok``. A caller that then creates it or reads below it has to check again,
    since another user can create it in between.

    Nz is missingz cannot be checked: iÿ  zis a symlinkzis not a directoryzis owned by uid z, not z	has mode Ú04oc              3  ó8   •K  — | ]  \  }}|sŒ	‰› d |› �–— Œ y­w)ú Nrt   )Ú.0Úfailedr’   r@   s      €r   ú	<genexpr>z'_runtime_dir_problem.<locals>.<genexpr>·  s"   øè ø€ ÒM©¨°Âf�D�6˜˜7˜)Ô$ÑMùs   ƒ
Ž)r?   Úlstatr˜   r   ÚFileNotFoundErrorr²   ÚstrerrorÚst_modeÚstatÚS_ISLNKÚS_ISDIRÚst_uidr   r‘   Únext)r@   r‚   rŒ   ÚinfoÚerrorÚmodeÚuidÚcheckss   `       r   r†   r†   ¢  s  ø€ ð=ä�x‰xœœD ›J›Ó(ˆð
 �<‰<˜%Ñ€Dä	�‰�d—l‘lÓ	# ^Ð4Ü�\‰\˜$Ÿ,™,Ó'Ð	'Ð)=Ð>Ø	�‰¤£	Ð)˜Ñ	*Ð.>¸t¿{¹{¸mÈ6ÐRUÐQVÐ,WÐXØ	Ò	1˜Ô 1Ñ1°Y¸tÀC¸jÈÔO`ÐadÐNeÐ3fÐgð	€Fô ÓM¸FÔMÈtÓTÐTøô ò <Ù!ˆtÒ;¨$¨¨{Ð';Ò;Üò =Ø�Ð+¨E¯N©NÐ+;Ð<Õ<ûð=ús)   ƒ'C ÃDÃ$DÃ+DÃ3D	ÄDÄ	Dc                óº  — t         j                  dk(  ry d}t        t        | «      j                  «      D ]”  }	 |r9t        j                  |«      j                  x}dt        «       hvr| › d|› d|› �c S |j                  «       j                  }t        |t        j                  z  «      x}sŒx|t        j                  z  rŒŒ| › d|› d�c S  y # t        $ r Y  y w xY w)Nr   Fr   z
 is below z, owned by uid z, writable by every user)rƒ   r„   Úreversedr   Úparentsr?   rþ   r  r   r  r  r²   r–   ÚS_IWOTHÚS_ISVTX)r@   Úin_shared_dirÚparentÚownerr	  s        r   r±   r±   º  sÚ   € Ü
‡|�|�wÒØØ€MÜœ4 ›:×-Ñ-Ó.ò Gˆð	Ù¬2¯8©8°FÓ+;×+BÑ+BÐ"B %ÈAÌwËyÈ>Ñ!YØ˜˜z¨&¨°ÀÀÐHÒHØ—;‘;“=×(Ñ(ˆDô " $¬¯©Ñ"5Ó6Ð6ˆMÑ6ÀÄtÇ|Á|Ó@SØ�V˜: f XÐ-EÐFÒFðGð øô	 ò 	Úð	ús   ¹8CÁ4CÃ	CÃCc                óx   — | t         vr2t         j                  | «       t        j                  | t        d¬«       y y )Né   )Ú
stacklevel)Ú_WARNEDÚaddÚwarningsÚwarnr   )Úmessages    r   r³   r³   Ê  s,   € à”gÑÜ�‰�GÔÜ�‰�gÔ0¸QÖ?ð r   zFinal[set[str]]r  iÀ  r‘   )r•   r	   )rj   r˜   r•   rÖ   )rç   zre.Match[str]r•   rÖ   )r@   r   r•   r–   )r@   r˜   r‚   r–   rŒ   r–   r•   rÖ   )r@   r˜   r•   rÖ   )r  r˜   r•   ÚNone)/r�   Ú
__future__r   r?   rð   r  rƒ   r  Ú
contextlibr   Úpathlibr   Útempfiler   Útypingr   r   r	   Ú_xdgr   r   r   Úapir   r   Úcollections.abcr   r„   r   ÚImportErrorr   r   r    ÚcompileÚVERBOSErØ   Ú__annotations__rh   rá   rÂ   r†   r±   r³   Úsetr  r‘   Ú__all__rt   r   r   ú<module>r+     sý   ðÚ å "ã 	Û 	Û Û 
Û Ý Ý Ý ß 1Ñ 1ç 2Ñ 2ß 3áÝ(à‡<�<�7Òô ð
)Ýô
zF�Oô zFôzCaˆ8�]ô CaðL $˜Ÿ™ðð ‡J�Jó€�ó óó.%óð MQõ Uó0ó @ñ ›5€ˆÓ  Ø Ð �5Ó  ð ð�øðo ò )ß(ð)ús   Á)C ÃC(Ã'C(