Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pkg_resources/_vendor/platformdirs/macos.py: 0%
32 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:35 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:35 +0000
1from __future__ import annotations
3import os
5from .api import PlatformDirsABC
8class MacOS(PlatformDirsABC):
9 """
10 Platform directories for the macOS operating system. Follows the guidance from `Apple documentation
11 <https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html>`_.
12 Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>` and
13 `version <platformdirs.api.PlatformDirsABC.version>`.
14 """
16 @property
17 def user_data_dir(self) -> str:
18 """:return: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``"""
19 return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support/"))
21 @property
22 def site_data_dir(self) -> str:
23 """:return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``"""
24 return self._append_app_name_and_version("/Library/Application Support")
26 @property
27 def user_config_dir(self) -> str:
28 """:return: config directory tied to the user, e.g. ``~/Library/Preferences/$appname/$version``"""
29 return self._append_app_name_and_version(os.path.expanduser("~/Library/Preferences/"))
31 @property
32 def site_config_dir(self) -> str:
33 """:return: config directory shared by the users, e.g. ``/Library/Preferences/$appname``"""
34 return self._append_app_name_and_version("/Library/Preferences")
36 @property
37 def user_cache_dir(self) -> str:
38 """:return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``"""
39 return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches"))
41 @property
42 def user_state_dir(self) -> str:
43 """:return: state directory tied to the user, same as `user_data_dir`"""
44 return self.user_data_dir
46 @property
47 def user_log_dir(self) -> str:
48 """:return: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``"""
49 return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs"))
51 @property
52 def user_documents_dir(self) -> str:
53 """:return: documents directory tied to the user, e.g. ``~/Documents``"""
54 return os.path.expanduser("~/Documents")
56 @property
57 def user_runtime_dir(self) -> str:
58 """:return: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``"""
59 return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems"))
62__all__ = [
63 "MacOS",
64]