§
    !phÚ(  ã                  óÈ   — 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
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dd„Zdd„ZdgZdS )zUnix.é    )ÚannotationsN)ÚConfigParser)ÚPath)ÚTYPE_CHECKINGÚNoReturné   )ÚPlatformDirsABC)ÚIteratorÚwin32Úreturnr   c                 ó$   — d} t          | ¦  «        ‚)Nzshould only be used on Unix)ÚRuntimeError)Úmsgs    ú^C:\Users\Daniel\PycharmProjects\Portfolio_Website\.venv\Lib\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d"d„Zd"d„ZdS )#Ú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   Ústrc                óÒ   — t           j                             dd¦  «        }|                     ¦   «         st           j                             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©Úselfr   s     r   Úuser_data_dirzUnix.user_data_dir'   sS   € õ Œz�~Š~˜o¨rÑ2Ô2ˆØ�zŠz‰|Œ|ð 	8Ý”7×%Ò%Ð&6Ñ7Ô7ˆDØ×0Ò0°Ñ6Ô6Ð6r   ú	list[str]c                óâ   ‡ — t           j                             dd¦  «        }|                     ¦   «         sdt           j        › d�}ˆ fd„|                     t           j        ¦  «        D ¦   «         S )NÚXDG_DATA_DIRSr   z/usr/local/sharez
/usr/sharec                ó:   •— g | ]}‰                      |¦  «        ‘ŒS © ©r    ©Ú.0Úpr"   s     €r   ú
<listcomp>z(Unix._site_data_dirs.<locals>.<listcomp>7   ó'   ø€ ÐUÐUÐU¸�×1Ò1°!Ñ4Ô4ÐUÐUÐUr   )r   r   r   r   ÚpathsepÚsplitr!   s   ` r   Ú_site_data_dirszUnix._site_data_dirs2   sb   ø€ åŒz�~Š~˜o¨rÑ2Ô2ˆØ�zŠz‰|Œ|ð 	=Ø<¥b¤jÐ<Ð<Ð<ˆDØUÐUÐUÐU¸d¿jºjÍÌÑ>TÔ>TÐUÑUÔUÐUr   c                ól   — | j         }| j        s|d         S t          j                             |¦  «        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   )r1   Ú	multipathr   r/   Újoin©r"   Údirss     r   Úsite_data_dirzUnix.site_data_dir9   s3   € ð Ô#ˆØŒ~ð 	Ø˜”7ˆNÝŒz�Š˜tÑ$Ô$Ð$r   c                óÒ   — t           j                             dd¦  «        }|                     ¦   «         st           j                             d¦  «        }|                      |¦  «        S )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_dirzUnix.user_config_dirF   sS   € õ Œz�~Š~Ð/°Ñ4Ô4ˆØ�zŠz‰|Œ|ð 	3Ý”7×%Ò% kÑ2Ô2ˆDØ×0Ò0°Ñ6Ô6Ð6r   c                óÆ   ‡ — t           j                             dd¦  «        }|                     ¦   «         sd}ˆ fd„|                     t           j        ¦  «        D ¦   «         S )NÚXDG_CONFIG_DIRSr   z/etc/xdgc                ó:   •— g | ]}‰                      |¦  «        ‘ŒS r(   r)   r*   s     €r   r-   z*Unix._site_config_dirs.<locals>.<listcomp>V   r.   r   )r   r   r   r   r0   r/   r!   s   ` r   Ú_site_config_dirszUnix._site_config_dirsQ   sV   ø€ åŒz�~Š~Ð/°Ñ4Ô4ˆØ�zŠz‰|Œ|ð 	ØˆDØUÐUÐUÐU¸d¿jºjÍÌÑ>TÔ>TÐUÑUÔUÐUr   c                ól   — | j         }| j        s|d         S t          j                             |¦  «        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   )r>   r3   r   r/   r4   r5   s     r   Úsite_config_dirzUnix.site_config_dirX   s3   € ð Ô%ˆØŒ~ð 	Ø˜”7ˆNÝŒz�Š˜tÑ$Ô$Ð$r   c                óÒ   — t           j                             dd¦  «        }|                     ¦   «         st           j                             d¦  «        }|                      |¦  «        S )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_dirzUnix.user_cache_dire   sS   € õ Œz�~Š~Ð.°Ñ3Ô3ˆØ�zŠz‰|Œ|ð 	2Ý”7×%Ò% jÑ1Ô1ˆDØ×0Ò0°Ñ6Ô6Ð6r   c                ó,   — |                       d¦  «        S )zO:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``z
/var/cacher)   ©r"   s    r   Úsite_cache_dirzUnix.site_cache_dirp   s   € ð ×0Ò0°Ñ>Ô>Ð>r   c                óÒ   — t           j                             dd¦  «        }|                     ¦   «         st           j                             d¦  «        }|                      |¦  «        S )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_dirzUnix.user_state_diru   sT   € õ Œz�~Š~Ð.°Ñ3Ô3ˆØ�zŠz‰|Œ|ð 	8Ý”7×%Ò%Ð&6Ñ7Ô7ˆDØ×0Ò0°Ñ6Ô6Ð6r   c                óŒ   — | j         }| j        r5t          j                             |d¦  «        }|                      |¦  «         |S )zg:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in itÚlog)rI   Úopinionr   r   r4   Ú_optionally_create_directoryr!   s     r   Úuser_log_dirzUnix.user_log_dir€   sD   € ð Ô"ˆØŒ<ð 	4Ý”7—<’<  eÑ,Ô,ˆDØ×-Ò-¨dÑ3Ô3Ð3Øˆr   c                ó"   — t          dd¦  «        S )zC:return: documents directory tied to the user, e.g. ``~/Documents``ÚXDG_DOCUMENTS_DIRz~/Documents©Ú_get_user_media_dirrE   s    r   Úuser_documents_dirzUnix.user_documents_dir‰   s   € õ #Ð#6¸ÑFÔFÐFr   c                ó"   — t          dd¦  «        S )zC:return: downloads directory tied to the user, e.g. ``~/Downloads``ÚXDG_DOWNLOAD_DIRz~/DownloadsrQ   rE   s    r   Úuser_downloads_dirzUnix.user_downloads_dirŽ   s   € õ #Ð#5°}ÑEÔEÐEr   c                ó"   — t          dd¦  «        S )zA:return: pictures directory tied to the user, e.g. ``~/Pictures``ÚXDG_PICTURES_DIRz
~/PicturesrQ   rE   s    r   Úuser_pictures_dirzUnix.user_pictures_dir“   s   € õ #Ð#5°|ÑDÔDÐDr   c                ó"   — t          dd¦  «        S )z=:return: videos directory tied to the user, e.g. ``~/Videos``ÚXDG_VIDEOS_DIRz~/VideosrQ   rE   s    r   Úuser_videos_dirzUnix.user_videos_dir˜   s   € õ #Ð#3°ZÑ@Ô@Ð@r   c                ó"   — t          dd¦  «        S )z;:return: music directory tied to the user, e.g. ``~/Music``ÚXDG_MUSIC_DIRz~/MusicrQ   rE   s    r   Úuser_music_dirzUnix.user_music_dir�   s   € õ # ?°IÑ>Ô>Ð>r   c                ó"   — t          dd¦  «        S )z?:return: desktop directory tied to the user, e.g. ``~/Desktop``ÚXDG_DESKTOP_DIRz	~/DesktoprQ   rE   s    r   Úuser_desktop_dirzUnix.user_desktop_dir¢   s   € õ #Ð#4°kÑBÔBÐBr   c                ó|  — t           j                             dd¦  «        }|                     ¦   «         stt          j                             d¦  «        rDdt          ¦   «         › �}t          |¦  «         	                    ¦   «         sdt          ¦   «         › �}ndt          ¦   «         › �}|  
                    |¦  «        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/)r   r   r   r   ÚsysÚplatformÚ
startswithr   r   Úexistsr    r!   s     r   Úuser_runtime_dirzUnix.user_runtime_dir§   s¥   € õ Œz�~Š~Ð/°Ñ4Ô4ˆØ�zŠz‰|Œ|ð 	/ÝŒ|×&Ò&Ð'GÑHÔHð /Ø2­©¬Ð2Ð2�Ý˜D‘z”z×(Ò(Ñ*Ô*ð 6Ø5­6©8¬8Ð5Ð5�Døà.¥F¡H¤HÐ.Ð.�Ø×0Ò0°Ñ6Ô6Ð6r   c                óÜ   — t           j                             dd¦  «        }|                     ¦   «         s$t          j                             d¦  «        rd}nd}|                      |¦  «        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.
        rd   r   re   z/var/runz/run)r   r   r   r   ri   rj   rk   r    r!   s     r   Úsite_runtime_dirzUnix.site_runtime_dir»   sc   € õ Œz�~Š~Ð/°Ñ4Ô4ˆØ�zŠz‰|Œ|ð 	ÝŒ|×&Ò&Ð'GÑHÔHð Ø!��à�Ø×0Ò0°Ñ6Ô6Ð6r   r   c                ó6   — |                       | 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_multipathr7   rE   s    r   Úsite_data_pathzUnix.site_data_pathÑ   s   € ð ×4Ò4°TÔ5GÑHÔHÐHr   c                ó6   — |                       | j        ¦  «        S )zj:return: config path shared by the users, returns the first item, even if ``multipath`` is set to ``True``)rq   r@   rE   s    r   Úsite_config_pathzUnix.site_config_pathÖ   s   € ð ×4Ò4°TÔ5IÑJÔJÐJr   c                ó6   — |                       | j        ¦  «        S )zi:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``)rq   rF   rE   s    r   Úsite_cache_pathzUnix.site_cache_pathÛ   s   € ð ×4Ò4°TÔ5HÑIÔIÐIr   úIterator[str]c              #  ó6   K  — | j         V — | j        E d{V —† dS )z4:yield: all user and site configuration directories.N)r:   r>   rE   s    r   Úiter_config_dirszUnix.iter_config_dirsà   s6   è è € àÔ"Ð"Ð"Ð"ØÔ)Ð)Ð)Ð)Ð)Ð)Ð)Ð)Ð)Ð)r   c              #  ó6   K  — | j         V — | j        E d{V —† dS )z+:yield: all user and site data directories.N)r#   r1   rE   s    r   Úiter_data_dirszUnix.iter_data_dirså   s6   è è € àÔ Ð Ð Ð ØÔ'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Ð'r   N)r   r   )r   r$   )r   r   )r   rw   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr#   r1   r7   r:   r>   r@   rC   rF   rI   rN   rS   rV   rY   r\   r_   rb   rm   ro   rr   rt   rv   ry   r{   r(   r   r   r   r      s  € € € € € ð
ð 
ð ð7ð 7ð 7ñ „Xð7ð ðVð Vð Vñ „XðVð ð
%ð 
%ð 
%ñ „Xð
%ð ð7ð 7ð 7ñ „Xð7ð ðVð Vð Vñ „XðVð ð
%ð 
%ð 
%ñ „Xð
%ð ð7ð 7ð 7ñ „Xð7ð ð?ð ?ð ?ñ „Xð?ð ð7ð 7ð 7ñ „Xð7ð ðð ð ñ „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ð ð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   Úenv_varr   Úfallback_tilde_pathc                óÎ   — t          | ¦  «        }|€St          j                             | d¦  «                             ¦   «         }|st          j                             |¦  «        }|S )Nr   )Ú_get_user_dirs_folderr   r   r   r   r   r   )r�   r‚   Ú	media_dirs      r   rR   rR   ë   s^   € Ý% gÑ.Ô.€IØð @Ý”J—N’N 7¨BÑ/Ô/×5Ò5Ñ7Ô7ˆ	Øð 	@Ýœ×*Ò*Ð+>Ñ?Ô?ˆIàÐr   Úkeyú
str | Nonec                óü  — t          t          ¦   «         j        ¦  «        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 )z{
    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   r:   rl   r   ÚopenÚread_stringÚreadr   Úreplacer   r   r   )r†   Úuser_dirs_config_pathÚparserÚstreamr   s        r   r„   r„   õ   s"  € õ !¥¡¤Ô!7Ñ8Ô8Ð;KÑKÐØ×#Ò#Ñ%Ô%ð >Ý‘”ˆà"×'Ò'Ñ)Ô)ð 	:¨Và×ÒÐ8¨¯ª©¬Ð8Ð8Ñ9Ô9Ð9ð	:ð 	:ð 	:ñ 	:ô 	:ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:øøøð 	:ð 	:ð 	:ð 	:ð �f˜U”mÐ#ð 	Ø�4à�eŒ}˜SÔ!×'Ò'¨Ñ,Ô,ˆà�|Š|˜G¥R¤W×%7Ò%7¸Ñ%<Ô%<Ñ=Ô=Ð=àˆ4s   Á+BÂBÂB)r   r   )r�   r   r‚   r   r   r   )r†   r   r   r‡   )r   Ú
__future__r   r   ri   Úconfigparserr   Úpathlibr   Útypingr   r   Úapir	   Úcollections.abcr
   rj   r   r   rR   r„   Ú__all__r(   r   r   ú<module>rš      s=  ðØ €à "Ð "Ð "Ð "Ð "Ð "à 	€	€	€	Ø 
€
€
€
Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø *Ð *Ð *Ð *Ð *Ð *Ð *Ð *à  Ð  Ð  Ð  Ð  Ð  àð )Ø(Ð(Ð(Ð(Ð(Ð(à„<�7Òð ð ð  ð  ð  ð  ð
 ÐÐÐÐÐðN(ð N(ð N(ð N(ð N(ˆ?ñ N(ô N(ð N(ðbð ð ð ðð ð ð ð4 ð€€€r   