o
    ðT·jhJ  ã                   @  s”   d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
 ddlmZ er6ddlmZmZ dd	lmZ G d
d„ deƒZddd„Zddd„ZdS )z	Base API.é    )ÚannotationsN)ÚABCÚabstractmethod)Úsuppress)ÚPath)ÚTYPE_CHECKING)ÚIterableÚIterator)ÚLiteralc                   @  s  e Zd ZdZ								dÎdÏdd„ZedÐdd„ƒZejdÑdd„ƒZedÒdd„ƒZejdÓdd„ƒZedÐdd„ƒZ	e	jdÑdd„ƒZ	dÔd d!„Z
dÔd"d#„ZdÕd%d&„ZdÕd'd(„ZdÖd+d,„Zd×d/d0„ZdØd2d3„ZdÙd5d6„ZeedÚd7d8„ƒƒZeedÚd9d:„ƒƒZedÛd;d<„ƒZeedÚd=d>„ƒƒZeedÚd?d@„ƒƒZedÛdAdB„ƒZeedÚdCdD„ƒƒZeedÚdEdF„ƒƒZeedÚdGdH„ƒƒZeedÚdIdJ„ƒƒZeedÚdKdL„ƒƒZeedÚdMdN„ƒƒZeedÚdOdP„ƒƒZeedÚdQdR„ƒƒZ eedÚdSdT„ƒƒZ!eedÚdUdV„ƒƒZ"eedÚdWdX„ƒƒZ#eedÚdYdZ„ƒƒZ$eedÚd[d\„ƒƒZ%eedÚd]d^„ƒƒZ&eedÚd_d`„ƒƒZ'eedÚdadb„ƒƒZ(eedÚdcdd„ƒƒZ)eedÚdedf„ƒƒZ*eedÚdgdh„ƒƒZ+eedÚdidj„ƒƒZ,eedÚdkdl„ƒƒZ-edÛdmdn„ƒZ.eedÚdodp„ƒƒZ/eedÚdqdr„ƒƒZ0edÜdsdt„ƒZ1edÜdudv„ƒZ2edÜdwdx„ƒZ3edÜdydz„ƒZ4edÜd{d|„ƒZ5edÜd}d~„ƒZ6edÜdd€„ƒZ7edÜd�d‚„ƒZ8edÜdƒd„„ƒZ9edÜd…d†„ƒZ:edÜd‡dˆ„ƒZ;edÜd‰dŠ„ƒZ<edÜd‹dŒ„ƒZ=edÜd�dŽ„ƒZ>edÜd�d�„ƒZ?edÜd‘d’„ƒZ@edÜd“d”„ƒZAedÜd•d–„ƒZBedÜd—d˜„ƒZCedÜd™dš„ƒZDedÜd›dœ„ƒZEedÜd�dž„ƒZFedÜdŸd „ƒZGedÜd¡d¢„ƒZHedÜd£d¤„ƒZIedÜd¥d¦„ƒZJedÜd§d¨„ƒZKdÝd©dª„ZLdÝd«d¬„ZMdÝd­d®„ZNdÝd¯d°„ZOdÝd±d²„ZPdÝd³d´„ZQdÝdµd¶„ZRdÝd·d¸„ZSdÝd¹dº„ZTdÝd»d¼„ZUdÝd½d¾„ZVdÝd¿dÀ„ZWdÞdÂdÃ„ZXdÞdÄdÅ„ZYdÞdÆdÇ„ZZdÞdÈdÉ„Z[dÞdÊdË„Z\dÞdÌdÍ„Z]dS )ßÚPlatformDirsABCav  Abstract base class defining all platform directory properties, their :class:`~pathlib.Path` variants, and iterators.

    Platform-specific subclasses (e.g. :class:`~platformdirs.windows.Windows`, :class:`~platformdirs.macos.MacOS`,
    :class:`~platformdirs.unix.Unix`) implement the abstract properties to return the appropriate paths for each
    operating system.

    NFTÚappnameú
str | NoneÚ	appauthorústr | Literal[False] | NoneÚversionÚroamingÚboolÚ	multipathÚopinionÚensure_existsÚuse_site_for_rootÚreturnÚNonec	           	      C  s<   || _ || _|| _|| _	 || _	 || _	 || _	 || _dS )a‹  Create a new platform directory.

        :param appname: See `appname`.
        :param appauthor: See `appauthor`.
        :param version: See `version`.
        :param roaming: See `roaming`.
        :param multipath: See `multipath`.
        :param opinion: See `opinion`.
        :param ensure_exists: See `ensure_exists`.
        :param use_site_for_root: See `use_site_for_root`.

        N)r   r   r   r   r   r   r   r   )	Úselfr   r   r   r   r   r   r   r   © r   úS/home/dinkstrade/pdmp-scanner/venv/lib/python3.10/site-packages/platformdirs/api.pyÚ__init__   s   zPlatformDirsABC.__init__c                 C  ó   | j S )zThe name of the application.)Ú_appname©r   r   r   r   r   W   s   zPlatformDirsABC.appnameÚvaluec                 C  ó   t d|ƒ || _d S )Nr   )Ú_ensure_inside_baser   ©r   r    r   r   r   r   \   ó   

c                 C  r   )aG  The name of the app author or distributing body for this application.

        Typically, it is the owning company name. Defaults to `appname`. You may pass ``False`` to disable it.

        .. note::

            On Windows, the directory structure is ``<base>/<appauthor>/<appname>``. When ``appauthor`` is ``None`` (the
            default), it falls back to ``appname``, resulting in ``<base>/<appname>/<appname>`` (e.g.
            ``AppData/Local/myapp/myapp``). Pass ``appauthor=False`` to omit the author directory entirely and get
            ``<base>/<appname>``.

        )Ú
_appauthorr   r   r   r   r   a   s   zPlatformDirsABC.appauthorc                 C  r!   )Nr   )r"   r%   r#   r   r   r   r   q   r$   c                 C  r   )zîAn optional version path element to append to the path.

        You might want to use this if you want multiple versions of your app to be able to run independently. If used,
        this would typically be ``<major>.<minor>``.

        )Ú_versionr   r   r   r   r   v   s   zPlatformDirsABC.versionc                 C  r!   )Nr   )r"   r&   r#   r   r   r   r   €   r$   ÚbaseÚstrc                 G  s   | j |Ž }|  |¡ |S ©N)Ú_join_app_name_and_versionÚ_optionally_create_directory)r   r'   Úpathr   r   r   Ú_append_app_name_and_version…   s   

z,PlatformDirsABC._append_app_name_and_versionc                 G  sL   t |dd … ƒ}| jr| | j¡ | jr| | j¡ tjj|d g|¢R Ž S )Né   r   )Úlistr   Úappendr   Úosr,   Újoin)r   r'   Úparamsr   r   r   r*   Š   s   z*PlatformDirsABC._join_app_name_and_versionr,   c                 C  s<   | j sd S | d¡rd|›�}t|ƒ‚t|ƒjddd� d S )Nú~z;could not determine the home directory, refusing to create T)ÚparentsÚexist_ok)r   Ú
startswithÚRuntimeErrorr   Úmkdir)r   r,   Úmsgr   r   r   r+   ’   s   

z,PlatformDirsABC._optionally_create_directoryc                 C  s8   t tƒ� |  |¡ W d   ƒ d S 1 sw   Y  d S r)   )r   ÚFileExistsErrorr+   ©r   r,   r   r   r   Ú"_optionally_create_media_directory›   s   
"ÿz2PlatformDirsABC._optionally_create_media_directoryÚdirsú	list[str]c                 C  s6   | j r|n|d d… }|D ]}|  |¡ qtj |¡S )Nr.   )r   r+   r1   Úpathsepr2   )r   r>   Úselectedr,   r   r   r   Ú_select_site_dirs¡   s   z!PlatformDirsABC._select_site_dirsúIterable[str]úIterator[str]c                 c  s    � |D ]
}|   |¡ |V  qd S r)   )r+   ©r   r>   r,   r   r   r   Ú_create_as_yielded¨   s
   €
þz"PlatformDirsABC._create_as_yieldedr   c                 C  s   |d }|   |¡ t|ƒS ©Nr   )r+   r   rE   r   r   r   Ú_first_site_dir_as_path­   s   
z'PlatformDirsABC._first_site_dir_as_pathÚ	directoryc                 C  s   | j r| tj¡d }t|ƒS rG   )r   Ú	partitionr1   r@   r   )r   rI   r   r   r   Ú _first_item_as_path_if_multipath³   s   z0PlatformDirsABC._first_item_as_path_if_multipathc                 C  ó   dS )z Data directory tied to the user.Nr   r   r   r   r   Úuser_data_dir¹   ó    zPlatformDirsABC.user_data_dirc                 C  rL   )zData directory shared by users.Nr   r   r   r   r   Úsite_data_dir¾   rN   zPlatformDirsABC.site_data_dirc                 C  ó   t ‚r)   ©ÚNotImplementedErrorr   r   r   r   Ú_site_data_dirsÃ   ó   zPlatformDirsABC._site_data_dirsc                 C  rL   )z"Config directory tied to the user.Nr   r   r   r   r   Úuser_config_dirÇ   rN   zPlatformDirsABC.user_config_dirc                 C  rL   )z!Config directory shared by users.Nr   r   r   r   r   Úsite_config_dirÌ   rN   zPlatformDirsABC.site_config_dirc                 C  rP   r)   rQ   r   r   r   r   Ú_site_config_dirsÑ   rT   z!PlatformDirsABC._site_config_dirsc                 C  rL   )z!Cache directory tied to the user.Nr   r   r   r   r   Úuser_cache_dirÕ   rN   zPlatformDirsABC.user_cache_dirc                 C  rL   )z Cache directory shared by users.Nr   r   r   r   r   Úsite_cache_dirÚ   rN   zPlatformDirsABC.site_cache_dirc                 C  rL   )z!State directory tied to the user.Nr   r   r   r   r   Úuser_state_dirß   rN   zPlatformDirsABC.user_state_dirc                 C  rL   )z State directory shared by users.Nr   r   r   r   r   Úsite_state_dirä   rN   zPlatformDirsABC.site_state_dirc                 C  rL   )zLog directory tied to the user.Nr   r   r   r   r   Úuser_log_diré   rN   zPlatformDirsABC.user_log_dirc                 C  rL   )zLog directory shared by users.Nr   r   r   r   r   Úsite_log_dirî   rN   zPlatformDirsABC.site_log_dirc                 C  rL   )z%Documents directory tied to the user.Nr   r   r   r   r   Úuser_documents_diró   rN   z"PlatformDirsABC.user_documents_dirc                 C  rL   )z%Downloads directory tied to the user.Nr   r   r   r   r   Úuser_downloads_dirø   rN   z"PlatformDirsABC.user_downloads_dirc                 C  rL   )z$Pictures directory tied to the user.Nr   r   r   r   r   Úuser_pictures_dirý   rN   z!PlatformDirsABC.user_pictures_dirc                 C  rL   )z"Videos directory tied to the user.Nr   r   r   r   r   Úuser_videos_dir  rN   zPlatformDirsABC.user_videos_dirc                 C  rL   )z!Music directory tied to the user.Nr   r   r   r   r   Úuser_music_dir  rN   zPlatformDirsABC.user_music_dirc                 C  rL   )z#Desktop directory tied to the user.Nr   r   r   r   r   Úuser_desktop_dir  rN   z PlatformDirsABC.user_desktop_dirc                 C  rL   )z$Projects directory tied to the user.Nr   r   r   r   r   Úuser_projects_dir  rN   z!PlatformDirsABC.user_projects_dirc                 C  rL   )z(Public share directory tied to the user.Nr   r   r   r   r   Úuser_publicshare_dir  rN   z$PlatformDirsABC.user_publicshare_dirc                 C  rL   )z%Templates directory tied to the user.Nr   r   r   r   r   Úuser_templates_dir  rN   z"PlatformDirsABC.user_templates_dirc                 C  rL   )z!Fonts directory tied to the user.Nr   r   r   r   r   Úuser_fonts_dir   rN   zPlatformDirsABC.user_fonts_dirc                 C  rL   )z&Preference directory tied to the user.Nr   r   r   r   r   Úuser_preference_dir%  rN   z#PlatformDirsABC.user_preference_dirc                 C  rL   )zBin directory tied to the user.Nr   r   r   r   r   Úuser_bin_dir*  rN   zPlatformDirsABC.user_bin_dirc                 C  rL   )zBin directory shared by users.Nr   r   r   r   r   Úsite_bin_dir/  rN   zPlatformDirsABC.site_bin_dirc                 C  rL   )z(Applications directory tied to the user.Nr   r   r   r   r   Úuser_applications_dir4  rN   z%PlatformDirsABC.user_applications_dirc                 C  rL   )z'Applications directory shared by users.Nr   r   r   r   r   Úsite_applications_dir9  rN   z%PlatformDirsABC.site_applications_dirc                 C  rP   r)   rQ   r   r   r   r   Ú_site_applications_dirs>  rT   z'PlatformDirsABC._site_applications_dirsc                 C  rL   )z#Runtime directory tied to the user.Nr   r   r   r   r   Úuser_runtime_dirB  rN   z PlatformDirsABC.user_runtime_dirc                 C  rL   )z"Runtime directory shared by users.Nr   r   r   r   r   Úsite_runtime_dirG  rN   z PlatformDirsABC.site_runtime_dirc                 C  ó
   t | jƒS )zData path tied to the user.)r   rM   r   r   r   r   Úuser_data_pathL  ó   
zPlatformDirsABC.user_data_pathc                 C  rp   )zData path shared by users.)r   rO   r   r   r   r   Úsite_data_pathQ  rr   zPlatformDirsABC.site_data_pathc                 C  rp   )zConfig path tied to the user.)r   rU   r   r   r   r   Úuser_config_pathV  rr   z PlatformDirsABC.user_config_pathc                 C  rp   )zConfig path shared by users.)r   rV   r   r   r   r   Úsite_config_path[  rr   z PlatformDirsABC.site_config_pathc                 C  rp   )zCache path tied to the user.)r   rX   r   r   r   r   Úuser_cache_path`  rr   zPlatformDirsABC.user_cache_pathc                 C  rp   )zCache path shared by users.)r   rY   r   r   r   r   Úsite_cache_pathe  rr   zPlatformDirsABC.site_cache_pathc                 C  rp   )zState path tied to the user.)r   rZ   r   r   r   r   Úuser_state_pathj  rr   zPlatformDirsABC.user_state_pathc                 C  rp   )zState path shared by users.)r   r[   r   r   r   r   Úsite_state_patho  rr   zPlatformDirsABC.site_state_pathc                 C  rp   )zLog path tied to the user.)r   r\   r   r   r   r   Úuser_log_patht  rr   zPlatformDirsABC.user_log_pathc                 C  rp   )zLog path shared by users.)r   r]   r   r   r   r   Úsite_log_pathy  rr   zPlatformDirsABC.site_log_pathc                 C  rp   )z Documents path tied to the user.)r   r^   r   r   r   r   Úuser_documents_path~  rr   z#PlatformDirsABC.user_documents_pathc                 C  rp   )z Downloads path tied to the user.)r   r_   r   r   r   r   Úuser_downloads_pathƒ  rr   z#PlatformDirsABC.user_downloads_pathc                 C  rp   )zPictures path tied to the user.)r   r`   r   r   r   r   Úuser_pictures_pathˆ  rr   z"PlatformDirsABC.user_pictures_pathc                 C  rp   )zVideos path tied to the user.)r   ra   r   r   r   r   Úuser_videos_path�  rr   z PlatformDirsABC.user_videos_pathc                 C  rp   )zMusic path tied to the user.)r   rb   r   r   r   r   Úuser_music_path’  rr   zPlatformDirsABC.user_music_pathc                 C  rp   )zDesktop path tied to the user.)r   rc   r   r   r   r   Úuser_desktop_path—  rr   z!PlatformDirsABC.user_desktop_pathc                 C  rp   )zProjects path tied to the user.)r   rd   r   r   r   r   Úuser_projects_pathœ  rr   z"PlatformDirsABC.user_projects_pathc                 C  rp   )z#Public share path tied to the user.)r   re   r   r   r   r   Úuser_publicshare_path¡  rr   z%PlatformDirsABC.user_publicshare_pathc                 C  rp   )z Templates path tied to the user.)r   rf   r   r   r   r   Úuser_templates_path¦  rr   z#PlatformDirsABC.user_templates_pathc                 C  rp   )zFonts path tied to the user.)r   rg   r   r   r   r   Úuser_fonts_path«  rr   zPlatformDirsABC.user_fonts_pathc                 C  rp   )z!Preference path tied to the user.)r   rh   r   r   r   r   Úuser_preference_path°  rr   z$PlatformDirsABC.user_preference_pathc                 C  rp   )zBin path tied to the user.)r   ri   r   r   r   r   Úuser_bin_pathµ  rr   zPlatformDirsABC.user_bin_pathc                 C  rp   )zBin path shared by users.)r   rj   r   r   r   r   Úsite_bin_pathº  rr   zPlatformDirsABC.site_bin_pathc                 C  rp   )z#Applications path tied to the user.)r   rk   r   r   r   r   Úuser_applications_path¿  rr   z&PlatformDirsABC.user_applications_pathc                 C  s   |   | j¡S )zhApplications path shared by users. Only return the first item, even if ``multipath`` is set to ``True``.)rK   rl   r   r   r   r   Úsite_applications_pathÄ  s   z&PlatformDirsABC.site_applications_pathc                 C  rp   )zRuntime path tied to the user.)r   rn   r   r   r   r   Úuser_runtime_pathÉ  rr   z!PlatformDirsABC.user_runtime_pathc                 C  rp   )zRuntime path shared by users.)r   ro   r   r   r   r   Úsite_runtime_pathÎ  rr   z!PlatformDirsABC.site_runtime_pathc                 c  ó   � t |  ¡ ƒE dH  dS )z4:yield: all user and site configuration directories.N)Ú_uniqueÚ_iter_config_dirsr   r   r   r   Úiter_config_dirsÓ  ó   €z PlatformDirsABC.iter_config_dirsc                 c  ó   � | j V  | jV  d S r)   )rU   rV   r   r   r   r   r�   ×  ó   €z!PlatformDirsABC._iter_config_dirsc                 c  r�   )z+:yield: all user and site data directories.N)rŽ   Ú_iter_data_dirsr   r   r   r   Úiter_data_dirsÛ  r‘   zPlatformDirsABC.iter_data_dirsc                 c  r’   r)   )rM   rO   r   r   r   r   r”   ß  r“   zPlatformDirsABC._iter_data_dirsc                 c  r�   )z,:yield: all user and site cache directories.N)rŽ   Ú_iter_cache_dirsr   r   r   r   Úiter_cache_dirsã  r‘   zPlatformDirsABC.iter_cache_dirsc                 c  r’   r)   )rX   rY   r   r   r   r   r–   ç  r“   z PlatformDirsABC._iter_cache_dirsc                 c  r�   )z,:yield: all user and site state directories.N)rŽ   Ú_iter_state_dirsr   r   r   r   Úiter_state_dirsë  r‘   zPlatformDirsABC.iter_state_dirsc                 c  r’   r)   )rZ   r[   r   r   r   r   r˜   ï  r“   z PlatformDirsABC._iter_state_dirsc                 c  r�   )z*:yield: all user and site log directories.N)rŽ   Ú_iter_log_dirsr   r   r   r   Úiter_log_dirsó  r‘   zPlatformDirsABC.iter_log_dirsc                 c  r’   r)   )r\   r]   r   r   r   r   rš   ÷  r“   zPlatformDirsABC._iter_log_dirsc                 c  r�   )z.:yield: all user and site runtime directories.N)rŽ   Ú_iter_runtime_dirsr   r   r   r   Úiter_runtime_dirsû  r‘   z!PlatformDirsABC.iter_runtime_dirsc                 c  r’   r)   )rn   ro   r   r   r   r   rœ   ÿ  r“   z"PlatformDirsABC._iter_runtime_dirsúIterator[Path]c                 c  ó   � |   ¡ D ]}t|ƒV  qdS )z.:yield: all user and site configuration paths.N)r�   r   r<   r   r   r   Úiter_config_paths  ó   €ÿz!PlatformDirsABC.iter_config_pathsc                 c  rŸ   )z%:yield: all user and site data paths.N)r•   r   r<   r   r   r   Úiter_data_paths  r¡   zPlatformDirsABC.iter_data_pathsc                 c  rŸ   )z&:yield: all user and site cache paths.N)r—   r   r<   r   r   r   Úiter_cache_paths  r¡   z PlatformDirsABC.iter_cache_pathsc                 c  rŸ   )z&:yield: all user and site state paths.N)r™   r   r<   r   r   r   Úiter_state_paths  r¡   z PlatformDirsABC.iter_state_pathsc                 c  rŸ   )z$:yield: all user and site log paths.N)r›   r   r<   r   r   r   Úiter_log_paths  r¡   zPlatformDirsABC.iter_log_pathsc                 c  rŸ   )z(:yield: all user and site runtime paths.N)r�   r   r<   r   r   r   Úiter_runtime_paths  r¡   z"PlatformDirsABC.iter_runtime_paths)NNNFFTFF)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   )r    r   r   r   )r   r   )r    r   r   r   )r'   r(   r   r(   )r,   r(   r   r   )r>   r?   r   r(   ©r>   rC   r   rD   )r>   r?   r   r   )rI   r(   r   r   )r   r(   )r   r?   )r   r   )r   rD   )r   rž   )^Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr   Úsetterr   r   r-   r*   r+   r=   rB   rF   rH   rK   r   rM   rO   rS   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rq   rs   rt   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   r€   r�   r‚   rƒ   r„   r…   r†   r‡   rˆ   r‰   rŠ   r‹   rŒ   r�   r�   r•   r”   r—   r–   r™   r˜   r›   rš   r�   rœ   r    r¢   r£   r¤   r¥   r¦   r   r   r   r   r      s|   
÷>	



	




















r   Únamer(   r    r   r   r   c                 C  sV   |sd S t j |¡\}}|s| d¡sd| dd¡ d¡v r)| › d|›�}t|ƒ‚d S )N)ú/ú\z..r°   r¯   z* must stay inside the base directory, got )r1   r,   Ú
splitdriver7   ÚreplaceÚsplitÚ
ValueError)r®   r    ÚdriveÚtailr:   r   r   r   r"   "  s   $þr"   r>   rC   rD   c                 c  s.   � t ƒ }| D ]}||vr| |¡ |V  qdS )zB:yield: ``dirs`` in order, skipping any directory already yielded.N)ÚsetÚadd)r>   Úseenr,   r   r   r   rŽ   ,  s   €
€ýrŽ   )r®   r(   r    r   r   r   r§   )r«   Ú
__future__r   r1   Úabcr   r   Ú
contextlibr   Úpathlibr   Útypingr   Úcollections.abcr   r	   r
   r   r"   rŽ   r   r   r   r   Ú<module>   s"        

