§
    ŒŸjã/  ã                  ó
  — d Z ddlm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 ddlmZmZ d	d
lmZ d	dlmZ erddlmZ ej        dk    rdd„ZnddlmZ  G d„ de¦  «        Z G d„ dee¦  «        Zdd„Zdd„ZdgZdS ) zUnix.é    )ÚannotationsN)ÚConfigParser)Úcached_property)ÚPath)Ú
gettempdir)ÚTYPE_CHECKINGÚNoReturné   )ÚXDGMixin)ÚPlatformDirsABC)ÚIteratorÚwin32Úreturnr	   c                 ó$   — d} t          | ¦  «        ‚)Nzshould only be used on Unix)ÚRuntimeError)Úmsgs    ú^/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/platformdirs/unix.pyÚgetuidr      s   € Ø+ˆÝ˜3ÑÔÐó    )r   c                  óª  — 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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!d*d$„Z"d%S )+Ú_UnixDefaultszžDefault directories for Unix/Linux without XDG environment variable overrides.

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

    r   Úboolc                ó4   — | j         ot          ¦   «         dk    S )Nr   )Úuse_site_for_rootr   ©Úselfs    r   Ú	_use_sitez_UnixDefaults._use_site$   s   € àÔ%Ð7­&©(¬(°aª-Ð7r   Ústrc                óf   — |                       t          j                             d¦  «        ¦  «        S )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_dirz_UnixDefaults.user_data_dir(   ó)   € ð ×0Ò0µ´×1CÒ1CÐDTÑ1UÔ1UÑVÔVÐVr   ú	list[str]c                óV   — |                       d¦  «        |                       d¦  «        gS )Nú/usr/local/shareú
/usr/share©r"   r   s    r   Ú_site_data_dirsz_UnixDefaults._site_data_dirs-   s+   € à×1Ò1Ð2DÑEÔEÀt×GhÒGhÐiuÑGvÔGvÐwÐwr   c                óf   — |                       t          j                             d¦  «        ¦  «        S )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_dirz_UnixDefaults.user_config_dir1   s(   € ð ×0Ò0µ´×1CÒ1CÀKÑ1PÔ1PÑQÔQÐQr   c                ó.   — |                       d¦  «        gS )Nz/etc/xdgr,   r   s    r   Ú_site_config_dirsz_UnixDefaults._site_config_dirs6   s   € à×1Ò1°*Ñ=Ô=Ð>Ð>r   c                óf   — |                       t          j                             d¦  «        ¦  «        S )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_dirz_UnixDefaults.user_cache_dir:   s(   € ð ×0Ò0µ´×1CÒ1CÀJÑ1OÔ1OÑPÔPÐPr   c                ó,   — |                       d¦  «        S )zP:returns: cache directory shared by users, e.g. ``/var/cache/$appname/$version``z
/var/cacher,   r   s    r   Úsite_cache_dirz_UnixDefaults.site_cache_dir?   s   € ð ×0Ò0°Ñ>Ô>Ð>r   c                óf   — |                       t          j                             d¦  «        ¦  «        S )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_dirz_UnixDefaults.user_state_dirD   r'   r   c                ó,   — |                       d¦  «        S )zN:returns: state directory shared by users, e.g. ``/var/lib/$appname/$version``z/var/libr,   r   s    r   Úsite_state_dirz_UnixDefaults.site_state_dirI   s   € ð ×0Ò0°Ñ<Ô<Ð<r   c                óŒ   — | j         }| j        r5t          j                             |d¦  «        }|                      |¦  «         |S )zh:returns: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in itÚlog)r8   Úopinionr#   r$   ÚjoinÚ_optionally_create_directory©r   r$   s     r   Úuser_log_dirz_UnixDefaults.user_log_dirN   sD   € ð Ô"ˆØŒ<ð 	4Ý”7—<’<  eÑ,Ô,ˆDØ×-Ò-¨dÑ3Ô3Ð3Øˆr   c                ó,   — |                       d¦  «        S )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_dirz_UnixDefaults.site_log_dirW   s   € ð ×0Ò0°Ñ<Ô<Ð<r   c                ó"   — t          dd¦  «        S )zD:returns: documents directory tied to the user, e.g. ``~/Documents``ÚXDG_DOCUMENTS_DIRz~/Documents©Ú_get_user_media_dirr   s    r   Úuser_documents_dirz _UnixDefaults.user_documents_dir`   s   € õ #Ð#6¸ÑFÔFÐFr   c                ó"   — t          dd¦  «        S )zD:returns: downloads directory tied to the user, e.g. ``~/Downloads``ÚXDG_DOWNLOAD_DIRz~/DownloadsrF   r   s    r   Úuser_downloads_dirz _UnixDefaults.user_downloads_dire   s   € õ #Ð#5°}ÑEÔEÐEr   c                ó"   — t          dd¦  «        S )zB:returns: pictures directory tied to the user, e.g. ``~/Pictures``ÚXDG_PICTURES_DIRz
~/PicturesrF   r   s    r   Úuser_pictures_dirz_UnixDefaults.user_pictures_dirj   s   € õ #Ð#5°|ÑDÔDÐDr   c                ó"   — t          dd¦  «        S )z>:returns: videos directory tied to the user, e.g. ``~/Videos``ÚXDG_VIDEOS_DIRz~/VideosrF   r   s    r   Úuser_videos_dirz_UnixDefaults.user_videos_diro   s   € õ #Ð#3°ZÑ@Ô@Ð@r   c                ó"   — t          dd¦  «        S )z<:returns: music directory tied to the user, e.g. ``~/Music``ÚXDG_MUSIC_DIRz~/MusicrF   r   s    r   Úuser_music_dirz_UnixDefaults.user_music_dirt   s   € õ # ?°IÑ>Ô>Ð>r   c                ó"   — t          dd¦  «        S )z@:returns: desktop directory tied to the user, e.g. ``~/Desktop``ÚXDG_DESKTOP_DIRz	~/DesktoprF   r   s    r   Úuser_desktop_dirz_UnixDefaults.user_desktop_diry   s   € õ #Ð#4°kÑBÔBÐBr   c                ó@   — t           j                             d¦  «        S )z?:returns: bin directory tied to the user, e.g. ``~/.local/bin``z~/.local/bin)r#   r$   r%   r   s    r   Úuser_bin_dirz_UnixDefaults.user_bin_dir~   s   € õ Œw×!Ò! .Ñ1Ô1Ð1r   c                ó   — dS )z@:returns: bin 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           j                             t           j                             d¦  «        d¦  «        S )zW:returns: applications directory tied to the user, e.g. ``~/.local/share/applications``r    Úapplications)r#   r$   r>   r%   r   s    r   Úuser_applications_dirz#_UnixDefaults.user_applications_dirˆ   s+   € õ Œw�|Š|�BœG×.Ò.Ð/?Ñ@Ô@À.ÑQÔQÐQr   c                ó   — d„ dD ¦   «         S )Nc                óN   — g | ]"}t           j                             |d ¦  «        ‘Œ#S )r^   )r#   r$   r>   )Ú.0Úps     r   ú
<listcomp>z9_UnixDefaults._site_applications_dirs.<locals>.<listcomp>�   s(   € Ð\Ð\Ð\°A•”—’˜Q Ñ/Ô/Ð\Ð\Ð\r   )r*   r+   r[   r   s    r   Ú_site_applications_dirsz%_UnixDefaults._site_applications_dirs�   s   € à\Ð\Ð9[Ð\Ñ\Ô\Ð\r   c                ól   — | j         }| j        rt          j                             |¦  «        n|d         S )zR:returns: applications directory shared by users, e.g. ``/usr/share/applications``r   )re   Ú	multipathr#   Úpathsepr>   )r   Údirss     r   Úsite_applications_dirz#_UnixDefaults.site_applications_dir‘   s0   € ð Ô+ˆØ(,¬ÐC�rŒz�Š˜tÑ$Ô$Ð$¸DÀ¼GÐCr   c                óŽ  — t           j                             d¦  «        rdt          ¦   «         › �}nBt           j                             d¦  «        rdt          ¦   «         › �}ndt          ¦   «         › �}t	          j        |t          j        ¦  «        st          ¦   «         › dt          ¦   «         › �}|                      |¦  «        S )ah  :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"   r@   s     r   Úuser_runtime_dirz_UnixDefaults.user_runtime_dir—   s±   € õ Œ<×"Ò" 9Ñ-Ô-ð 	+Ø.¥F¡H¤HÐ.Ð.ˆDˆDÝŒ\×$Ò$Ð%:Ñ;Ô;ð 	+Ø.¥F¡H¤HÐ.Ð.ˆDˆDà*¥¡¤Ð*Ð*ˆDÝŒy˜�rœwÑ'Ô'ð 	8Ý ‘l”lÐ7Ð7­V©X¬XÐ7Ð7ˆDØ×0Ò0°Ñ6Ô6Ð6r   c                ót   — t           j                             d¦  «        rd}nd}|                      |¦  «        S )aN  :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.

        )rm   rl   rn   z/var/runz/run)ro   rp   rq   r"   r@   s     r   Úsite_runtime_dirz_UnixDefaults.site_runtime_dir¨   s=   € õ Œ<×"Ò"Ð#CÑDÔDð 	ØˆDˆDàˆDØ×0Ò0°Ñ6Ô6Ð6r   r   c                ó6   — |                       | j        ¦  «        S )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_pathz_UnixDefaults.site_data_path¹   s   € ð ×4Ò4°TÔ5GÑHÔHÐHr   c                ó6   — |                       | j        ¦  «        S )zg:returns: config path shared by users, returns the first item, even if ``multipath`` is set to ``True``)rx   Úsite_config_dirr   s    r   Úsite_config_pathz_UnixDefaults.site_config_path¾   s   € ð ×4Ò4°TÔ5IÑJÔJÐJr   c                ó6   — |                       | j        ¦  «        S )zj:returns: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``)rx   r6   r   s    r   Úsite_cache_pathz_UnixDefaults.site_cache_pathÃ   s   € ð ×4Ò4°TÔ5HÑIÔIÐIr   úIterator[str]c              #  óD   K  — | j         s	| j        V — | j        E d{V —† dS )z4:yield: all user and site configuration directories.N)r   r0   r2   r   s    r   Úiter_config_dirsz_UnixDefaults.iter_config_dirsÈ   s@   è è € àŒ~ð 	'ØÔ&Ð&Ð&Ð&ØÔ)Ð)Ð)Ð)Ð)Ð)Ð)Ð)Ð)Ð)r   c              #  óD   K  — | j         s	| j        V — | j        E d{V —† dS )z+:yield: all user and site data directories.N)r   r&   r-   r   s    r   Úiter_data_dirsz_UnixDefaults.iter_data_dirsÎ   s@   è è € àŒ~ð 	%ØÔ$Ð$Ð$Ð$ØÔ'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Ð'r   N)r   r   ©r   r   )r   r(   )r   r   )r   r€   )#Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úpropertyr&   r-   r0   r2   r4   r6   r8   r:   rA   rC   rH   rK   rN   rQ   rT   rW   rY   r\   r_   re   rj   rt   rv   rz   r}   r   r‚   r„   r[   r   r   r   r      sæ  € € € € € ðð ð ð8ð 8ð 8ñ „_ð8ð ðWð Wð Wñ „XðWð ðxð xð xñ „Xðxð ðRð Rð Rñ „XðRð ð?ð ?ð ?ñ „Xð?ð ðQð Qð Qñ „XðQð ð?ð ?ð ?ñ „Xð?ð ðWð Wð Wñ „XðWð ð=ð =ð =ñ „Xð=ð ðð ð ñ „Xðð ð=ð =ð =ñ „Xð=ð ðGð Gð Gñ „XðGð ðFð Fð Fñ „XðFð ðEð Eð Eñ „XðEð ðAð Að Añ „XðAð ð?ð ?ð ?ñ „Xð?ð ðCð Cð Cñ „XðCð ð2ð 2ð 2ñ „Xð2ð ð ð  ð  ñ „Xð ð ðRð Rð Rñ „XðRð ð]ð ]ð ]ñ „Xð]ð ðDð Dð Dñ „XðDð
 ð7ð 7ð 7ñ „Xð7ð  ð7ð 7ð 7ñ „Xð7ð  ðIð Ið Iñ „XðIð ðKð Kð Kñ „XðKð ðJð Jð Jñ „XðJð*ð *ð *ð *ð(ð (ð (ð (ð (ð (r   r   c                  óø   ‡ — 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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>`.

    r   r   c                óF   •— | j         r| j        nt          ¦   «         j        S )zb:returns: data directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   ry   Úsuperr&   ©r   Ú	__class__s    €r   r&   zUnix.user_data_dirà   s!   ø€ ð &*¤^ÐNˆtÔ!Ð!½¹¼Ô9NÐNr   c                óF   •— | j         r| j        nt          ¦   «         j        S )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   zUnix.user_config_dirå   s!   ø€ ð (,¤~ÐRˆtÔ#Ð#½5¹7¼7Ô;RÐRr   c                óF   •— | j         r| j        nt          ¦   «         j        S )zc:returns: cache directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   r6   rŽ   r4   r�   s    €r   r4   zUnix.user_cache_dirê   ó!   ø€ ð '+¤nÐPˆtÔ"Ð"½%¹'¼'Ô:PÐPr   c                óF   •— | j         r| j        nt          ¦   «         j        S )zc:returns: state directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   r:   rŽ   r8   r�   s    €r   r8   zUnix.user_state_dirï   r“   r   c                óF   •— | j         r| j        nt          ¦   «         j        S )za:returns: log directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   rC   rŽ   rA   r�   s    €r   rA   zUnix.user_log_dirô   ó!   ø€ ð %)¤NÐLˆtÔ Ð ½¹¼Ô8LÐLr   c                óF   •— | j         r| j        nt          ¦   «         j        S )zj:returns: applications directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   rj   rŽ   r_   r�   s    €r   r_   zUnix.user_applications_dirù   s!   ø€ ð .2¬^Ð^ˆtÔ)Ð)ÅÁÄÔA^Ð^r   c                óF   •— | j         r| j        nt          ¦   «         j        S )ze:returns: runtime directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   rv   rŽ   rt   r�   s    €r   rt   zUnix.user_runtime_dirþ   s!   ø€ ð )-¬ÐTˆtÔ$Ð$½E¹G¼GÔ<TÐTr   c                óF   •— | j         r| j        nt          ¦   «         j        S )za:returns: bin directory tied to the user, or site equivalent when root with ``use_site_for_root``)r   r\   rŽ   rY   r�   s    €r   rY   zUnix.user_bin_dir  r–   r   r…   )r†   r‡   rˆ   r‰   rŠ   r&   r0   r4   r8   rA   r_   rt   rY   Ú__classcell__)r�   s   @r   rŒ   rŒ   Õ   s­  ø€ € € € € ðð ð ðOð Oð Oð Oð Oñ „XðOð ðSð Sð Sð Sð Sñ „XðSð ðQð Qð Qð Qð Qñ „XðQð ðQð Qð Qð Qð Qñ „XðQð ðMð Mð Mð Mð Mñ „XðMð ð_ð _ð _ð _ð _ñ „Xð_ð ðUð Uð Uð Uð Uñ „XðUð ðMð Mð Mð Mð Mñ „XðMð Mð Mð Mð Mr   rŒ   Úenv_varr   Úfallback_tilde_pathc                óf   — t          | ¦  «        x}r|S t          j                             |¦  «        S )N)Ú_get_user_dirs_folderr#   r$   r%   )r›   rœ   Ú	media_dirs      r   rG   rG   	  s4   € Ý)¨'Ñ2Ô2Ð2€yð ØÐÝŒ7×ÒÐ1Ñ2Ô2Ð2r   Úkeyú
str | Nonec                ó|  — t           j                             dd¦  «                             ¦   «         pt           j                             d¦  «        }t          |¦  «        dz  }|                     ¦   «         rÄt          ¦   «         }| 	                    ¦   «         5 }| 
                    d|                     ¦   «         › �¦  «         ddd¦  «         n# 1 swxY w Y   | |d         vrdS |d         |                               d¦  «        }|                     d	t           j                             d
¦  «        ¦  «        S dS )zvReturn 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)r    Úconfig_homeÚuser_dirs_config_pathÚparserÚstreamr$   s         r   rž   rž     sQ  € õ ”*—.’.Ð!2°BÑ7Ô7×=Ò=Ñ?Ô?ÐbÅ2Ä7×CUÒCUÐVaÑCbÔCb€KÝ  Ñ-Ô-Ð0@Ñ@ÐØ×#Ò#Ñ%Ô%ð 
>Ý‘”ˆà"×'Ò'Ñ)Ô)ð 	:¨VØ×ÒÐ8¨¯ª©¬Ð8Ð8Ñ9Ô9Ð9ð	:ð 	:ð 	:ñ 	:ô 	:ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:øøøð 	:ð 	:ð 	:ð 	:ð �f˜U”mÐ#Ð#Ø�4à�eŒ}˜SÔ!×'Ò'¨Ñ,Ô,ˆØ�|Š|˜G¥R¤W×%7Ò%7¸Ñ%<Ô%<Ñ=Ô=Ð=àˆ4s   Â+CÃCÃC)r   r	   )r›   r   rœ   r   r   r   )r    r   r   r¡   )r‰   Ú
__future__r   r#   ro   Úconfigparserr   Ú	functoolsr   Úpathlibr   Útempfiler   Útypingr   r	   Ú_xdgr   Úapir   Úcollections.abcr   rp   r   r   rŒ   rG   rž   Ú__all__r[   r   r   ú<module>r¾      s¦  ðØ €à "Ð "Ð "Ð "Ð "Ð "à 	€	€	€	Ø 
€
€
€
Ø %Ð %Ð %Ð %Ð %Ð %Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø *Ð *Ð *Ð *Ð *Ð *Ð *Ð *à Ð Ð Ð Ð Ð Ø  Ð  Ð  Ð  Ð  Ð  àð )Ø(Ð(Ð(Ð(Ð(Ð(à„<�7ÒÐð ð  ð  ð  ð  ð
 ÐÐÐÐÐðu(ð u(ð u(ð u(ð u(�Oñ u(ô u(ð u(ðp1Mð 1Mð 1Mð 1Mð 1Mˆ8�]ñ 1Mô 1Mð 1Mðh3ð 3ð 3ð 3ðð ð ð ð0 ð€€€r   