o
    ðT·j“(  ã                   @  s¾   U d Z ddlmZ ddlZddlZddlZddlmZm	Z	 er%ddl
mZ ddlmZ ddlmZ er9dd	lmZ G d
d„ deƒZG dd„ deeƒZe dej¡Zded< ddd„ZdgZdS )zmacOS.é    )ÚannotationsN)ÚTYPE_CHECKINGÚFinal)ÚIteratoré   )ÚXDGMixin)ÚPlatformDirsABC)ÚPathc                   @  s  e Zd ZdZdRdd„ZdSdd„ZedRd	d
„ƒZedSdd„ƒZedTdd„ƒZ	edTdd„ƒZ
edRdd„ƒZedSdd„ƒZedRdd„ƒZedSdd„ƒZedRdd„ƒZedTdd„ƒZedRdd„ƒZedRd d!„ƒZedRd"d#„ƒZedRd$d%„ƒZedRd&d'„ƒZedRd(d)„ƒZedRd*d+„ƒZedRd,d-„ƒZedRd.d/„ƒZedRd0d1„ƒZedRd2d3„ƒZedRd4d5„ƒZedRd6d7„ƒZedRd8d9„ƒZedRd:d;„ƒZedRd<d=„ƒZ edRd>d?„ƒZ!edRd@dA„ƒZ"edSdBdC„ƒZ#edRdDdE„ƒZ$edRdFdG„ƒZ%edRdHdI„ƒZ&dUdKdL„Z'dUdMdN„Z(dUdOdP„Z)dQS )VÚ_MacOSDefaultsaˆ  Default platform directories for macOS without XDG environment variable overrides.

    Follows the guidance from `Apple's File System Programming Guide
    <https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html>`_.
    The XDG env var handling is in :class:`~platformdirs._xdg.XDGMixin`.

    ÚreturnÚstrc                 C  ó   |   tj d¡¡S )Nz~/Library/Application Support©Ú_append_app_name_and_versionÚosÚpathÚ
expanduser©Úself© r   úU/home/dinkstrade/pdmp-scanner/venv/lib/python3.10/site-packages/platformdirs/macos.pyÚ_base_user_app_support_dir   s   z)_MacOSDefaults._base_user_app_support_dirú	list[str]c                 C  ó4   t ƒ  }r|  |› d�¡gng }| |  d¡¡ |S )Nz/sharez/Library/Application Support©Ú_homebrew_prefixÚ_join_app_name_and_versionÚappend©r   ÚprefixÚ	path_listr   r   r   Ú_base_site_dirs    s    z_MacOSDefaults._base_site_dirsc                 C  ó   |   ¡ S )zZData directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``.©r   r   r   r   r   Úuser_data_dir%   ó   z_MacOSDefaults.user_data_dirc                 C  r"   ©N©r!   r   r   r   r   Ú_site_data_dirs*   ó   z_MacOSDefaults._site_data_dirsr	   c                 C  ó   |   | j¡S )z`Data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``.)Ú_first_site_dir_as_pathr(   r   r   r   r   Úsite_data_path.   ó   z_MacOSDefaults.site_data_pathc                 C  r*   )zbConfig path shared by users. Only return the first item, even if ``multipath`` is set to ``True``.)r+   Ú_site_config_dirsr   r   r   r   Úsite_config_path3   r-   z_MacOSDefaults.site_config_pathc                 C  r"   )z;Config directory tied to the user, same as `user_data_dir`.r#   r   r   r   r   Úuser_config_dir8   r%   z_MacOSDefaults.user_config_dirc                 C  r"   r&   r'   r   r   r   r   r.   =   r)   z _MacOSDefaults._site_config_dirsc                 C  r   )zNCache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``.z~/Library/Cachesr   r   r   r   r   Úuser_cache_dirA   ó   z_MacOSDefaults.user_cache_dirc                 C  r   )Nz
/var/cachez/Library/Cachesr   r   r   r   r   Ú_site_cache_dirsF   s    z_MacOSDefaults._site_cache_dirsc                 C  r*   )aë  Cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``. If we're using a Python binary managed by `Homebrew <https://brew.sh>`_, the directory will be under the Homebrew prefix, e.g. ``$homebrew_prefix/var/cache/$appname/$version``. If `multipath <platformdirs.api.PlatformDirsABC.multipath>` is enabled, and we're in Homebrew, the response is a multi-path string separated by ":", e.g. ``$homebrew_prefix/var/cache/$appname/$version:/Library/Caches/$appname/$version``.)Ú_select_site_dirsr3   r   r   r   r   Úsite_cache_dirL   r-   z_MacOSDefaults.site_cache_dirc                 C  r*   )zaCache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``.)r+   r3   r   r   r   r   Úsite_cache_pathQ   r-   z_MacOSDefaults.site_cache_pathc                 C  r"   )z�State directory tied to the user, same as `user_data_dir` without ``$XDG_DATA_HOME``, e.g. ``~/Library/Application Support/$appname/$version``.r#   r   r   r   r   Úuser_state_dirV   r%   z_MacOSDefaults.user_state_dirc                 C  s   |   ¡ d }|  |¡ |S )z¢State directory shared by users, the first entry of `site_data_dir` without ``$XDG_DATA_DIRS``, ignoring `multipath <platformdirs.api.PlatformDirsABC.multipath>`.r   )r!   Ú_optionally_create_directory)r   r   r   r   r   Úsite_state_dir[   s   
z_MacOSDefaults.site_state_dirc                 C  r   )zJLog directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``.z~/Library/Logsr   r   r   r   r   Úuser_log_dirb   r2   z_MacOSDefaults.user_log_dirc                 C  s
   |   d¡S )zHLog directory shared by users, e.g. ``/Library/Logs/$appname/$version``.z/Library/Logs)r   r   r   r   r   Úsite_log_dirg   s   
z_MacOSDefaults.site_log_dirc                 C  ó   t j d¡S )z;Documents directory tied to the user, e.g. ``~/Documents``.z~/Documents©r   r   r   r   r   r   r   Úuser_documents_dirl   r-   z!_MacOSDefaults.user_documents_dirc                 C  r<   )z;Downloads directory tied to the user, e.g. ``~/Downloads``.z~/Downloadsr=   r   r   r   r   Úuser_downloads_dirq   r-   z!_MacOSDefaults.user_downloads_dirc                 C  r<   )z9Pictures directory tied to the user, e.g. ``~/Pictures``.z
~/Picturesr=   r   r   r   r   Úuser_pictures_dirv   r-   z _MacOSDefaults.user_pictures_dirc                 C  r<   )z5Videos directory tied to the user, e.g. ``~/Movies``.z~/Moviesr=   r   r   r   r   Úuser_videos_dir{   r-   z_MacOSDefaults.user_videos_dirc                 C  r<   )z3Music directory tied to the user, e.g. ``~/Music``.z~/Musicr=   r   r   r   r   Úuser_music_dir€   r-   z_MacOSDefaults.user_music_dirc                 C  r<   )z7Desktop directory tied to the user, e.g. ``~/Desktop``.z	~/Desktopr=   r   r   r   r   Úuser_desktop_dir…   r-   z_MacOSDefaults.user_desktop_dirc                 C  r<   )z9Projects directory tied to the user, e.g. ``~/Projects``.z
~/Projectsr=   r   r   r   r   Úuser_projects_dirŠ   r-   z _MacOSDefaults.user_projects_dirc                 C  r<   )z;Public share directory tied to the user, e.g. ``~/Public``.z~/Publicr=   r   r   r   r   Úuser_publicshare_dir�   r-   z#_MacOSDefaults.user_publicshare_dirc                 C  r<   )z;Templates directory tied to the user, e.g. ``~/Templates``.z~/Templatesr=   r   r   r   r   Úuser_templates_dir”   r-   z!_MacOSDefaults.user_templates_dirc                 C  r<   )z;Fonts directory tied to the user, e.g. ``~/Library/Fonts``.z~/Library/Fontsr=   r   r   r   r   Úuser_fonts_dir™   r-   z_MacOSDefaults.user_fonts_dirc                 C  r   )zNPreference directory tied to the user, e.g. ``~/Library/Preferences/AppName``.z~/Library/Preferencesr   r   r   r   r   Úuser_preference_dirž   r2   z"_MacOSDefaults.user_preference_dirc                 C  r<   )z6Bin directory tied to the user, e.g. ``~/.local/bin``.z~/.local/binr=   r   r   r   r   Úuser_bin_dir£   r-   z_MacOSDefaults.user_bin_dirc                 C  s   dS )z7Bin directory shared by users, e.g. ``/usr/local/bin``.z/usr/local/binr   r   r   r   r   Úsite_bin_dir¨   s   z_MacOSDefaults.site_bin_dirc                 C  r<   )zAApplications directory tied to the user, e.g. ``~/Applications``.z~/Applicationsr=   r   r   r   r   Úuser_applications_dir­   r-   z$_MacOSDefaults.user_applications_dirc                 C  s   dgS )Nz/Applicationsr   r   r   r   r   Ú_site_applications_dirs²   s   z&_MacOSDefaults._site_applications_dirsc                 C  s    | j }| jrtj |¡S |d S )z?Applications directory shared by users, e.g. ``/Applications``.r   )rL   Ú	multipathr   ÚpathsepÚjoin)r   Údirsr   r   r   Úsite_applications_dir¶   s   z$_MacOSDefaults.site_applications_dirc                 C  r   )z_Runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``.z~/Library/Caches/TemporaryItemsr   r   r   r   r   Úuser_runtime_dir¼   r2   z_MacOSDefaults.user_runtime_dirc                 C  s   | j S )z>Runtime directory shared by users, same as `user_runtime_dir`.)rR   r   r   r   r   Úsite_runtime_dirÁ   s   z_MacOSDefaults.site_runtime_dirúIterator[str]c                 c  ó    � | j V  |  | j¡E d H  d S r&   )r0   Ú_create_as_yieldedr.   r   r   r   r   Ú_iter_config_dirsÆ   ó   €z _MacOSDefaults._iter_config_dirsc                 c  rU   r&   )r$   rV   r(   r   r   r   r   Ú_iter_data_dirsÊ   rX   z_MacOSDefaults._iter_data_dirsc                 c  rU   r&   )r1   rV   r3   r   r   r   r   Ú_iter_cache_dirsÎ   rX   z_MacOSDefaults._iter_cache_dirsN)r   r   )r   r   )r   r	   )r   rT   )*Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r!   Úpropertyr$   r(   r,   r/   r0   r.   r1   r3   r5   r6   r7   r9   r:   r;   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rQ   rR   rS   rW   rY   rZ   r   r   r   r   r
      sŽ    



r
   c                   @  s   e Zd ZdZdS )ÚMacOSaF  Platform directories for the macOS operating system.

    Follows the guidance from `Apple documentation
    <https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html>`_.
    Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`, `version
    <platformdirs.api.PlatformDirsABC.version>`, `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.

    XDG environment variables (e.g. ``$XDG_DATA_HOME``) are supported and take precedence over macOS defaults.

    N)r[   r\   r]   r^   r   r   r   r   r`   Ó   s    r`   a.  
    (?P<prefix>.+)                 # $HOMEBREW_PREFIX, such as /opt/homebrew or /usr/local
    /opt/python[^/]*               # formula link: python, python3 or python@3.13
    /Frameworks/Python\.framework  # framework build
    /Versions/[^/]+                # interpreter version, such as 3.13
    r   Ú_HOMEBREW_PYTHONr   ú
str | Nonec                  C  s   t  tj¡ } r| d S d S )Nr   )ra   Ú	fullmatchÚsysÚbase_prefix)Úmatchr   r   r   r   ì   s   r   )r   rb   )r^   Ú
__future__r   Úos.pathr   Úrerd   Útypingr   r   Úcollections.abcr   Ú_xdgr   Úapir   Úpathlibr	   r
   r`   ÚcompileÚVERBOSEra   Ú__annotations__r   Ú__all__r   r   r   r   Ú<module>   s,     @ù
ÿ